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

Side by Side Diff: chrome/browser/ui/panels/panel_manager.h

Issue 10051020: Move full-screen detection logic from PanelManager to DisplaySettingsProvider. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix linux asan Created 8 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 CHROME_BROWSER_UI_PANELS_PANEL_MANAGER_H_ 5 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_MANAGER_H_
6 #define CHROME_BROWSER_UI_PANELS_PANEL_MANAGER_H_ 6 #define CHROME_BROWSER_UI_PANELS_PANEL_MANAGER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <vector> 9 #include <vector>
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/lazy_instance.h" 11 #include "base/lazy_instance.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/timer.h"
14 #include "chrome/browser/ui/panels/display_settings_provider.h" 13 #include "chrome/browser/ui/panels/display_settings_provider.h"
15 #include "chrome/browser/ui/panels/panel.h" 14 #include "chrome/browser/ui/panels/panel.h"
16 #include "chrome/browser/ui/panels/panel_constants.h" 15 #include "chrome/browser/ui/panels/panel_constants.h"
17 #include "chrome/browser/ui/panels/panel_strip.h" 16 #include "chrome/browser/ui/panels/panel_strip.h"
18 #include "ui/gfx/rect.h" 17 #include "ui/gfx/rect.h"
19 18
20 class Browser; 19 class Browser;
21 class DetachedPanelStrip; 20 class DetachedPanelStrip;
22 class DockedPanelStrip; 21 class DockedPanelStrip;
23 class OverflowPanelStrip; 22 class OverflowPanelStrip;
24 class PanelDragController; 23 class PanelDragController;
25 class PanelResizeController; 24 class PanelResizeController;
26 class PanelMouseWatcher; 25 class PanelMouseWatcher;
27 26
28 // This class manages a set of panels. 27 // This class manages a set of panels.
29 class PanelManager : public DisplaySettingsProvider::DisplayAreaObserver { 28 class PanelManager : public DisplaySettingsProvider::DisplayAreaObserver,
29 public DisplaySettingsProvider::FullScreenObserver {
30 public: 30 public:
31 // Returns a single instance. 31 // Returns a single instance.
32 static PanelManager* GetInstance(); 32 static PanelManager* GetInstance();
33 33
34 // Returns true if panels should be used for the extension. 34 // Returns true if panels should be used for the extension.
35 static bool ShouldUsePanels(const std::string& extension_id); 35 static bool ShouldUsePanels(const std::string& extension_id);
36 36
37 // Creates a panel and returns it. The panel might be queued for display 37 // Creates a panel and returns it. The panel might be queued for display
38 // later. 38 // later.
39 Panel* CreatePanel(Browser* browser); 39 Panel* CreatePanel(Browser* browser);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 } 117 }
118 118
119 DetachedPanelStrip* detached_strip() const { 119 DetachedPanelStrip* detached_strip() const {
120 return detached_strip_.get(); 120 return detached_strip_.get();
121 } 121 }
122 122
123 DockedPanelStrip* docked_strip() const { 123 DockedPanelStrip* docked_strip() const {
124 return docked_strip_.get(); 124 return docked_strip_.get();
125 } 125 }
126 126
127 bool is_full_screen() const { return is_full_screen_; }
128 OverflowPanelStrip* overflow_strip() const { 127 OverflowPanelStrip* overflow_strip() const {
129 return overflow_strip_.get(); 128 return overflow_strip_.get();
130 } 129 }
131 130
132 // Width of the overflow strip in compact state i.e mouse not hovering over. 131 // Width of the overflow strip in compact state i.e mouse not hovering over.
133 int overflow_strip_width() const; 132 int overflow_strip_width() const;
134 133
135 // Reduces time interval in tests to shorten test run time. 134 // Reduces time interval in tests to shorten test run time.
136 // Wrapper should be used around all time intervals in panels code. 135 // Wrapper should be used around all time intervals in panels code.
137 static inline double AdjustTimeInterval(double interval) { 136 static inline double AdjustTimeInterval(double interval) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 171
173 private: 172 private:
174 friend struct base::DefaultLazyInstanceTraits<PanelManager>; 173 friend struct base::DefaultLazyInstanceTraits<PanelManager>;
175 174
176 PanelManager(); 175 PanelManager();
177 virtual ~PanelManager(); 176 virtual ~PanelManager();
178 177
179 // Overridden from DisplaySettingsProvider::DisplayAreaObserver: 178 // Overridden from DisplaySettingsProvider::DisplayAreaObserver:
180 virtual void OnDisplayAreaChanged(const gfx::Rect& display_area) OVERRIDE; 179 virtual void OnDisplayAreaChanged(const gfx::Rect& display_area) OVERRIDE;
181 180
182 // Tests if the current active app is in full screen mode. 181 // Overridden from DisplaySettingsProvider::FullScreenObserver:
183 void CheckFullScreenMode(); 182 virtual void OnFullScreenModeChanged(bool is_full_screen) OVERRIDE;
184 183
185 // Tests may want to use a mock panel mouse watcher. 184 // Tests may want to use a mock panel mouse watcher.
186 void SetMouseWatcher(PanelMouseWatcher* watcher); 185 void SetMouseWatcher(PanelMouseWatcher* watcher);
187 186
188 // Tests may want to shorten time intervals to reduce running time. 187 // Tests may want to shorten time intervals to reduce running time.
189 static bool shorten_time_intervals_; 188 static bool shorten_time_intervals_;
190 189
191 scoped_ptr<DetachedPanelStrip> detached_strip_; 190 scoped_ptr<DetachedPanelStrip> detached_strip_;
192 scoped_ptr<DockedPanelStrip> docked_strip_; 191 scoped_ptr<DockedPanelStrip> docked_strip_;
193 scoped_ptr<OverflowPanelStrip> overflow_strip_; 192 scoped_ptr<OverflowPanelStrip> overflow_strip_;
194 193
195 scoped_ptr<PanelDragController> drag_controller_; 194 scoped_ptr<PanelDragController> drag_controller_;
196 scoped_ptr<PanelResizeController> resize_controller_; 195 scoped_ptr<PanelResizeController> resize_controller_;
197 196
198 // Use a mouse watcher to know when to bring up titlebars to "peek" at 197 // Use a mouse watcher to know when to bring up titlebars to "peek" at
199 // minimized panels. Mouse movement is only tracked when there is a minimized 198 // minimized panels. Mouse movement is only tracked when there is a minimized
200 // panel. 199 // panel.
201 scoped_ptr<PanelMouseWatcher> panel_mouse_watcher_; 200 scoped_ptr<PanelMouseWatcher> panel_mouse_watcher_;
202 201
203 scoped_ptr<DisplaySettingsProvider> display_settings_provider_; 202 scoped_ptr<DisplaySettingsProvider> display_settings_provider_;
204 203
205 // Whether or not bounds will be updated when the preferred content size is 204 // Whether or not bounds will be updated when the preferred content size is
206 // changed. The testing code could set this flag to false so that other tests 205 // changed. The testing code could set this flag to false so that other tests
207 // will not be affected. 206 // will not be affected.
208 bool auto_sizing_enabled_; 207 bool auto_sizing_enabled_;
209 208
210 // Timer used to track if the current active app is in full screen mode.
211 base::RepeatingTimer<PanelManager> full_screen_mode_timer_;
212
213 // True if current active app is in full screen mode.
214 bool is_full_screen_;
215
216 // True only while moving panels to overflow. Used to prevent moving panels 209 // True only while moving panels to overflow. Used to prevent moving panels
217 // out of overflow while in the process of moving panels to overflow. 210 // out of overflow while in the process of moving panels to overflow.
218 bool is_processing_overflow_; 211 bool is_processing_overflow_;
219 212
220 DISALLOW_COPY_AND_ASSIGN(PanelManager); 213 DISALLOW_COPY_AND_ASSIGN(PanelManager);
221 }; 214 };
222 215
223 #endif // CHROME_BROWSER_UI_PANELS_PANEL_MANAGER_H_ 216 #endif // CHROME_BROWSER_UI_PANELS_PANEL_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/panel_browser_view.cc ('k') | chrome/browser/ui/panels/panel_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698