| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 // Returns the PanelManager associated with this panel. | 52 // Returns the PanelManager associated with this panel. |
| 53 PanelManager* manager() const; | 53 PanelManager* manager() const; |
| 54 | 54 |
| 55 // Gets the extension that a panel is created from. | 55 // Gets the extension that a panel is created from. |
| 56 // Returns NULL if it cannot be found. | 56 // Returns NULL if it cannot be found. |
| 57 const Extension* GetExtension() const; | 57 const Extension* GetExtension() const; |
| 58 | 58 |
| 59 void SetExpansionState(ExpansionState new_expansion_state); | 59 void SetExpansionState(ExpansionState new_expansion_state); |
| 60 | 60 |
| 61 bool ShouldBringUpTitlebar(int mouse_x, int mouse_y) const; | |
| 62 | |
| 63 bool IsDrawingAttention() const; | 61 bool IsDrawingAttention() const; |
| 64 | 62 |
| 65 // This function will only get called by PanelManager when full screen mode | 63 // This function will only get called by PanelManager when full screen mode |
| 66 // changes i.e it gets called when an app goes into full screen mode or when | 64 // changes i.e it gets called when an app goes into full screen mode or when |
| 67 // an app exits full screen mode. Panel should respond by making sure | 65 // an app exits full screen mode. Panel should respond by making sure |
| 68 // a) it does not go on top when some app enters full screen mode. | 66 // a) it does not go on top when some app enters full screen mode. |
| 69 // b) it remains on top when an app exits full screen mode. | 67 // b) it remains on top when an app exits full screen mode. |
| 70 void FullScreenModeChanged(bool is_full_screen); | 68 void FullScreenModeChanged(bool is_full_screen); |
| 71 | 69 |
| 72 void MoveOutOfOverflow(); | |
| 73 | |
| 74 // Ensures that the panel is fully visible, that is, not obscured by other | 70 // Ensures that the panel is fully visible, that is, not obscured by other |
| 75 // top-most windows. | 71 // top-most windows. |
| 76 void EnsureFullyVisible(); | 72 void EnsureFullyVisible(); |
| 77 | 73 |
| 78 int TitleOnlyHeight() const; | 74 int TitleOnlyHeight() const; |
| 79 | 75 |
| 80 // Returns the size of the panel when it is iconified, as shown on the | 76 // Returns the size of the panel when it is iconified, as shown on the |
| 81 // overflow area. | 77 // overflow area. |
| 82 gfx::Size IconOnlySize() const; | 78 gfx::Size IconOnlySize() const; |
| 83 | 79 |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 | 237 |
| 242 // Updates the panel bounds instantly without any animation. | 238 // Updates the panel bounds instantly without any animation. |
| 243 void SetPanelBoundsInstantly(const gfx::Rect& bounds); | 239 void SetPanelBoundsInstantly(const gfx::Rect& bounds); |
| 244 | 240 |
| 245 // Sets whether the panel will auto resize according to its content. | 241 // Sets whether the panel will auto resize according to its content. |
| 246 void SetAutoResizable(bool resizable); | 242 void SetAutoResizable(bool resizable); |
| 247 | 243 |
| 248 // Sets minimum and maximum size for the panel. | 244 // Sets minimum and maximum size for the panel. |
| 249 void SetSizeRange(const gfx::Size& min_size, const gfx::Size& max_size); | 245 void SetSizeRange(const gfx::Size& min_size, const gfx::Size& max_size); |
| 250 | 246 |
| 247 // Sets whether the panel app icon is visible in the taskbar. |
| 248 void SetAppIconVisibility(bool visible); |
| 249 |
| 250 // Newly created panels may be placed in a temporary layout until their |
| 251 // final position is determined. |
| 252 bool temporary_layout() const { return temporary_layout_; } |
| 253 void set_temporary_layout(bool temporary) { temporary_layout_ = temporary; } |
| 254 |
| 251 protected: | 255 protected: |
| 252 virtual void DestroyBrowser() OVERRIDE; | 256 virtual void DestroyBrowser() OVERRIDE; |
| 253 | 257 |
| 254 private: | 258 private: |
| 255 friend class PanelManager; | 259 friend class PanelManager; |
| 256 friend class PanelBrowserTest; | 260 friend class PanelBrowserTest; |
| 257 FRIEND_TEST_ALL_PREFIXES(PanelBrowserTest, RestoredBounds); | 261 FRIEND_TEST_ALL_PREFIXES(PanelBrowserTest, RestoredBounds); |
| 258 | 262 |
| 259 // Panel can only be created using PanelManager::CreatePanel(). | 263 // Panel can only be created using PanelManager::CreatePanel(). |
| 260 // |requested_size| is the desired size for the panel, but actual | 264 // |requested_size| is the desired size for the panel, but actual |
| 261 // size may differ after panel layout. | 265 // size may differ after panel layout. |
| 262 Panel(Browser* browser, const gfx::Size& requested_size); | 266 Panel(Browser* browser, const gfx::Size& requested_size); |
| 263 | 267 |
| 264 // Configures the tab contents for auto resize, including configurations | 268 // Configures the tab contents for auto resize, including configurations |
| 265 // on the renderer and detecting renderer changes. | 269 // on the renderer and detecting renderer changes. |
| 266 void EnableTabContentsAutoResize(TabContents* tab_contents); | 270 void EnableTabContentsAutoResize(TabContents* tab_contents); |
| 267 | 271 |
| 268 // Configures the renderer for auto resize (if auto resize is enabled). | 272 // Configures the renderer for auto resize (if auto resize is enabled). |
| 269 void ConfigureAutoResize(TabContents* tab_contents); | 273 void ConfigureAutoResize(TabContents* tab_contents); |
| 270 | 274 |
| 271 Browser* browser_; // Weak, owned by native panel. | 275 Browser* browser_; // Weak, owned by native panel. |
| 272 | 276 |
| 273 bool initialized_; | 277 bool initialized_; |
| 274 | 278 |
| 279 // Newly created panels may be placed in a temporary layout until their |
| 280 // final position is determined. |
| 281 bool temporary_layout_; |
| 282 |
| 275 // Stores the full size of the panel so we can restore it after it's | 283 // Stores the full size of the panel so we can restore it after it's |
| 276 // been minimized. | 284 // been minimized. |
| 277 gfx::Size restored_size_; | 285 gfx::Size restored_size_; |
| 278 | 286 |
| 279 // This is the minimum size that the panel can shrink to. | 287 // This is the minimum size that the panel can shrink to. |
| 280 gfx::Size min_size_; | 288 gfx::Size min_size_; |
| 281 | 289 |
| 282 // This is the size beyond which the panel is not going to grow to accomodate | 290 // This is the size beyond which the panel is not going to grow to accomodate |
| 283 // the growing content and WebKit would add the scrollbars in such case. | 291 // the growing content and WebKit would add the scrollbars in such case. |
| 284 gfx::Size max_size_; | 292 gfx::Size max_size_; |
| 285 | 293 |
| 286 // True if this panel auto resizes based on content. | 294 // True if this panel auto resizes based on content. |
| 287 bool auto_resizable_; | 295 bool auto_resizable_; |
| 288 | 296 |
| 289 // Platform specifc implementation for panels. It'd be one of | 297 // Platform specifc implementation for panels. It'd be one of |
| 290 // PanelBrowserWindowGtk/PanelBrowserView/PanelBrowserWindowCocoa. | 298 // PanelBrowserWindowGtk/PanelBrowserView/PanelBrowserWindowCocoa. |
| 291 NativePanel* native_panel_; // Weak, owns us. | 299 NativePanel* native_panel_; // Weak, owns us. |
| 292 | 300 |
| 293 ExpansionState expansion_state_; | 301 ExpansionState expansion_state_; |
| 294 | 302 |
| 303 // Indicates whether the panel app icon is visible in the taskbar. |
| 304 bool app_icon_visible_; |
| 305 |
| 295 content::NotificationRegistrar registrar_; | 306 content::NotificationRegistrar registrar_; |
| 296 | 307 |
| 297 DISALLOW_COPY_AND_ASSIGN(Panel); | 308 DISALLOW_COPY_AND_ASSIGN(Panel); |
| 298 }; | 309 }; |
| 299 | 310 |
| 300 #endif // CHROME_BROWSER_UI_PANELS_PANEL_H_ | 311 #endif // CHROME_BROWSER_UI_PANELS_PANEL_H_ |
| OLD | NEW |