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_COCOA_PANELS_PANEL_COCOA_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_PANELS_PANEL_COCOA_H_ |
6 #define CHROME_BROWSER_UI_COCOA_PANELS_PANEL_COCOA_H_ | 6 #define CHROME_BROWSER_UI_COCOA_PANELS_PANEL_COCOA_H_ |
7 | 7 |
8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "chrome/browser/ui/panels/native_panel.h" | 10 #include "chrome/browser/ui/panels/native_panel.h" |
11 #include "ui/gfx/rect.h" | 11 #include "ui/gfx/rect.h" |
12 | 12 |
13 class Panel; | 13 class Panel; |
14 @class PanelWindowControllerCocoa; | 14 @class PanelWindowControllerCocoa; |
15 | 15 |
16 // An implememtation of the native panel in Cocoa. | 16 // An implememtation of the native panel in Cocoa. |
17 // Bridges between C++ and the Cocoa NSWindow. Cross-platform code will | 17 // Bridges between C++ and the Cocoa NSWindow. Cross-platform code will |
18 // interact with this object when it needs to manipulate the window. | 18 // interact with this object when it needs to manipulate the window. |
19 class PanelCocoa : public NativePanel { | 19 class PanelCocoa : public NativePanel { |
20 public: | 20 public: |
21 PanelCocoa(Panel* panel, const gfx::Rect& bounds, bool always_on_top); | 21 PanelCocoa(Panel* panel, const gfx::Rect& bounds, bool always_on_top); |
22 virtual ~PanelCocoa(); | 22 ~PanelCocoa() override; |
23 | 23 |
24 // Overridden from NativePanel | 24 // Overridden from NativePanel |
25 virtual void ShowPanel() override; | 25 void ShowPanel() override; |
26 virtual void ShowPanelInactive() override; | 26 void ShowPanelInactive() override; |
27 virtual gfx::Rect GetPanelBounds() const override; | 27 gfx::Rect GetPanelBounds() const override; |
28 virtual void SetPanelBounds(const gfx::Rect& bounds) override; | 28 void SetPanelBounds(const gfx::Rect& bounds) override; |
29 virtual void SetPanelBoundsInstantly(const gfx::Rect& bounds) override; | 29 void SetPanelBoundsInstantly(const gfx::Rect& bounds) override; |
30 virtual void ClosePanel() override; | 30 void ClosePanel() override; |
31 virtual void ActivatePanel() override; | 31 void ActivatePanel() override; |
32 virtual void DeactivatePanel() override; | 32 void DeactivatePanel() override; |
33 virtual bool IsPanelActive() const override; | 33 bool IsPanelActive() const override; |
34 virtual void PreventActivationByOS(bool prevent_activation) override; | 34 void PreventActivationByOS(bool prevent_activation) override; |
35 virtual gfx::NativeWindow GetNativePanelWindow() override; | 35 gfx::NativeWindow GetNativePanelWindow() override; |
36 virtual void UpdatePanelTitleBar() override; | 36 void UpdatePanelTitleBar() override; |
37 virtual void UpdatePanelLoadingAnimations(bool should_animate) override; | 37 void UpdatePanelLoadingAnimations(bool should_animate) override; |
38 virtual void PanelWebContentsFocused(content::WebContents* contents) override; | 38 void PanelWebContentsFocused(content::WebContents* contents) override; |
39 virtual void PanelCut() override; | 39 void PanelCut() override; |
40 virtual void PanelCopy() override; | 40 void PanelCopy() override; |
41 virtual void PanelPaste() override; | 41 void PanelPaste() override; |
42 virtual void DrawAttention(bool draw_attention) override; | 42 void DrawAttention(bool draw_attention) override; |
43 virtual bool IsDrawingAttention() const override; | 43 bool IsDrawingAttention() const override; |
44 virtual void HandlePanelKeyboardEvent( | 44 void HandlePanelKeyboardEvent( |
45 const content::NativeWebKeyboardEvent& event) override; | 45 const content::NativeWebKeyboardEvent& event) override; |
46 virtual void FullScreenModeChanged(bool is_full_screen) override; | 46 void FullScreenModeChanged(bool is_full_screen) override; |
47 virtual bool IsPanelAlwaysOnTop() const override; | 47 bool IsPanelAlwaysOnTop() const override; |
48 virtual void SetPanelAlwaysOnTop(bool on_top) override; | 48 void SetPanelAlwaysOnTop(bool on_top) override; |
49 virtual void UpdatePanelMinimizeRestoreButtonVisibility() override; | 49 void UpdatePanelMinimizeRestoreButtonVisibility() override; |
50 virtual void SetWindowCornerStyle(panel::CornerStyle corner_style) override; | 50 void SetWindowCornerStyle(panel::CornerStyle corner_style) override; |
51 virtual void PanelExpansionStateChanging( | 51 void PanelExpansionStateChanging(Panel::ExpansionState old_state, |
52 Panel::ExpansionState old_state, | 52 Panel::ExpansionState new_state) override; |
53 Panel::ExpansionState new_state) override; | 53 void AttachWebContents(content::WebContents* contents) override; |
54 virtual void AttachWebContents(content::WebContents* contents) override; | 54 void DetachWebContents(content::WebContents* contents) override; |
55 virtual void DetachWebContents(content::WebContents* contents) override; | |
56 | 55 |
57 // These sizes are in screen coordinates. | 56 // These sizes are in screen coordinates. |
58 virtual gfx::Size WindowSizeFromContentSize( | 57 gfx::Size WindowSizeFromContentSize( |
59 const gfx::Size& content_size) const override; | 58 const gfx::Size& content_size) const override; |
60 virtual gfx::Size ContentSizeFromWindowSize( | 59 gfx::Size ContentSizeFromWindowSize( |
61 const gfx::Size& window_size) const override; | 60 const gfx::Size& window_size) const override; |
62 virtual int TitleOnlyHeight() const override; | 61 int TitleOnlyHeight() const override; |
63 | 62 |
64 virtual void MinimizePanelBySystem() override; | 63 void MinimizePanelBySystem() override; |
65 virtual bool IsPanelMinimizedBySystem() const override; | 64 bool IsPanelMinimizedBySystem() const override; |
66 virtual bool IsPanelShownOnActiveDesktop() const override; | 65 bool IsPanelShownOnActiveDesktop() const override; |
67 virtual void ShowShadow(bool show) override; | 66 void ShowShadow(bool show) override; |
68 virtual NativePanelTesting* CreateNativePanelTesting() override; | 67 NativePanelTesting* CreateNativePanelTesting() override; |
69 | 68 |
70 Panel* panel() const; | 69 Panel* panel() const; |
71 void DidCloseNativeWindow(); | 70 void DidCloseNativeWindow(); |
72 | 71 |
73 bool IsClosed() const; | 72 bool IsClosed() const; |
74 | 73 |
75 // PanelStackWindowCocoa might want to update the stored bounds directly since | 74 // PanelStackWindowCocoa might want to update the stored bounds directly since |
76 // it has already taken care of updating the window bounds directly. | 75 // it has already taken care of updating the window bounds directly. |
77 void set_cached_bounds_directly(const gfx::Rect& bounds) { bounds_ = bounds; } | 76 void set_cached_bounds_directly(const gfx::Rect& bounds) { bounds_ = bounds; } |
78 | 77 |
(...skipping 27 matching lines...) Expand all Loading... |
106 bool is_shown_; // Panel is hidden on creation, Show() changes that forever. | 105 bool is_shown_; // Panel is hidden on creation, Show() changes that forever. |
107 NSInteger attention_request_id_; // identifier from requestUserAttention. | 106 NSInteger attention_request_id_; // identifier from requestUserAttention. |
108 | 107 |
109 // Indicates how the window corner should be rendered, rounded or not. | 108 // Indicates how the window corner should be rendered, rounded or not. |
110 panel::CornerStyle corner_style_; | 109 panel::CornerStyle corner_style_; |
111 | 110 |
112 DISALLOW_COPY_AND_ASSIGN(PanelCocoa); | 111 DISALLOW_COPY_AND_ASSIGN(PanelCocoa); |
113 }; | 112 }; |
114 | 113 |
115 #endif // CHROME_BROWSER_UI_COCOA_PANELS_PANEL_COCOA_H_ | 114 #endif // CHROME_BROWSER_UI_COCOA_PANELS_PANEL_COCOA_H_ |
OLD | NEW |