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

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: 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 29 matching lines...) Expand all
167 166
168 private: 167 private:
169 friend struct base::DefaultLazyInstanceTraits<PanelManager>; 168 friend struct base::DefaultLazyInstanceTraits<PanelManager>;
170 169
171 PanelManager(); 170 PanelManager();
172 virtual ~PanelManager(); 171 virtual ~PanelManager();
173 172
174 // Overridden from DisplaySettingsProvider::DisplayAreaObserver: 173 // Overridden from DisplaySettingsProvider::DisplayAreaObserver:
175 virtual void OnDisplayAreaChanged(const gfx::Rect& display_area) OVERRIDE; 174 virtual void OnDisplayAreaChanged(const gfx::Rect& display_area) OVERRIDE;
176 175
177 // Tests if the current active app is in full screen mode. 176 // Overridden from DisplaySettingsProvider::FullScreenObserver:
178 void CheckFullScreenMode(); 177 virtual void OnFullScreenModeChanged(bool is_full_screen) OVERRIDE;
179 178
180 // Tests may want to use a mock panel mouse watcher. 179 // Tests may want to use a mock panel mouse watcher.
181 void SetMouseWatcher(PanelMouseWatcher* watcher); 180 void SetMouseWatcher(PanelMouseWatcher* watcher);
182 181
183 // Tests may want to shorten time intervals to reduce running time. 182 // Tests may want to shorten time intervals to reduce running time.
184 static bool shorten_time_intervals_; 183 static bool shorten_time_intervals_;
185 184
186 scoped_ptr<DetachedPanelStrip> detached_strip_; 185 scoped_ptr<DetachedPanelStrip> detached_strip_;
187 scoped_ptr<DockedPanelStrip> docked_strip_; 186 scoped_ptr<DockedPanelStrip> docked_strip_;
188 scoped_ptr<OverflowPanelStrip> overflow_strip_; 187 scoped_ptr<OverflowPanelStrip> overflow_strip_;
189 188
190 scoped_ptr<PanelDragController> drag_controller_; 189 scoped_ptr<PanelDragController> drag_controller_;
191 scoped_ptr<PanelResizeController> resize_controller_; 190 scoped_ptr<PanelResizeController> resize_controller_;
192 191
193 // Use a mouse watcher to know when to bring up titlebars to "peek" at 192 // Use a mouse watcher to know when to bring up titlebars to "peek" at
194 // minimized panels. Mouse movement is only tracked when there is a minimized 193 // minimized panels. Mouse movement is only tracked when there is a minimized
195 // panel. 194 // panel.
196 scoped_ptr<PanelMouseWatcher> panel_mouse_watcher_; 195 scoped_ptr<PanelMouseWatcher> panel_mouse_watcher_;
197 196
198 scoped_ptr<DisplaySettingsProvider> display_settings_provider_; 197 scoped_ptr<DisplaySettingsProvider> display_settings_provider_;
199 198
200 // Whether or not bounds will be updated when the preferred content size is 199 // Whether or not bounds will be updated when the preferred content size is
201 // changed. The testing code could set this flag to false so that other tests 200 // changed. The testing code could set this flag to false so that other tests
202 // will not be affected. 201 // will not be affected.
203 bool auto_sizing_enabled_; 202 bool auto_sizing_enabled_;
204 203
205 // Timer used to track if the current active app is in full screen mode.
206 base::RepeatingTimer<PanelManager> full_screen_mode_timer_;
207
208 // True if current active app is in full screen mode.
209 bool is_full_screen_;
210
211 // True only while moving panels to overflow. Used to prevent moving panels 204 // True only while moving panels to overflow. Used to prevent moving panels
212 // out of overflow while in the process of moving panels to overflow. 205 // out of overflow while in the process of moving panels to overflow.
213 bool is_processing_overflow_; 206 bool is_processing_overflow_;
214 207
215 DISALLOW_COPY_AND_ASSIGN(PanelManager); 208 DISALLOW_COPY_AND_ASSIGN(PanelManager);
216 }; 209 };
217 210
218 #endif // CHROME_BROWSER_UI_PANELS_PANEL_MANAGER_H_ 211 #endif // CHROME_BROWSER_UI_PANELS_PANEL_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698