glanceables_controller.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Copyright 2022 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef ASH_GLANCEABLES_GLANCEABLES_CONTROLLER_H_
  5. #define ASH_GLANCEABLES_GLANCEABLES_CONTROLLER_H_
  6. #include <memory>
  7. #include "ash/ash_export.h"
  8. namespace views {
  9. class Widget;
  10. } // namespace views
  11. namespace ash {
  12. class GlanceablesView;
  13. // Controls the "welcome back" glanceables screen shown on login.
  14. class ASH_EXPORT GlanceablesController {
  15. public:
  16. GlanceablesController();
  17. GlanceablesController(const GlanceablesController&) = delete;
  18. GlanceablesController& operator=(const GlanceablesController&) = delete;
  19. ~GlanceablesController();
  20. // Creates the glanceables widget and view.
  21. void CreateUi();
  22. // Destroys the glanceables widget and view.
  23. void DestroyUi();
  24. // Triggers a fetch of data from the server. This method is separate from
  25. // CreateUi() so we can avoid triggering server fetches in tests.
  26. void FetchData();
  27. views::Widget* widget_for_test() { return widget_.get(); }
  28. GlanceablesView* view_for_test() { return view_; }
  29. private:
  30. std::unique_ptr<views::Widget> widget_;
  31. GlanceablesView* view_ = nullptr;
  32. };
  33. } // namespace ash
  34. #endif // ASH_GLANCEABLES_GLANCEABLES_CONTROLLER_H_