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

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

Issue 10908153: [Panel refactor] Deprecate old panels. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix linux_chromeos test failure Created 8 years, 3 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 | « chrome/browser/ui/panels/panel_host.cc ('k') | chrome/browser/ui/panels/panel_manager.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 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 7
8 #include <vector> 8 #include <vector>
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "chrome/browser/ui/panels/display_settings_provider.h" 12 #include "chrome/browser/ui/panels/display_settings_provider.h"
13 #include "chrome/browser/ui/panels/panel.h" 13 #include "chrome/browser/ui/panels/panel.h"
14 #include "chrome/browser/ui/panels/panel_constants.h" 14 #include "chrome/browser/ui/panels/panel_constants.h"
15 #include "chrome/browser/ui/panels/panel_strip.h" 15 #include "chrome/browser/ui/panels/panel_strip.h"
16 #include "ui/gfx/rect.h" 16 #include "ui/gfx/rect.h"
17 17
18 class Browser;
19 class BrowserWindow;
20 class DetachedPanelStrip; 18 class DetachedPanelStrip;
21 class DockedPanelStrip; 19 class DockedPanelStrip;
22 class GURL; 20 class GURL;
23 class PanelDragController; 21 class PanelDragController;
24 class PanelResizeController; 22 class PanelResizeController;
25 class PanelMouseWatcher; 23 class PanelMouseWatcher;
26 24
27 // This class manages a set of panels. 25 // This class manages a set of panels.
28 class PanelManager : public DisplaySettingsProvider::DisplayAreaObserver, 26 class PanelManager : public DisplaySettingsProvider::DisplayAreaObserver,
29 public DisplaySettingsProvider::FullScreenObserver { 27 public DisplaySettingsProvider::FullScreenObserver {
30 public: 28 public:
31 enum CreateMode { 29 enum CreateMode {
32 CREATE_AS_DOCKED, // Creates a docked panel. The default. 30 CREATE_AS_DOCKED, // Creates a docked panel. The default.
33 CREATE_AS_DETACHED // Creates a detached panel. 31 CREATE_AS_DETACHED // Creates a detached panel.
34 }; 32 };
35 33
36 // Returns a single instance. 34 // Returns a single instance.
37 static PanelManager* GetInstance(); 35 static PanelManager* GetInstance();
38 36
39 // Returns true if panels should be used for the extension. 37 // Returns true if panels should be used for the extension.
40 static bool ShouldUsePanels(const std::string& extension_id); 38 static bool ShouldUsePanels(const std::string& extension_id);
41 39
42 // Returns true if using browserless panels. False if using old panels.
43 // TODO(jennb): Delete after refactor.
44 static bool UseBrowserlessPanels();
45
46 // Returns the default top-left position for a detached panel. 40 // Returns the default top-left position for a detached panel.
47 gfx::Point GetDefaultDetachedPanelOrigin(); 41 gfx::Point GetDefaultDetachedPanelOrigin();
48 42
49 // Creates a panel and returns it. The panel might be queued for display 43 // Creates a panel and returns it. The panel might be queued for display
50 // later. 44 // later.
51 // |app_name| is the default title for Panels when the page content does not 45 // |app_name| is the default title for Panels when the page content does not
52 // provide a title. For extensions, this is usually the application name 46 // provide a title. For extensions, this is usually the application name
53 // generated from the extension id. 47 // generated from the extension id.
54 // |requested_bounds| is the desired bounds for the panel, but actual 48 // |requested_bounds| is the desired bounds for the panel, but actual
55 // bounds may differ after panel layout depending on create |mode|. 49 // bounds may differ after panel layout depending on create |mode|.
56 // |mode| indicates whether panel should be created as docked or detached. 50 // |mode| indicates whether panel should be created as docked or detached.
57 Panel* CreatePanel(const std::string& app_name, 51 Panel* CreatePanel(const std::string& app_name,
58 Profile* profile, 52 Profile* profile,
59 const GURL& url, 53 const GURL& url,
60 const gfx::Rect& requested_bounds, 54 const gfx::Rect& requested_bounds,
61 CreateMode mode); 55 CreateMode mode);
62 Panel* CreatePanel(Browser* browser); // legacy
63 56
64 // Close all panels (asynchronous). Panels will be removed after closing. 57 // Close all panels (asynchronous). Panels will be removed after closing.
65 void CloseAll(); 58 void CloseAll();
66 59
67 // Asynchronous confirmation of panel having been closed. 60 // Asynchronous confirmation of panel having been closed.
68 void OnPanelClosed(Panel* panel); 61 void OnPanelClosed(Panel* panel);
69 62
70 // Returns the maximum size that panel can be auto-resized or resized by the 63 // Returns the maximum size that panel can be auto-resized or resized by the
71 // API. 64 // API.
72 int GetMaxPanelWidth() const; 65 int GetMaxPanelWidth() const;
(...skipping 20 matching lines...) Expand all
93 PanelStrip::Type new_layout, 86 PanelStrip::Type new_layout,
94 PanelStrip::PositioningMask positioning_mask); 87 PanelStrip::PositioningMask positioning_mask);
95 88
96 // Returns true if we should bring up the titlebars, given the current mouse 89 // Returns true if we should bring up the titlebars, given the current mouse
97 // point. 90 // point.
98 bool ShouldBringUpTitlebars(int mouse_x, int mouse_y) const; 91 bool ShouldBringUpTitlebars(int mouse_x, int mouse_y) const;
99 92
100 // Brings up or down the titlebars for all minimized panels. 93 // Brings up or down the titlebars for all minimized panels.
101 void BringUpOrDownTitlebars(bool bring_up); 94 void BringUpOrDownTitlebars(bool bring_up);
102 95
103 // Returns the next browser window which could be either panel window or
104 // tabbed window, to switch to if the given panel is going to be deactivated.
105 // Returns NULL if such window cannot be found.
106 BrowserWindow* GetNextBrowserWindowToActivate(Browser* current_browser) const;
107
108 int num_panels() const; 96 int num_panels() const;
109 std::vector<Panel*> panels() const; 97 std::vector<Panel*> panels() const;
110 98
111 PanelDragController* drag_controller() const { 99 PanelDragController* drag_controller() const {
112 return drag_controller_.get(); 100 return drag_controller_.get();
113 } 101 }
114 102
115 #ifdef UNIT_TEST 103 #ifdef UNIT_TEST
116 PanelResizeController* resize_controller() const { 104 PanelResizeController* resize_controller() const {
117 return resize_controller_.get(); 105 return resize_controller_.get();
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 SetMouseWatcher(watcher); 159 SetMouseWatcher(watcher);
172 } 160 }
173 #endif 161 #endif
174 162
175 private: 163 private:
176 friend struct base::DefaultLazyInstanceTraits<PanelManager>; 164 friend struct base::DefaultLazyInstanceTraits<PanelManager>;
177 165
178 PanelManager(); 166 PanelManager();
179 virtual ~PanelManager(); 167 virtual ~PanelManager();
180 168
181 // Combined CreatePanel() logic until we can delete legacy CreatePanel().
182 Panel* CreatePanel(Browser* browser,
183 const std::string& app_name,
184 Profile* profile,
185 const GURL& url,
186 const gfx::Rect& requested_bounds,
187 CreateMode mode);
188
189 // Overridden from DisplaySettingsProvider::DisplayAreaObserver: 169 // Overridden from DisplaySettingsProvider::DisplayAreaObserver:
190 virtual void OnDisplayAreaChanged(const gfx::Rect& display_area) OVERRIDE; 170 virtual void OnDisplayAreaChanged(const gfx::Rect& display_area) OVERRIDE;
191 171
192 // Overridden from DisplaySettingsProvider::FullScreenObserver: 172 // Overridden from DisplaySettingsProvider::FullScreenObserver:
193 virtual void OnFullScreenModeChanged(bool is_full_screen) OVERRIDE; 173 virtual void OnFullScreenModeChanged(bool is_full_screen) OVERRIDE;
194 174
195 // Tests may want to use a mock panel mouse watcher. 175 // Tests may want to use a mock panel mouse watcher.
196 void SetMouseWatcher(PanelMouseWatcher* watcher); 176 void SetMouseWatcher(PanelMouseWatcher* watcher);
197 177
198 // Tests may want to shorten time intervals to reduce running time. 178 // Tests may want to shorten time intervals to reduce running time.
(...skipping 16 matching lines...) Expand all
215 195
216 // Whether or not bounds will be updated when the preferred content size is 196 // Whether or not bounds will be updated when the preferred content size is
217 // changed. The testing code could set this flag to false so that other tests 197 // changed. The testing code could set this flag to false so that other tests
218 // will not be affected. 198 // will not be affected.
219 bool auto_sizing_enabled_; 199 bool auto_sizing_enabled_;
220 200
221 DISALLOW_COPY_AND_ASSIGN(PanelManager); 201 DISALLOW_COPY_AND_ASSIGN(PanelManager);
222 }; 202 };
223 203
224 #endif // CHROME_BROWSER_UI_PANELS_PANEL_MANAGER_H_ 204 #endif // CHROME_BROWSER_UI_PANELS_PANEL_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/panel_host.cc ('k') | chrome/browser/ui/panels/panel_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698