| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_H_ | 5 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_H_ |
| 6 #define CHROME_BROWSER_UI_PANELS_PANEL_H_ | 6 #define CHROME_BROWSER_UI_PANELS_PANEL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "chrome/browser/ui/browser_window.h" | 9 #include "chrome/browser/ui/browser_window.h" |
| 10 | 10 |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 NativePanel* native_panel() { return native_panel_; } | 200 NativePanel* native_panel() { return native_panel_; } |
| 201 Browser* browser() const { return browser_; } | 201 Browser* browser() const { return browser_; } |
| 202 ExpansionState expansion_state() const { return expansion_state_; } | 202 ExpansionState expansion_state() const { return expansion_state_; } |
| 203 const gfx::Size& min_size() const { return min_size_; } | 203 const gfx::Size& min_size() const { return min_size_; } |
| 204 const gfx::Size& max_size() const { return max_size_; } | 204 const gfx::Size& max_size() const { return max_size_; } |
| 205 bool auto_resizable() const { return auto_resizable_; } | 205 bool auto_resizable() const { return auto_resizable_; } |
| 206 // The restored size is the size of the panel when it is expanded. | 206 // The restored size is the size of the panel when it is expanded. |
| 207 gfx::Size restored_size() const { return restored_size_; } | 207 gfx::Size restored_size() const { return restored_size_; } |
| 208 void set_restored_size(const gfx::Size& size) { restored_size_ = size; } | 208 void set_restored_size(const gfx::Size& size) { restored_size_ = size; } |
| 209 | 209 |
| 210 protected: | |
| 211 virtual void DestroyBrowser() OVERRIDE; | |
| 212 | |
| 213 private: | |
| 214 friend class PanelManager; | |
| 215 friend class PanelBrowserTest; | |
| 216 FRIEND_TEST_ALL_PREFIXES(PanelBrowserTest, RestoredBounds); | |
| 217 | |
| 218 // Panel can only be created using PanelManager::CreatePanel(). | |
| 219 // |requested_size| is the desired size for the panel, but actual | |
| 220 // size may differ after panel layout. | |
| 221 Panel(Browser* browser, const gfx::Size& requested_size); | |
| 222 | |
| 223 // Panel must be initialized to be "fully created" and ready for use. | 210 // Panel must be initialized to be "fully created" and ready for use. |
| 224 // Only called by PanelManager. | 211 // Only called by PanelManager. |
| 225 bool initialized() const { return initialized_; } | 212 bool initialized() const { return initialized_; } |
| 226 void Initialize(const gfx::Rect& bounds); | 213 void Initialize(const gfx::Rect& bounds); |
| 227 | 214 |
| 228 // This is different from BrowserWindow::SetBounds(): | 215 // This is different from BrowserWindow::SetBounds(): |
| 229 // * SetPanelBounds() is only called by PanelManager to manage its position. | 216 // * SetPanelBounds() is only called by PanelManager to manage its position. |
| 230 // * SetBounds() is called by the API to try to change the bounds, which is | 217 // * SetBounds() is called by the API to try to change the bounds, which is |
| 231 // not allowed for Panel. | 218 // not allowed for Panel. |
| 232 void SetPanelBounds(const gfx::Rect& bounds); | 219 void SetPanelBounds(const gfx::Rect& bounds); |
| 233 | 220 |
| 234 // Sets whether the panel will auto resize according to its content. | 221 // Sets whether the panel will auto resize according to its content. |
| 235 void SetAutoResizable(bool resizable); | 222 void SetAutoResizable(bool resizable); |
| 236 | 223 |
| 237 // Sets minimum and maximum size for the panel. | 224 // Sets minimum and maximum size for the panel. |
| 238 void SetSizeRange(const gfx::Size& min_size, const gfx::Size& max_size); | 225 void SetSizeRange(const gfx::Size& min_size, const gfx::Size& max_size); |
| 239 | 226 |
| 227 protected: |
| 228 virtual void DestroyBrowser() OVERRIDE; |
| 229 |
| 230 private: |
| 231 friend class PanelManager; |
| 232 friend class PanelBrowserTest; |
| 233 FRIEND_TEST_ALL_PREFIXES(PanelBrowserTest, RestoredBounds); |
| 234 |
| 235 // Panel can only be created using PanelManager::CreatePanel(). |
| 236 // |requested_size| is the desired size for the panel, but actual |
| 237 // size may differ after panel layout. |
| 238 Panel(Browser* browser, const gfx::Size& requested_size); |
| 239 |
| 240 // NULL might be returned if the tab has not been added. | 240 // NULL might be returned if the tab has not been added. |
| 241 RenderViewHost* GetRenderViewHost() const; | 241 RenderViewHost* GetRenderViewHost() const; |
| 242 | 242 |
| 243 // Configures the tab contents for auto resize, including configurations | 243 // Configures the tab contents for auto resize, including configurations |
| 244 // on the renderer and detecting renderer changes. | 244 // on the renderer and detecting renderer changes. |
| 245 void EnableTabContentsAutoResize(TabContents* tab_contents); | 245 void EnableTabContentsAutoResize(TabContents* tab_contents); |
| 246 | 246 |
| 247 // Configures the renderer for auto resize. | 247 // Configures the renderer for auto resize. |
| 248 void EnableRendererAutoResize(RenderViewHost* render_view_host); | 248 void EnableRendererAutoResize(RenderViewHost* render_view_host); |
| 249 | 249 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 275 NativePanel* native_panel_; // Weak, owns us. | 275 NativePanel* native_panel_; // Weak, owns us. |
| 276 | 276 |
| 277 ExpansionState expansion_state_; | 277 ExpansionState expansion_state_; |
| 278 | 278 |
| 279 content::NotificationRegistrar registrar_; | 279 content::NotificationRegistrar registrar_; |
| 280 | 280 |
| 281 DISALLOW_COPY_AND_ASSIGN(Panel); | 281 DISALLOW_COPY_AND_ASSIGN(Panel); |
| 282 }; | 282 }; |
| 283 | 283 |
| 284 #endif // CHROME_BROWSER_UI_PANELS_PANEL_H_ | 284 #endif // CHROME_BROWSER_UI_PANELS_PANEL_H_ |
| OLD | NEW |