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

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

Issue 10810039: 2nd display should show the same background as login/lock screen: (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Post-review fix #2 Created 8 years, 5 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_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_ 5 #ifndef ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_
6 #define ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_ 6 #define ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_
7 7
8 #include "ash/ash_export.h" 8 #include "ash/ash_export.h"
9 #include "ash/desktop_background/desktop_background_resources.h" 9 #include "ash/desktop_background/desktop_background_resources.h"
10 #include "ash/wm/window_animations.h" 10 #include "ash/wm/window_animations.h"
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "third_party/skia/include/core/SkBitmap.h" 14 #include "third_party/skia/include/core/SkBitmap.h"
15 #include "third_party/skia/include/core/SkColor.h" 15 #include "third_party/skia/include/core/SkColor.h"
16 #include "ui/compositor/layer.h"
16 #include "ui/gfx/image/image_skia.h" 17 #include "ui/gfx/image/image_skia.h"
17 18
18 namespace aura { 19 namespace aura {
19 class RootWindow; 20 class RootWindow;
20 } 21 }
21 22
22 namespace ash { 23 namespace ash {
23 24
24 class UserWallpaperDelegate { 25 class UserWallpaperDelegate {
25 public: 26 public:
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 void SetDesktopBackgroundSolidColorMode(SkColor color); 88 void SetDesktopBackgroundSolidColorMode(SkColor color);
88 89
89 // Creates an empty wallpaper. Some tests require a wallpaper widget is ready 90 // Creates an empty wallpaper. Some tests require a wallpaper widget is ready
90 // when running. However, the wallpaper widgets are now created asynchronously 91 // when running. However, the wallpaper widgets are now created asynchronously
91 // . If loading a real wallpaper, there are cases that these tests crash 92 // . If loading a real wallpaper, there are cases that these tests crash
92 // because the required widget is not ready. This function synchronously 93 // because the required widget is not ready. This function synchronously
93 // creates an empty widget for those tests to prevent crashes. An example test 94 // creates an empty widget for those tests to prevent crashes. An example test
94 // is SystemGestureEventFilterTest.ThreeFingerSwipe. 95 // is SystemGestureEventFilterTest.ThreeFingerSwipe.
95 void CreateEmptyWallpaper(); 96 void CreateEmptyWallpaper();
96 97
98 // Move all desktop widgets to locked container.
99 void MoveDesktopToLockedContainer();
100
101 // Move all desktop widgets to unlocked container.
102 void MoveDesktopToUnlockedContainer();
103
97 private: 104 private:
98 // An operation to asynchronously loads wallpaper. 105 // An operation to asynchronously loads wallpaper.
99 class WallpaperOperation; 106 class WallpaperOperation;
100 107
101 struct WallpaperData; 108 struct WallpaperData;
102 109
103 // Creates a new background widget using the current wallpapaer image and 110 // Creates view for all root windows, or notifies them to repaint if they
104 // use it as a background of the |root_window|. Deletes the old widget if any. 111 // already exist.
105 void SetDesktopBackgroundImage(aura::RootWindow* root_window); 112 void SetDesktopBackgroundImageMode();
106
107 // Update the background of all root windows using the current wallpaper image
108 // in |current_wallpaper_|.
109 void UpdateDesktopBackgroundImageMode();
110 113
111 // Creates a new background widget and sets the background mode to image mode. 114 // Creates a new background widget and sets the background mode to image mode.
112 // Called after wallpaper loaded successfully. 115 // Called after wallpaper loaded successfully.
113 void OnWallpaperLoadCompleted(scoped_refptr<WallpaperOperation> wo); 116 void OnWallpaperLoadCompleted(scoped_refptr<WallpaperOperation> wo);
114 117
118 // Add layer with solid |color| to container |container_id| in |root_window|
119 ui::Layer* SetColorLayerForContainer(SkColor color,
120 aura::RootWindow* root_window,
121 int container_id);
122
123 // Creates and adds component for current mode (either Widget or Layer) to
124 // |root_window|.
125 void InstallComponent(aura::RootWindow* root_window);
126
127 // Creates and adds component for current mode (either Widget or Layer) to
128 // all root windows.
129 void InstallComponentForAllWindows();
130
131 // Moves all descktop components from one container to other across all root
132 // windows.
133 void ReparentBackgroundWidgets(int src_container, int dst_container);
134
135 // Returns id for background container for unlocked and locked states.
136 int GetBackgroundContainerId(bool locked);
137
115 // Can change at runtime. 138 // Can change at runtime.
139 bool locked_;
140
116 BackgroundMode desktop_background_mode_; 141 BackgroundMode desktop_background_mode_;
117 142
118 SkColor background_color_; 143 SkColor background_color_;
119 144
120 // The current wallpaper. 145 // The current wallpaper.
121 scoped_ptr<WallpaperData> current_wallpaper_; 146 scoped_ptr<WallpaperData> current_wallpaper_;
122 147
123 scoped_refptr<WallpaperOperation> wallpaper_op_; 148 scoped_refptr<WallpaperOperation> wallpaper_op_;
124 149
125 base::WeakPtrFactory<DesktopBackgroundController> weak_ptr_factory_; 150 base::WeakPtrFactory<DesktopBackgroundController> weak_ptr_factory_;
126 151
127 DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundController); 152 DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundController);
128 }; 153 };
129 154
130 } // namespace ash 155 } // namespace ash
131 156
132 #endif // ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_ 157 #endif // ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698