Index: chrome/browser/ui/panels/panel.h |
=================================================================== |
--- chrome/browser/ui/panels/panel.h (revision 94932) |
+++ chrome/browser/ui/panels/panel.h (working copy) |
@@ -9,6 +9,8 @@ |
#include "chrome/browser/ui/browser_window.h" |
#include "base/memory/scoped_ptr.h" |
+#include "content/common/notification_observer.h" |
+#include "content/common/notification_registrar.h" |
#include "ui/gfx/rect.h" |
class NativePanel; |
@@ -24,7 +26,7 @@ |
// Panel size is restricted to certain limits. |
// - Invoke an appropriate PanelManager function to do stuff that might affect |
// other Panels. For example deleting a panel would rearrange other panels. |
-class Panel : public BrowserWindow { |
+class Panel : public BrowserWindow, public NotificationObserver { |
public: |
enum ExpansionState { |
// The panel is fully expanded with both title-bar and the client-area. |
@@ -46,6 +48,10 @@ |
bool IsDrawingAttention() const; |
+ // Returns the size of the non-client area, that is, the window size minus |
+ // the size of the client area. |
+ gfx::Size GetNonClientAreaSize() const; |
+ |
// BrowserWindow overrides. |
virtual void Show() OVERRIDE; |
virtual void ShowInactive() OVERRIDE; |
@@ -141,7 +147,13 @@ |
#if defined(OS_CHROMEOS) |
virtual void ShowKeyboardOverlay(gfx::NativeWindow owning_window) OVERRIDE; |
#endif |
+ virtual void UpdatePreferredSize(const gfx::Size& pref_size) OVERRIDE; |
+ // NotificationObserver overrides. |
+ virtual void Observe(int type, |
+ const NotificationSource& source, |
+ const NotificationDetails& details) OVERRIDE; |
+ |
// Construct a native panel BrowserWindow implementation for the specified |
// |browser|. |
static NativePanel* CreateNativePanel(Browser* browser, |
@@ -168,18 +180,37 @@ |
// Panel can only be created using PanelManager::CreatePanel(). |
Panel(Browser* browser, const gfx::Rect& bounds); |
+ // Called from PanelManager to update the bounds that should be used when the |
+ // panel is expanded. |
+ void SetRestoredBounds(const gfx::Rect& bounds); |
+ |
// This is different from BrowserWindow::SetBounds(): |
// * SetPanelBounds() is only called by PanelManager to manage its position. |
// * SetBounds() is called by the API to try to change the bounds, which is |
// not allowed for Panel. |
void SetPanelBounds(const gfx::Rect& bounds); |
+ // Updates the maximum size. |
+ void SetMaximumSize(const gfx::Size& max_size); |
+ |
+ // The initial size. The panel cannot shrink to be smaller than that. |
Dmitry Titov
2011/08/05 19:02:20
As discussed, lets rename all these into "minimum_
jianli
2011/08/09 19:56:16
Done.
|
+ // Used by PanelManager in updating the panel bounds as responding to the |
+ // dynamic content update. |
+ gfx::Size initial_size_; |
+ |
+ // The maximum size that the panel can grow to. Note that the maximum width is |
+ // affected by the available horizontal space when panels are added, removed, |
Dmitry Titov
2011/08/05 19:02:20
Lets add comment about how this size is used - to
jianli
2011/08/09 19:56:16
Done.
|
+ // or size changed. |
+ gfx::Size max_size_; |
+ |
// Platform specifc implementation for panels. It'd be one of |
// PanelBrowserWindowGtk/PanelBrowserView/PanelBrowserWindowCocoa. |
NativePanel* native_panel_; // Weak, owns us. |
ExpansionState expansion_state_; |
+ NotificationRegistrar registrar_; |
+ |
DISALLOW_COPY_AND_ASSIGN(Panel); |
}; |