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

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

Issue 10919046: Allow panels to be created as detached panels. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Synced 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
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"
(...skipping 10 matching lines...) Expand all
21 class DockedPanelStrip; 21 class DockedPanelStrip;
22 class GURL; 22 class GURL;
23 class PanelDragController; 23 class PanelDragController;
24 class PanelResizeController; 24 class PanelResizeController;
25 class PanelMouseWatcher; 25 class PanelMouseWatcher;
26 26
27 // This class manages a set of panels. 27 // This class manages a set of panels.
28 class PanelManager : public DisplaySettingsProvider::DisplayAreaObserver, 28 class PanelManager : public DisplaySettingsProvider::DisplayAreaObserver,
29 public DisplaySettingsProvider::FullScreenObserver { 29 public DisplaySettingsProvider::FullScreenObserver {
30 public: 30 public:
31 enum CreateMode {
32 CREATE_DOCKED, // Creates a docked panel. The default.
jianli 2012/09/04 21:58:47 Maybe CREATE_AS_DOCKED?
jennb 2012/09/04 23:02:44 Done.
33 CREATE_DETACHED // Creates a detached panel.
34 };
35
31 // Returns a single instance. 36 // Returns a single instance.
32 static PanelManager* GetInstance(); 37 static PanelManager* GetInstance();
33 38
34 // Returns true if panels should be used for the extension. 39 // Returns true if panels should be used for the extension.
35 static bool ShouldUsePanels(const std::string& extension_id); 40 static bool ShouldUsePanels(const std::string& extension_id);
36 41
37 // Returns true if using browserless panels. False if using old panels. 42 // Returns true if using browserless panels. False if using old panels.
38 // TODO(jennb): Delete after refactor. 43 // TODO(jennb): Delete after refactor.
39 static bool UseBrowserlessPanels(); 44 static bool UseBrowserlessPanels();
40 45
46 // Returns the default top-left position for a detached panel.
47 const gfx::Point& GetDefaultDetachedPanelOrigin();
48
41 // Creates a panel and returns it. The panel might be queued for display 49 // Creates a panel and returns it. The panel might be queued for display
42 // later. 50 // later.
43 // |app_name| is the default title for Panels when the page content does not 51 // |app_name| is the default title for Panels when the page content does not
44 // provide a title. For extensions, this is usually the application name 52 // provide a title. For extensions, this is usually the application name
45 // generated from the extension id. 53 // generated from the extension id.
46 // |requested_size| is the desired size for the panel, but actual 54 // |requested_bounds| is the desired bounds for the panel, but actual
47 // size may differ after panel layout. 55 // bounds may differ after panel layout depending on create |mode|.
56 // |mode| indicates whether panel should be created as docked or detached.
48 Panel* CreatePanel(const std::string& app_name, 57 Panel* CreatePanel(const std::string& app_name,
49 Profile* profile, 58 Profile* profile,
50 const GURL& url, 59 const GURL& url,
51 const gfx::Size& requested_size); 60 const gfx::Rect& requested_bounds,
61 CreateMode mode);
52 Panel* CreatePanel(Browser* browser); // legacy 62 Panel* CreatePanel(Browser* browser); // legacy
53 63
54 // Close all panels (asynchronous). Panels will be removed after closing. 64 // Close all panels (asynchronous). Panels will be removed after closing.
55 void CloseAll(); 65 void CloseAll();
56 66
57 // Asynchronous confirmation of panel having been closed. 67 // Asynchronous confirmation of panel having been closed.
58 void OnPanelClosed(Panel* panel); 68 void OnPanelClosed(Panel* panel);
59 69
60 // Returns the maximum size that panel can be auto-resized or resized by the 70 // Returns the maximum size that panel can be auto-resized or resized by the
61 // API. 71 // API.
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 friend struct base::DefaultLazyInstanceTraits<PanelManager>; 176 friend struct base::DefaultLazyInstanceTraits<PanelManager>;
167 177
168 PanelManager(); 178 PanelManager();
169 virtual ~PanelManager(); 179 virtual ~PanelManager();
170 180
171 // Combined CreatePanel() logic until we can delete legacy CreatePanel(). 181 // Combined CreatePanel() logic until we can delete legacy CreatePanel().
172 Panel* CreatePanel(Browser* browser, 182 Panel* CreatePanel(Browser* browser,
173 const std::string& app_name, 183 const std::string& app_name,
174 Profile* profile, 184 Profile* profile,
175 const GURL& url, 185 const GURL& url,
176 const gfx::Size& requested_size); 186 const gfx::Rect& requested_bounds,
187 CreateMode mode);
177 188
178 // Overridden from DisplaySettingsProvider::DisplayAreaObserver: 189 // Overridden from DisplaySettingsProvider::DisplayAreaObserver:
179 virtual void OnDisplayAreaChanged(const gfx::Rect& display_area) OVERRIDE; 190 virtual void OnDisplayAreaChanged(const gfx::Rect& display_area) OVERRIDE;
180 191
181 // Overridden from DisplaySettingsProvider::FullScreenObserver: 192 // Overridden from DisplaySettingsProvider::FullScreenObserver:
182 virtual void OnFullScreenModeChanged(bool is_full_screen) OVERRIDE; 193 virtual void OnFullScreenModeChanged(bool is_full_screen) OVERRIDE;
183 194
184 // Tests may want to use a mock panel mouse watcher. 195 // Tests may want to use a mock panel mouse watcher.
185 void SetMouseWatcher(PanelMouseWatcher* watcher); 196 void SetMouseWatcher(PanelMouseWatcher* watcher);
186 197
(...skipping 17 matching lines...) Expand all
204 215
205 // Whether or not bounds will be updated when the preferred content size is 216 // 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 217 // changed. The testing code could set this flag to false so that other tests
207 // will not be affected. 218 // will not be affected.
208 bool auto_sizing_enabled_; 219 bool auto_sizing_enabled_;
209 220
210 DISALLOW_COPY_AND_ASSIGN(PanelManager); 221 DISALLOW_COPY_AND_ASSIGN(PanelManager);
211 }; 222 };
212 223
213 #endif // CHROME_BROWSER_UI_PANELS_PANEL_MANAGER_H_ 224 #endif // CHROME_BROWSER_UI_PANELS_PANEL_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698