Chromium Code Reviews| 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 197 void OnWindowSizeAvailable(); | 197 void OnWindowSizeAvailable(); |
| 198 | 198 |
| 199 // Asynchronous completion of panel close request. | 199 // Asynchronous completion of panel close request. |
| 200 void OnNativePanelClosed(); | 200 void OnNativePanelClosed(); |
| 201 | 201 |
| 202 NativePanel* native_panel() { return native_panel_; } | 202 NativePanel* native_panel() { return native_panel_; } |
| 203 Browser* browser() const; | 203 Browser* browser() const; |
| 204 ExpansionState expansion_state() const { return expansion_state_; } | 204 ExpansionState expansion_state() const { return expansion_state_; } |
| 205 const gfx::Size& min_size() const { return min_size_; } | 205 const gfx::Size& min_size() const { return min_size_; } |
| 206 const gfx::Size& max_size() const { return max_size_; } | 206 const gfx::Size& max_size() const { return max_size_; } |
| 207 bool auto_resizable() { return auto_resizable_; } | |
|
jianli
2011/11/18 23:03:32
const.
jennb
2011/11/18 23:26:00
Done.
| |
| 207 | 208 |
| 208 protected: | 209 protected: |
| 209 virtual void DestroyBrowser() OVERRIDE; | 210 virtual void DestroyBrowser() OVERRIDE; |
| 210 | 211 |
| 211 private: | 212 private: |
| 212 friend class PanelManager; | 213 friend class PanelManager; |
| 213 friend class PanelBrowserTest; | 214 friend class PanelBrowserTest; |
| 214 FRIEND_TEST_ALL_PREFIXES(PanelBrowserTest, RestoredBounds); | 215 FRIEND_TEST_ALL_PREFIXES(PanelBrowserTest, RestoredBounds); |
| 215 | 216 |
| 216 // Panel can only be created using PanelManager::CreatePanel(). | 217 // Panel can only be created using PanelManager::CreatePanel(). |
| 217 Panel(Browser* browser, const gfx::Rect& bounds); | 218 Panel(Browser* browser, const gfx::Rect& bounds); |
| 218 | 219 |
| 219 // This is different from BrowserWindow::SetBounds(): | 220 // This is different from BrowserWindow::SetBounds(): |
| 220 // * SetPanelBounds() is only called by PanelManager to manage its position. | 221 // * SetPanelBounds() is only called by PanelManager to manage its position. |
| 221 // * SetBounds() is called by the API to try to change the bounds, which is | 222 // * SetBounds() is called by the API to try to change the bounds, which is |
| 222 // not allowed for Panel. | 223 // not allowed for Panel. |
| 223 void SetPanelBounds(const gfx::Rect& bounds); | 224 void SetPanelBounds(const gfx::Rect& bounds); |
| 224 | 225 |
| 225 // Updates the maximum size. | 226 // Updates the maximum/minimum size. |
| 226 void SetMaxSize(const gfx::Size& max_size); | 227 void SetMaxSize(const gfx::Size& max_size); |
| 228 void SetMinSize(const gfx::Size& min_size); | |
| 229 | |
| 230 // Sets whether the panel will auto resize according to its content. | |
| 231 void SetAutoResizable(bool resizable); | |
| 227 | 232 |
| 228 // NULL might be returned if the tab has not been added. | 233 // NULL might be returned if the tab has not been added. |
| 229 RenderViewHost* GetRenderViewHost() const; | 234 RenderViewHost* GetRenderViewHost() const; |
| 230 | 235 |
| 231 void EnableAutoResize(RenderViewHost* render_view_host); | 236 // Sets up necessary configuration to make tab contents resizable. |
| 237 void SetUpAutoResize(TabContents* tab_contents); | |
|
jianli
2011/11/18 23:03:32
'SetUpAutoResize' seems to be easily confused with
jennb
2011/11/18 23:26:00
Done.
| |
| 238 | |
| 239 void EnableRendererAutoResize(RenderViewHost* render_view_host); | |
|
Dmitry Titov
2011/11/18 23:00:34
A comment for this second method could explain why
jennb
2011/11/18 23:26:00
Sure. Though this function should go away after Da
| |
| 232 | 240 |
| 233 // Requests RenderViewHost not to show the scrollbars till |max_size_| since | 241 // Requests RenderViewHost not to show the scrollbars till |max_size_| since |
| 234 // the panel can grow to |max_size_|. | 242 // the panel can grow to |max_size_|. |
| 235 void RequestRenderViewHostToDisableScrollbars( | 243 void RequestRenderViewHostToDisableScrollbars( |
| 236 RenderViewHost* render_view_host); | 244 RenderViewHost* render_view_host); |
| 237 | 245 |
| 238 // This is the minimum size that the panel can shrink to. | 246 // This is the minimum size that the panel can shrink to. |
| 239 gfx::Size min_size_; | 247 gfx::Size min_size_; |
| 240 | 248 |
| 241 // This is the size beyond which the panel is not going to grow to accomodate | 249 // This is the size beyond which the panel is not going to grow to accomodate |
| 242 // the growing content and WebKit would add the scrollbars in such case. | 250 // the growing content and WebKit would add the scrollbars in such case. |
| 243 gfx::Size max_size_; | 251 gfx::Size max_size_; |
| 244 | 252 |
| 253 // True if this panel auto resizes based on content. | |
| 254 bool auto_resizable_; | |
| 255 | |
| 245 // Platform specifc implementation for panels. It'd be one of | 256 // Platform specifc implementation for panels. It'd be one of |
| 246 // PanelBrowserWindowGtk/PanelBrowserView/PanelBrowserWindowCocoa. | 257 // PanelBrowserWindowGtk/PanelBrowserView/PanelBrowserWindowCocoa. |
| 247 NativePanel* native_panel_; // Weak, owns us. | 258 NativePanel* native_panel_; // Weak, owns us. |
| 248 | 259 |
| 249 ExpansionState expansion_state_; | 260 ExpansionState expansion_state_; |
| 250 | 261 |
| 251 // Stores the full height of the panel so we can restore it after it's | 262 // Stores the full height of the panel so we can restore it after it's |
| 252 // been minimized. | 263 // been minimized. |
| 253 int restored_height_; | 264 int restored_height_; |
| 254 | 265 |
| 255 content::NotificationRegistrar registrar_; | 266 content::NotificationRegistrar registrar_; |
| 256 | 267 |
| 257 DISALLOW_COPY_AND_ASSIGN(Panel); | 268 DISALLOW_COPY_AND_ASSIGN(Panel); |
| 258 }; | 269 }; |
| 259 | 270 |
| 260 #endif // CHROME_BROWSER_UI_PANELS_PANEL_H_ | 271 #endif // CHROME_BROWSER_UI_PANELS_PANEL_H_ |
| OLD | NEW |