| OLD | NEW |
| 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_NATIVE_PANEL_H_ | 5 #ifndef CHROME_BROWSER_UI_PANELS_NATIVE_PANEL_H_ |
| 6 #define CHROME_BROWSER_UI_PANELS_NATIVE_PANEL_H_ | 6 #define CHROME_BROWSER_UI_PANELS_NATIVE_PANEL_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/ui/panels/panel.h" | 8 #include "chrome/browser/ui/panels/panel.h" |
| 9 #include "ui/gfx/native_widget_types.h" | 9 #include "ui/gfx/native_widget_types.h" |
| 10 | 10 |
| 11 class Browser; | |
| 12 class FindBar; | |
| 13 class NativePanelTesting; | 11 class NativePanelTesting; |
| 14 | 12 |
| 15 namespace content { | 13 namespace content { |
| 16 struct NativeWebKeyboardEvent; | 14 struct NativeWebKeyboardEvent; |
| 17 class WebContents; | 15 class WebContents; |
| 18 } | 16 } |
| 19 | 17 |
| 20 namespace gfx { | 18 namespace gfx { |
| 21 class Rect; | 19 class Rect; |
| 22 } // namespace gfx | 20 } // namespace gfx |
| 23 | 21 |
| 24 // An interface for a class that implements platform-specific behavior for panel | 22 // An interface for a class that implements platform-specific behavior for panel |
| 25 // windows. We use this interface for two reasons: | 23 // windows to provide additional methods not found in BaseWindow. |
| 26 // 1. We don't want to use BrowserWindow as the interface between shared panel | |
| 27 // code and platform-specific code. BrowserWindow has a lot of methods, most | |
| 28 // of which we don't use and simply stub out with NOTIMPLEMENTED(). | |
| 29 // 2. We need some additional methods that BrowserWindow doesn't provide, such | |
| 30 // as MinimizePanel() and RestorePanel(). | |
| 31 // Note that even though we don't use BrowserWindow directly, Windows and GTK+ | |
| 32 // still use the BrowserWindow interface as part of their implementation so we | |
| 33 // use Panel in all the method names to avoid collisions. | |
| 34 class NativePanel { | 24 class NativePanel { |
| 35 friend class BasePanelBrowserTest; // for CreateNativePanelTesting | 25 friend class BasePanelBrowserTest; // for CreateNativePanelTesting |
| 36 friend class Panel; | 26 friend class Panel; |
| 37 friend class PanelBrowserWindow; | 27 friend class PanelBrowserWindow; |
| 38 friend class PanelBrowserTest; | 28 friend class PanelBrowserTest; |
| 39 friend class OldBasePanelBrowserTest; // for CreateNativePanelTesting | |
| 40 friend class OldPanelBrowserTest; | |
| 41 | 29 |
| 42 protected: | 30 protected: |
| 43 virtual ~NativePanel() {} | 31 virtual ~NativePanel() {} |
| 44 | 32 |
| 45 virtual void ShowPanel() = 0; | 33 virtual void ShowPanel() = 0; |
| 46 virtual void ShowPanelInactive() = 0; | 34 virtual void ShowPanelInactive() = 0; |
| 47 virtual gfx::Rect GetPanelBounds() const = 0; | 35 virtual gfx::Rect GetPanelBounds() const = 0; |
| 48 virtual void SetPanelBounds(const gfx::Rect& bounds) = 0; | 36 virtual void SetPanelBounds(const gfx::Rect& bounds) = 0; |
| 49 virtual void SetPanelBoundsInstantly(const gfx::Rect& bounds) = 0; | 37 virtual void SetPanelBoundsInstantly(const gfx::Rect& bounds) = 0; |
| 50 virtual void ClosePanel() = 0; | 38 virtual void ClosePanel() = 0; |
| 51 virtual void ActivatePanel() = 0; | 39 virtual void ActivatePanel() = 0; |
| 52 virtual void DeactivatePanel() = 0; | 40 virtual void DeactivatePanel() = 0; |
| 53 virtual bool IsPanelActive() const = 0; | 41 virtual bool IsPanelActive() const = 0; |
| 54 virtual void PreventActivationByOS(bool prevent_activation) = 0; | 42 virtual void PreventActivationByOS(bool prevent_activation) = 0; |
| 55 virtual gfx::NativeWindow GetNativePanelHandle() = 0; | 43 virtual gfx::NativeWindow GetNativePanelHandle() = 0; |
| 56 virtual void UpdatePanelTitleBar() = 0; | 44 virtual void UpdatePanelTitleBar() = 0; |
| 57 virtual void UpdatePanelLoadingAnimations(bool should_animate) = 0; | 45 virtual void UpdatePanelLoadingAnimations(bool should_animate) = 0; |
| 58 virtual void ShowTaskManagerForPanel() {} // legacy | |
| 59 virtual FindBar* CreatePanelFindBar() = 0; // legacy | |
| 60 virtual void NotifyPanelOnUserChangedTheme() = 0; | 46 virtual void NotifyPanelOnUserChangedTheme() = 0; |
| 61 virtual void PanelWebContentsFocused(content::WebContents* contents) {} | 47 virtual void PanelWebContentsFocused(content::WebContents* contents) {} |
| 62 virtual void PanelCut() = 0; | 48 virtual void PanelCut() = 0; |
| 63 virtual void PanelCopy() = 0; | 49 virtual void PanelCopy() = 0; |
| 64 virtual void PanelPaste() = 0; | 50 virtual void PanelPaste() = 0; |
| 65 virtual void DrawAttention(bool draw_attention) = 0; | 51 virtual void DrawAttention(bool draw_attention) = 0; |
| 66 virtual bool IsDrawingAttention() const = 0; | 52 virtual bool IsDrawingAttention() const = 0; |
| 67 virtual bool PreHandlePanelKeyboardEvent( | |
| 68 const content::NativeWebKeyboardEvent& event, | |
| 69 bool* is_keyboard_shortcut) = 0; | |
| 70 virtual void HandlePanelKeyboardEvent( | 53 virtual void HandlePanelKeyboardEvent( |
| 71 const content::NativeWebKeyboardEvent& event) = 0; | 54 const content::NativeWebKeyboardEvent& event) = 0; |
| 72 virtual void FullScreenModeChanged(bool is_full_screen) = 0; | 55 virtual void FullScreenModeChanged(bool is_full_screen) = 0; |
| 73 virtual void PanelExpansionStateChanging(Panel::ExpansionState old_state, | 56 virtual void PanelExpansionStateChanging(Panel::ExpansionState old_state, |
| 74 Panel::ExpansionState new_state) = 0; | 57 Panel::ExpansionState new_state) = 0; |
| 75 // TODO(jennb): Make these new methods pure virtual after panel refactor. | 58 virtual void AttachWebContents(content::WebContents* contents) = 0; |
| 76 virtual void AttachWebContents(content::WebContents* contents) {} | 59 virtual void DetachWebContents(content::WebContents* contents) = 0; |
| 77 virtual void DetachWebContents(content::WebContents* contents) {} | |
| 78 | |
| 79 virtual Browser* GetPanelBrowser() const = 0; // legacy | |
| 80 virtual void DestroyPanelBrowser() {} // legacy | |
| 81 | 60 |
| 82 // Returns the exterior size of the panel window given the client content | 61 // Returns the exterior size of the panel window given the client content |
| 83 // size and vice versa. | 62 // size and vice versa. |
| 84 virtual gfx::Size WindowSizeFromContentSize( | 63 virtual gfx::Size WindowSizeFromContentSize( |
| 85 const gfx::Size& content_size) const = 0; | 64 const gfx::Size& content_size) const = 0; |
| 86 virtual gfx::Size ContentSizeFromWindowSize( | 65 virtual gfx::Size ContentSizeFromWindowSize( |
| 87 const gfx::Size& window_size) const = 0; | 66 const gfx::Size& window_size) const = 0; |
| 88 | 67 |
| 89 virtual int TitleOnlyHeight() const = 0; | 68 virtual int TitleOnlyHeight() const = 0; |
| 90 | 69 |
| 91 // Brings the panel to the top of the z-order without activating it. This | |
| 92 // will make sure that the panel is not obscured by other top-most windows. | |
| 93 virtual void EnsurePanelFullyVisible() = 0; | |
| 94 | |
| 95 // Sets whether the panel window is always on top. | 70 // Sets whether the panel window is always on top. |
| 96 virtual void SetPanelAlwaysOnTop(bool on_top) = 0; | 71 virtual void SetPanelAlwaysOnTop(bool on_top) = 0; |
| 97 | 72 |
| 98 // Enables resizing by dragging edges/corners. | 73 // Enables resizing by dragging edges/corners. |
| 99 virtual void EnableResizeByMouse(bool enable) = 0; | 74 virtual void EnableResizeByMouse(bool enable) = 0; |
| 100 | 75 |
| 101 // Updates the visibility of the minimize and restore buttons. | 76 // Updates the visibility of the minimize and restore buttons. |
| 102 virtual void UpdatePanelMinimizeRestoreButtonVisibility() = 0; | 77 virtual void UpdatePanelMinimizeRestoreButtonVisibility() = 0; |
| 103 | 78 |
| 104 // Create testing interface for native panel. (Keep this last to separate | 79 // Create testing interface for native panel. (Keep this last to separate |
| (...skipping 30 matching lines...) Expand all Loading... |
| 135 // active, i.e. the titlebar is painted per its active state. | 110 // active, i.e. the titlebar is painted per its active state. |
| 136 virtual bool VerifyActiveState(bool is_active) = 0; | 111 virtual bool VerifyActiveState(bool is_active) = 0; |
| 137 virtual void WaitForWindowCreationToComplete() const { } | 112 virtual void WaitForWindowCreationToComplete() const { } |
| 138 | 113 |
| 139 virtual bool IsWindowSizeKnown() const = 0; | 114 virtual bool IsWindowSizeKnown() const = 0; |
| 140 virtual bool IsAnimatingBounds() const = 0; | 115 virtual bool IsAnimatingBounds() const = 0; |
| 141 virtual bool IsButtonVisible(panel::TitlebarButtonType button_type) const = 0; | 116 virtual bool IsButtonVisible(panel::TitlebarButtonType button_type) const = 0; |
| 142 }; | 117 }; |
| 143 | 118 |
| 144 #endif // CHROME_BROWSER_UI_PANELS_NATIVE_PANEL_H_ | 119 #endif // CHROME_BROWSER_UI_PANELS_NATIVE_PANEL_H_ |
| OLD | NEW |