| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef ASH_COMMON_WALLPAPER_WALLPAPER_CONTROLLER_H_ | 5 #ifndef ASH_COMMON_WALLPAPER_WALLPAPER_CONTROLLER_H_ |
| 6 #define ASH_COMMON_WALLPAPER_WALLPAPER_CONTROLLER_H_ | 6 #define ASH_COMMON_WALLPAPER_WALLPAPER_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 // Add/Remove observers. | 49 // Add/Remove observers. |
| 50 void AddObserver(WallpaperControllerObserver* observer); | 50 void AddObserver(WallpaperControllerObserver* observer); |
| 51 void RemoveObserver(WallpaperControllerObserver* observer); | 51 void RemoveObserver(WallpaperControllerObserver* observer); |
| 52 | 52 |
| 53 // Provides current image on the wallpaper, or empty gfx::ImageSkia if there | 53 // Provides current image on the wallpaper, or empty gfx::ImageSkia if there |
| 54 // is no image, e.g. wallpaper is none. | 54 // is no image, e.g. wallpaper is none. |
| 55 gfx::ImageSkia GetWallpaper() const; | 55 gfx::ImageSkia GetWallpaper() const; |
| 56 | 56 |
| 57 wallpaper::WallpaperLayout GetWallpaperLayout() const; | 57 wallpaper::WallpaperLayout GetWallpaperLayout() const; |
| 58 | 58 |
| 59 // Sets wallpaper. This is mostly called by WallpaperManager to set | 59 // Sets the wallpaper and alerts observers of changes. |
| 60 // the default or user selected custom wallpaper. | 60 void SetWallpaperImage(const gfx::ImageSkia& image, |
| 61 // Returns true if new image was actually set. And false when duplicate set | |
| 62 // request detected. | |
| 63 bool SetWallpaperImage(const gfx::ImageSkia& image, | |
| 64 wallpaper::WallpaperLayout layout); | 61 wallpaper::WallpaperLayout layout); |
| 65 | 62 |
| 66 // Creates an empty wallpaper. Some tests require a wallpaper widget is ready | 63 // Creates an empty wallpaper. Some tests require a wallpaper widget is ready |
| 67 // when running. However, the wallpaper widgets are now created | 64 // when running. However, the wallpaper widgets are now created |
| 68 // asynchronously. If loading a real wallpaper, there are cases that these | 65 // asynchronously. If loading a real wallpaper, there are cases that these |
| 69 // tests crash because the required widget is not ready. This function | 66 // tests crash because the required widget is not ready. This function |
| 70 // synchronously creates an empty widget for those tests to prevent | 67 // synchronously creates an empty widget for those tests to prevent |
| 71 // crashes. An example test is SystemGestureEventFilterTest.ThreeFingerSwipe. | 68 // crashes. An example test is SystemGestureEventFilterTest.ThreeFingerSwipe. |
| 72 void CreateEmptyWallpaper(); | 69 void CreateEmptyWallpaper(); |
| 73 | 70 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 99 wallpaper::WallpaperLayout layout) const; | 96 wallpaper::WallpaperLayout layout) const; |
| 100 | 97 |
| 101 void set_wallpaper_reload_delay_for_test(int value) { | 98 void set_wallpaper_reload_delay_for_test(int value) { |
| 102 wallpaper_reload_delay_ = value; | 99 wallpaper_reload_delay_ = value; |
| 103 } | 100 } |
| 104 | 101 |
| 105 // Opens the set wallpaper page in the browser. | 102 // Opens the set wallpaper page in the browser. |
| 106 void OpenSetWallpaperPage(); | 103 void OpenSetWallpaperPage(); |
| 107 | 104 |
| 108 // mojom::WallpaperController overrides: | 105 // mojom::WallpaperController overrides: |
| 106 void SetWallpaperPicker(mojom::WallpaperPickerPtr picker) override; |
| 109 void SetWallpaper(const SkBitmap& wallpaper, | 107 void SetWallpaper(const SkBitmap& wallpaper, |
| 110 wallpaper::WallpaperLayout layout) override; | 108 wallpaper::WallpaperLayout layout) override; |
| 111 | 109 |
| 112 private: | 110 private: |
| 113 // Creates a WallpaperWidgetController for |root_window|. | 111 // Creates a WallpaperWidgetController for |root_window|. |
| 114 void InstallDesktopController(WmWindow* root_window); | 112 void InstallDesktopController(WmWindow* root_window); |
| 115 | 113 |
| 116 // Creates a WallpaperWidgetController for all root windows. | 114 // Creates a WallpaperWidgetController for all root windows. |
| 117 void InstallDesktopControllerForAllWindows(); | 115 void InstallDesktopControllerForAllWindows(); |
| 118 | 116 |
| 119 // Moves the wallpaper to the specified container across all root windows. | 117 // Moves the wallpaper to the specified container across all root windows. |
| 120 // Returns true if a wallpaper moved. | 118 // Returns true if a wallpaper moved. |
| 121 bool ReparentWallpaper(int container); | 119 bool ReparentWallpaper(int container); |
| 122 | 120 |
| 123 // Returns the wallpaper container id for unlocked and locked states. | 121 // Returns the wallpaper container id for unlocked and locked states. |
| 124 int GetWallpaperContainerId(bool locked); | 122 int GetWallpaperContainerId(bool locked); |
| 125 | 123 |
| 126 // Reload the wallpaper. |clear_cache| specifies whether to clear the | 124 // Reload the wallpaper. |clear_cache| specifies whether to clear the |
| 127 // wallpaper cahce or not. | 125 // wallpaper cahce or not. |
| 128 void UpdateWallpaper(bool clear_cache); | 126 void UpdateWallpaper(bool clear_cache); |
| 129 | 127 |
| 130 bool locked_; | 128 bool locked_; |
| 131 | 129 |
| 132 WallpaperMode wallpaper_mode_; | 130 WallpaperMode wallpaper_mode_; |
| 133 | 131 |
| 132 // Wallpaper picker interface in chrome browser, used to open the picker. |
| 133 mojom::WallpaperPickerPtr wallpaper_picker_; |
| 134 |
| 134 // Bindings for the WallpaperController interface. | 135 // Bindings for the WallpaperController interface. |
| 135 mojo::BindingSet<mojom::WallpaperController> bindings_; | 136 mojo::BindingSet<mojom::WallpaperController> bindings_; |
| 136 | 137 |
| 137 base::ObserverList<WallpaperControllerObserver> observers_; | 138 base::ObserverList<WallpaperControllerObserver> observers_; |
| 138 | 139 |
| 139 std::unique_ptr<wallpaper::WallpaperResizer> current_wallpaper_; | 140 std::unique_ptr<wallpaper::WallpaperResizer> current_wallpaper_; |
| 140 | 141 |
| 141 gfx::Size current_max_display_size_; | 142 gfx::Size current_max_display_size_; |
| 142 | 143 |
| 143 base::OneShotTimer timer_; | 144 base::OneShotTimer timer_; |
| 144 | 145 |
| 145 int wallpaper_reload_delay_; | 146 int wallpaper_reload_delay_; |
| 146 | 147 |
| 147 scoped_refptr<base::TaskRunner> task_runner_; | 148 scoped_refptr<base::TaskRunner> task_runner_; |
| 148 | 149 |
| 149 DISALLOW_COPY_AND_ASSIGN(WallpaperController); | 150 DISALLOW_COPY_AND_ASSIGN(WallpaperController); |
| 150 }; | 151 }; |
| 151 | 152 |
| 152 } // namespace ash | 153 } // namespace ash |
| 153 | 154 |
| 154 #endif // ASH_COMMON_WALLPAPER_WALLPAPER_CONTROLLER_H_ | 155 #endif // ASH_COMMON_WALLPAPER_WALLPAPER_CONTROLLER_H_ |
| OLD | NEW |