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

Side by Side Diff: ash/desktop_background/desktop_background_widget_controller.h

Issue 10827284: Fix white flash when user sings out and wallpaper animation regression (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nits and less confusing class comments Created 8 years, 4 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 | Annotate | Revision Log
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_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_WIDGET_CONTROLLER_H_ 5 #ifndef ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_WIDGET_CONTROLLER_H_
6 #define ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_WIDGET_CONTROLLER_H_ 6 #define ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_WIDGET_CONTROLLER_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "ui/aura/window_property.h" 9 #include "ui/aura/window_property.h"
10 #include "ui/compositor/layer.h" 10 #include "ui/compositor/layer.h"
11 #include "ui/views/widget/widget.h" 11 #include "ui/views/widget/widget.h"
12 12
13 namespace ash { 13 namespace ash {
14 namespace internal { 14 namespace internal {
15 15
16 // This class hides difference between two possible background implementations: 16 // This class hides difference between two possible background implementations:
17 // effective Layer-based for solid color, and Widget-based for images. 17 // effective Layer-based for solid color, and Widget-based for images.
18 // DesktopBackgroundWidgetController is installed as an owned property on the
19 // RootWindow. To avoid a white flash during wallpaper changes the old
20 // DesktopBackgroundWidgetController is moved to a secondary property
21 // (kComponentWrapper). When the animation completes the old
22 // DesktopBackgroundWidgetController is destroyed.
18 class DesktopBackgroundWidgetController { 23 class DesktopBackgroundWidgetController {
19 public: 24 public:
20 // Create 25 // Create
21 explicit DesktopBackgroundWidgetController(views::Widget* widget); 26 explicit DesktopBackgroundWidgetController(views::Widget* widget);
22 explicit DesktopBackgroundWidgetController(ui::Layer* layer); 27 explicit DesktopBackgroundWidgetController(ui::Layer* layer);
23 28
24 ~DesktopBackgroundWidgetController(); 29 ~DesktopBackgroundWidgetController();
25 30
26 // Set bounds of component that draws background. 31 // Set bounds of component that draws background.
27 void SetBounds(gfx::Rect bounds); 32 void SetBounds(gfx::Rect bounds);
28 33
29 // Move component from |src_container| in |root_window| to |dest_container|. 34 // Move component from |src_container| in |root_window| to |dest_container|.
30 // It is required for lock screen, when we need to move background so that 35 // It is required for lock screen, when we need to move background so that
31 // it hides user's windows. 36 // it hides user's windows.
32 void Reparent(aura::RootWindow* root_window, 37 void Reparent(aura::RootWindow* root_window,
33 int src_container, 38 int src_container,
34 int dest_container); 39 int dest_container);
35 40
36 views::Widget* widget() { return widget_; } 41 views::Widget* widget() { return widget_; }
37 ui::Layer* layer() { return layer_.get(); } 42 ui::Layer* layer() { return layer_.get(); }
38 43
39 private: 44 private:
40 views::Widget* widget_; 45 views::Widget* widget_;
41 scoped_ptr<ui::Layer> layer_; 46 scoped_ptr<ui::Layer> layer_;
42 47
43 DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundWidgetController); 48 DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundWidgetController);
44 }; 49 };
45 50
51 // This class wraps a DesktopBackgroundWidgetController pointer. It is installed
52 // as an owned property on the RootWindow. DesktopBackgroundWidgetController is
53 // moved to this property before animation completes. After animation completes,
54 // the kWindowDesktopComponent property on RootWindow is set to the
55 // DesktopBackgroundWidgetController in this class.
56 class ComponentWrapper {
57 public:
58 explicit ComponentWrapper(
59 DesktopBackgroundWidgetController* component);
60 ~ComponentWrapper() {}
61 DesktopBackgroundWidgetController* component() { return component_; }
62
63 private:
64 DesktopBackgroundWidgetController* component_;
65
66 DISALLOW_COPY_AND_ASSIGN(ComponentWrapper);
67 };
68
46 // Window property key, that binds instance of DesktopBackgroundWidgetController 69 // Window property key, that binds instance of DesktopBackgroundWidgetController
47 // to root windows. 70 // to root windows.
48 extern const aura::WindowProperty<DesktopBackgroundWidgetController*>* const 71 extern const aura::WindowProperty<DesktopBackgroundWidgetController*>* const
49 kWindowDesktopComponent; 72 kWindowDesktopComponent;
50 73
74 extern const aura::WindowProperty<ComponentWrapper*>* const kComponentWrapper;
75
51 } // namespace internal 76 } // namespace internal
52 } // namespace ash 77 } // namespace ash
53 78
54 #endif // ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_WIDGET_CONTROLLER_H_ 79 #endif // ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_WIDGET_CONTROLLER_H_
OLDNEW
« no previous file with comments | « ash/desktop_background/desktop_background_view.cc ('k') | ash/desktop_background/desktop_background_widget_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698