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

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

Issue 230613004: Block keyboard and mouse input when maximize mode is activated by accelerometer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with master. Created 6 years, 8 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
« no previous file with comments | « ash/ash.gyp ('k') | ash/desktop_background/desktop_background_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/display/display_controller.h" 9 #include "ash/display/display_controller.h"
10 #include "ash/shell_observer.h"
10 #include "base/basictypes.h" 11 #include "base/basictypes.h"
11 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
12 #include "base/gtest_prod_util.h" 13 #include "base/gtest_prod_util.h"
13 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
15 #include "base/observer_list.h" 16 #include "base/observer_list.h"
16 #include "base/timer/timer.h" 17 #include "base/timer/timer.h"
17 #include "ui/compositor/layer.h" 18 #include "ui/compositor/layer.h"
18 #include "ui/gfx/image/image_skia.h" 19 #include "ui/gfx/image/image_skia.h"
19 20
(...skipping 19 matching lines...) Expand all
39 WALLPAPER_LAYOUT_TILE, 40 WALLPAPER_LAYOUT_TILE,
40 }; 41 };
41 42
42 const SkColor kLoginWallpaperColor = 0xFEFEFE; 43 const SkColor kLoginWallpaperColor = 0xFEFEFE;
43 44
44 class DesktopBackgroundControllerObserver; 45 class DesktopBackgroundControllerObserver;
45 class WallpaperResizer; 46 class WallpaperResizer;
46 47
47 // Updates background layer if necessary. 48 // Updates background layer if necessary.
48 class ASH_EXPORT DesktopBackgroundController 49 class ASH_EXPORT DesktopBackgroundController
49 : public DisplayController::Observer { 50 : public DisplayController::Observer,
51 public ShellObserver {
50 public: 52 public:
51 class TestAPI; 53 class TestAPI;
52 54
53 enum BackgroundMode { 55 enum BackgroundMode {
54 BACKGROUND_NONE, 56 BACKGROUND_NONE,
55 BACKGROUND_IMAGE, 57 BACKGROUND_IMAGE,
56 }; 58 };
57 59
58 DesktopBackgroundController(); 60 DesktopBackgroundController();
59 virtual ~DesktopBackgroundController(); 61 virtual ~DesktopBackgroundController();
60 62
61 BackgroundMode desktop_background_mode() const { 63 BackgroundMode desktop_background_mode() const {
62 return desktop_background_mode_; 64 return desktop_background_mode_;
63 } 65 }
64 66
65 // Add/Remove observers. 67 // Add/Remove observers.
66 void AddObserver(DesktopBackgroundControllerObserver* observer); 68 void AddObserver(DesktopBackgroundControllerObserver* observer);
67 void RemoveObserver(DesktopBackgroundControllerObserver* observer); 69 void RemoveObserver(DesktopBackgroundControllerObserver* observer);
68 70
69 // Provides current image on the background, or empty gfx::ImageSkia if there 71 // Provides current image on the background, or empty gfx::ImageSkia if there
70 // is no image, e.g. background is none. 72 // is no image, e.g. background is none.
71 gfx::ImageSkia GetWallpaper() const; 73 gfx::ImageSkia GetWallpaper() const;
72 74
73 WallpaperLayout GetWallpaperLayout() const; 75 WallpaperLayout GetWallpaperLayout() const;
74 76
75 // Initialize root window's background.
76 void OnRootWindowAdded(aura::Window* root_window);
77
78 // Sets wallpaper. This is mostly called by WallpaperManager to set 77 // Sets wallpaper. This is mostly called by WallpaperManager to set
79 // the default or user selected custom wallpaper. 78 // the default or user selected custom wallpaper.
80 // Returns true if new image was actually set. And false when duplicate set 79 // Returns true if new image was actually set. And false when duplicate set
81 // request detected. 80 // request detected.
82 bool SetWallpaperImage(const gfx::ImageSkia& image, WallpaperLayout layout); 81 bool SetWallpaperImage(const gfx::ImageSkia& image, WallpaperLayout layout);
83 // The same, but image from resources is used. 82 // The same, but image from resources is used.
84 bool SetWallpaperResource(int resource_id, WallpaperLayout layout); 83 bool SetWallpaperResource(int resource_id, WallpaperLayout layout);
85 84
86 // Creates an empty wallpaper. Some tests require a wallpaper widget is ready 85 // Creates an empty wallpaper. Some tests require a wallpaper widget is ready
87 // when running. However, the wallpaper widgets are now created 86 // when running. However, the wallpaper widgets are now created
88 // asynchronously. If loading a real wallpaper, there are cases that these 87 // asynchronously. If loading a real wallpaper, there are cases that these
89 // tests crash because the required widget is not ready. This function 88 // tests crash because the required widget is not ready. This function
90 // synchronously creates an empty widget for those tests to prevent 89 // synchronously creates an empty widget for those tests to prevent
91 // crashes. An example test is SystemGestureEventFilterTest.ThreeFingerSwipe. 90 // crashes. An example test is SystemGestureEventFilterTest.ThreeFingerSwipe.
92 void CreateEmptyWallpaper(); 91 void CreateEmptyWallpaper();
93 92
94 // Move all desktop widgets to locked container. 93 // Move all desktop widgets to locked container.
95 // Returns true if the desktop moved. 94 // Returns true if the desktop moved.
96 bool MoveDesktopToLockedContainer(); 95 bool MoveDesktopToLockedContainer();
97 96
98 // Move all desktop widgets to unlocked container. 97 // Move all desktop widgets to unlocked container.
99 // Returns true if the desktop moved. 98 // Returns true if the desktop moved.
100 bool MoveDesktopToUnlockedContainer(); 99 bool MoveDesktopToUnlockedContainer();
101 100
102 // Overrides DisplayController::Observer: 101 // DisplayController::Observer:
103 virtual void OnDisplayConfigurationChanged() OVERRIDE; 102 virtual void OnDisplayConfigurationChanged() OVERRIDE;
104 103
104 // ShellObserver:
105 virtual void OnRootWindowAdded(aura::Window* root_window) OVERRIDE;
106
105 // Returns the maximum size of all displays combined in native 107 // Returns the maximum size of all displays combined in native
106 // resolutions. Note that this isn't the bounds of the display who 108 // resolutions. Note that this isn't the bounds of the display who
107 // has maximum resolutions. Instead, this returns the size of the 109 // has maximum resolutions. Instead, this returns the size of the
108 // maximum width of all displays, and the maximum height of all displays. 110 // maximum width of all displays, and the maximum height of all displays.
109 static gfx::Size GetMaxDisplaySizeInNative(); 111 static gfx::Size GetMaxDisplaySizeInNative();
110 112
111 private: 113 private:
112 friend class DesktopBackgroundControllerTest; 114 friend class DesktopBackgroundControllerTest;
113 // friend class chromeos::WallpaperManagerBrowserTestDefaultWallpaper; 115 // friend class chromeos::WallpaperManagerBrowserTestDefaultWallpaper;
114 FRIEND_TEST_ALL_PREFIXES(DesktopBackgroundControllerTest, GetMaxDisplaySize); 116 FRIEND_TEST_ALL_PREFIXES(DesktopBackgroundControllerTest, GetMaxDisplaySize);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 base::OneShotTimer<DesktopBackgroundController> timer_; 168 base::OneShotTimer<DesktopBackgroundController> timer_;
167 169
168 int wallpaper_reload_delay_; 170 int wallpaper_reload_delay_;
169 171
170 DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundController); 172 DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundController);
171 }; 173 };
172 174
173 } // namespace ash 175 } // namespace ash
174 176
175 #endif // ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_ 177 #endif // ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_
OLDNEW
« no previous file with comments | « ash/ash.gyp ('k') | ash/desktop_background/desktop_background_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698