Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Side by Side Diff: ash/wallpaper/wallpaper_controller.h

Issue 2872123002: Wallpaper resize extents compositor lock timeout. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_WALLPAPER_WALLPAPER_CONTROLLER_H_ 5 #ifndef ASH_WALLPAPER_WALLPAPER_CONTROLLER_H_
6 #define ASH_WALLPAPER_WALLPAPER_CONTROLLER_H_ 6 #define ASH_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"
11 #include "ash/public/interfaces/wallpaper.mojom.h" 11 #include "ash/public/interfaces/wallpaper.mojom.h"
12 #include "ash/session/session_observer.h" 12 #include "ash/session/session_observer.h"
13 #include "ash/shell_observer.h" 13 #include "ash/shell_observer.h"
14 #include "ash/wm_display_observer.h" 14 #include "ash/wm_display_observer.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/observer_list.h" 16 #include "base/observer_list.h"
17 #include "base/timer/timer.h" 17 #include "base/timer/timer.h"
18 #include "components/wallpaper/wallpaper_color_calculator_observer.h" 18 #include "components/wallpaper/wallpaper_color_calculator_observer.h"
19 #include "components/wallpaper/wallpaper_layout.h" 19 #include "components/wallpaper/wallpaper_layout.h"
20 #include "components/wallpaper/wallpaper_resizer_observer.h" 20 #include "components/wallpaper/wallpaper_resizer_observer.h"
21 #include "mojo/public/cpp/bindings/binding_set.h" 21 #include "mojo/public/cpp/bindings/binding_set.h"
22 #include "ui/compositor/compositor_lock.h"
22 #include "ui/gfx/color_analysis.h" 23 #include "ui/gfx/color_analysis.h"
23 #include "ui/gfx/image/image_skia.h" 24 #include "ui/gfx/image/image_skia.h"
24 25
25 namespace base { 26 namespace base {
26 class TaskRunner; 27 class TaskRunner;
27 } 28 }
28 29
29 namespace wallpaper { 30 namespace wallpaper {
30 class WallpaperColorCalculator; 31 class WallpaperColorCalculator;
31 class WallpaperResizer; 32 class WallpaperResizer;
32 } 33 }
33 34
34 namespace ash { 35 namespace ash {
35 36
36 class WallpaperControllerObserver; 37 class WallpaperControllerObserver;
37 38
38 // Controls the desktop background wallpaper: 39 // Controls the desktop background wallpaper:
39 // - Sets a wallpaper image and layout; 40 // - Sets a wallpaper image and layout;
40 // - Handles display change (add/remove display, configuration change etc); 41 // - Handles display change (add/remove display, configuration change etc);
41 // - Calculates prominent color for shelf; 42 // - Calculates prominent color for shelf;
42 // - Move wallpaper to locked container(s) when session state is not ACTIVE to 43 // - Move wallpaper to locked container(s) when session state is not ACTIVE to
43 // hide the user desktop and move it to unlocked container when session 44 // hide the user desktop and move it to unlocked container when session
44 // state is ACTIVE; 45 // state is ACTIVE;
45 class ASH_EXPORT WallpaperController 46 class ASH_EXPORT WallpaperController
46 : public NON_EXPORTED_BASE(mojom::WallpaperController), 47 : public NON_EXPORTED_BASE(mojom::WallpaperController),
47 public WmDisplayObserver, 48 public WmDisplayObserver,
48 public ShellObserver, 49 public ShellObserver,
49 public wallpaper::WallpaperResizerObserver, 50 public wallpaper::WallpaperResizerObserver,
50 public wallpaper::WallpaperColorCalculatorObserver, 51 public wallpaper::WallpaperColorCalculatorObserver,
51 public SessionObserver { 52 public SessionObserver,
53 NON_EXPORTED_BASE(public ui::CompositorLockClient) {
52 public: 54 public:
53 enum WallpaperMode { WALLPAPER_NONE, WALLPAPER_IMAGE }; 55 enum WallpaperMode { WALLPAPER_NONE, WALLPAPER_IMAGE };
54 56
55 // The value assigned to |prominent_color_| if extraction fails or the feature 57 // The value assigned to |prominent_color_| if extraction fails or the feature
56 // is disabled (e.g. command line, lock/login screens). 58 // is disabled (e.g. command line, lock/login screens).
57 static constexpr SkColor kInvalidColor = SK_ColorTRANSPARENT; 59 static constexpr SkColor kInvalidColor = SK_ColorTRANSPARENT;
58 60
59 explicit WallpaperController( 61 explicit WallpaperController(
60 const scoped_refptr<base::TaskRunner>& task_runner); 62 const scoped_refptr<base::TaskRunner>& task_runner);
61 ~WallpaperController() override; 63 ~WallpaperController() override;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 bool ShouldCalculateColors() const; 168 bool ShouldCalculateColors() const;
167 169
168 // Move all wallpaper widgets to the locked container. 170 // Move all wallpaper widgets to the locked container.
169 // Returns true if the wallpaper moved. 171 // Returns true if the wallpaper moved.
170 bool MoveToLockedContainer(); 172 bool MoveToLockedContainer();
171 173
172 // Move all wallpaper widgets to unlocked container. 174 // Move all wallpaper widgets to unlocked container.
173 // Returns true if the wallpaper moved. 175 // Returns true if the wallpaper moved.
174 bool MoveToUnlockedContainer(); 176 bool MoveToUnlockedContainer();
175 177
178 // When wallpaper resizes, we can check which displays will
179 // be affected. For simplicity, we only lock the compositor for the internal
180 // display.
181 void GetInternalDisplayCompositorLock();
182 // CompositorLockClient:
183 void CompositorLockTimedOut() override;
184
176 bool locked_; 185 bool locked_;
177 186
178 WallpaperMode wallpaper_mode_; 187 WallpaperMode wallpaper_mode_;
179 188
180 // Wallpaper picker interface in chrome browser, used to open the picker. 189 // Wallpaper picker interface in chrome browser, used to open the picker.
181 mojom::WallpaperPickerPtr wallpaper_picker_; 190 mojom::WallpaperPickerPtr wallpaper_picker_;
182 191
183 // Bindings for the WallpaperController interface. 192 // Bindings for the WallpaperController interface.
184 mojo::BindingSet<mojom::WallpaperController> bindings_; 193 mojo::BindingSet<mojom::WallpaperController> bindings_;
185 194
(...skipping 11 matching lines...) Expand all
197 gfx::Size current_max_display_size_; 206 gfx::Size current_max_display_size_;
198 207
199 base::OneShotTimer timer_; 208 base::OneShotTimer timer_;
200 209
201 int wallpaper_reload_delay_; 210 int wallpaper_reload_delay_;
202 211
203 scoped_refptr<base::TaskRunner> task_runner_; 212 scoped_refptr<base::TaskRunner> task_runner_;
204 213
205 ScopedSessionObserver scoped_session_observer_; 214 ScopedSessionObserver scoped_session_observer_;
206 215
216 std::unique_ptr<ui::CompositorLock> compositor_lock_;
217
207 DISALLOW_COPY_AND_ASSIGN(WallpaperController); 218 DISALLOW_COPY_AND_ASSIGN(WallpaperController);
208 }; 219 };
209 220
210 } // namespace ash 221 } // namespace ash
211 222
212 #endif // ASH_WALLPAPER_WALLPAPER_CONTROLLER_H_ 223 #endif // ASH_WALLPAPER_WALLPAPER_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698