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

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: Use event targeter to block keyboard and mouse events. 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
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 // The width and heigh of wallpaper thumbnails. 63 // The width and heigh of wallpaper thumbnails.
63 ASH_EXPORT extern const int kWallpaperThumbnailWidth; 64 ASH_EXPORT extern const int kWallpaperThumbnailWidth;
64 ASH_EXPORT extern const int kWallpaperThumbnailHeight; 65 ASH_EXPORT extern const int kWallpaperThumbnailHeight;
65 66
66 class DesktopBackgroundControllerObserver; 67 class DesktopBackgroundControllerObserver;
67 class WallpaperResizer; 68 class WallpaperResizer;
68 69
69 // Loads selected desktop wallpaper from file system asynchronously and updates 70 // Loads selected desktop wallpaper from file system asynchronously and updates
70 // background layer if loaded successfully. 71 // background layer if loaded successfully.
71 class ASH_EXPORT DesktopBackgroundController 72 class ASH_EXPORT DesktopBackgroundController
72 : public DisplayController::Observer { 73 : public DisplayController::Observer,
74 public ShellObserver {
73 public: 75 public:
74 enum BackgroundMode { 76 enum BackgroundMode {
75 BACKGROUND_NONE, 77 BACKGROUND_NONE,
76 BACKGROUND_IMAGE, 78 BACKGROUND_IMAGE,
77 }; 79 };
78 80
79 DesktopBackgroundController(); 81 DesktopBackgroundController();
80 virtual ~DesktopBackgroundController(); 82 virtual ~DesktopBackgroundController();
81 83
82 BackgroundMode desktop_background_mode() const { 84 BackgroundMode desktop_background_mode() const {
83 return desktop_background_mode_; 85 return desktop_background_mode_;
84 } 86 }
85 87
86 void set_command_line_for_testing(base::CommandLine* command_line) { 88 void set_command_line_for_testing(base::CommandLine* command_line) {
87 command_line_for_testing_ = command_line; 89 command_line_for_testing_ = command_line;
88 } 90 }
89 91
90 // Add/Remove observers. 92 // Add/Remove observers.
91 void AddObserver(DesktopBackgroundControllerObserver* observer); 93 void AddObserver(DesktopBackgroundControllerObserver* observer);
92 void RemoveObserver(DesktopBackgroundControllerObserver* observer); 94 void RemoveObserver(DesktopBackgroundControllerObserver* observer);
93 95
94 // Provides current image on the background, or empty gfx::ImageSkia if there 96 // Provides current image on the background, or empty gfx::ImageSkia if there
95 // is no image, e.g. background is none. 97 // is no image, e.g. background is none.
96 gfx::ImageSkia GetWallpaper() const; 98 gfx::ImageSkia GetWallpaper() const;
97 99
98 WallpaperLayout GetWallpaperLayout() const; 100 WallpaperLayout GetWallpaperLayout() const;
99 101
100 // Initialize root window's background.
101 void OnRootWindowAdded(aura::Window* root_window);
102
103 // Loads builtin wallpaper asynchronously and sets to current wallpaper 102 // Loads builtin wallpaper asynchronously and sets to current wallpaper
104 // after loaded. Returns true if the controller started loading the 103 // after loaded. Returns true if the controller started loading the
105 // wallpaper and false otherwise (i.e. the appropriate wallpaper was 104 // wallpaper and false otherwise (i.e. the appropriate wallpaper was
106 // already loading or loaded). 105 // already loading or loaded).
107 bool SetDefaultWallpaper(bool is_guest); 106 bool SetDefaultWallpaper(bool is_guest);
108 107
109 // Sets the user selected custom wallpaper. Called when user selected a file 108 // Sets the user selected custom wallpaper. Called when user selected a file
110 // from file system or changed the layout of wallpaper. 109 // from file system or changed the layout of wallpaper.
111 void SetCustomWallpaper(const gfx::ImageSkia& image, WallpaperLayout layout); 110 void SetCustomWallpaper(const gfx::ImageSkia& image, WallpaperLayout layout);
112 111
(...skipping 12 matching lines...) Expand all
125 WallpaperResolution GetAppropriateResolution(); 124 WallpaperResolution GetAppropriateResolution();
126 125
127 // Move all desktop widgets to locked container. 126 // Move all desktop widgets to locked container.
128 // Returns true if the desktop moved. 127 // Returns true if the desktop moved.
129 bool MoveDesktopToLockedContainer(); 128 bool MoveDesktopToLockedContainer();
130 129
131 // Move all desktop widgets to unlocked container. 130 // Move all desktop widgets to unlocked container.
132 // Returns true if the desktop moved. 131 // Returns true if the desktop moved.
133 bool MoveDesktopToUnlockedContainer(); 132 bool MoveDesktopToUnlockedContainer();
134 133
135 // Overrides DisplayController::Observer: 134 // DisplayController::Observer:
136 virtual void OnDisplayConfigurationChanged() OVERRIDE; 135 virtual void OnDisplayConfigurationChanged() OVERRIDE;
137 136
137 // ShellObserver:
138 virtual void OnRootWindowAdded(aura::Window* root_window) OVERRIDE;
139
138 private: 140 private:
139 friend class DesktopBackgroundControllerTest; 141 friend class DesktopBackgroundControllerTest;
140 FRIEND_TEST_ALL_PREFIXES(DesktopBackgroundControllerTest, GetMaxDisplaySize); 142 FRIEND_TEST_ALL_PREFIXES(DesktopBackgroundControllerTest, GetMaxDisplaySize);
141 143
142 // An operation to asynchronously loads wallpaper. 144 // An operation to asynchronously loads wallpaper.
143 class WallpaperLoader; 145 class WallpaperLoader;
144 146
145 // Returns true if the specified default wallpaper is already being 147 // Returns true if the specified default wallpaper is already being
146 // loaded by |wallpaper_loader_| or stored in |current_wallpaper_|. 148 // loaded by |wallpaper_loader_| or stored in |current_wallpaper_|.
147 bool DefaultWallpaperIsAlreadyLoadingOrLoaded( 149 bool DefaultWallpaperIsAlreadyLoadingOrLoaded(
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 base::OneShotTimer<DesktopBackgroundController> timer_; 223 base::OneShotTimer<DesktopBackgroundController> timer_;
222 224
223 int wallpaper_reload_delay_; 225 int wallpaper_reload_delay_;
224 226
225 DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundController); 227 DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundController);
226 }; 228 };
227 229
228 } // namespace ash 230 } // namespace ash
229 231
230 #endif // ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_ 232 #endif // ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698