| 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_PANEL_COCOA_H_ | 5 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_COCOA_H_ |
| 6 #define CHROME_BROWSER_UI_PANELS_PANEL_COCOA_H_ | 6 #define CHROME_BROWSER_UI_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_cocoa.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 // TODO(jennb): This class can be removed after the panel refactor once | 19 class PanelCocoa : public NativePanel { |
| 20 // it's safe for PanelWindowController to use PanelCocoa directly. | |
| 21 class PanelCocoa : public NativePanelCocoa { | |
| 22 public: | 20 public: |
| 23 PanelCocoa(Panel* panel, const gfx::Rect& bounds); | 21 PanelCocoa(Panel* panel, const gfx::Rect& bounds); |
| 24 virtual ~PanelCocoa(); | 22 virtual ~PanelCocoa(); |
| 25 | 23 |
| 26 // Overridden from NativePanel | 24 // Overridden from NativePanel |
| 27 virtual void ShowPanel() OVERRIDE; | 25 virtual void ShowPanel() OVERRIDE; |
| 28 virtual void ShowPanelInactive() OVERRIDE; | 26 virtual void ShowPanelInactive() OVERRIDE; |
| 29 virtual gfx::Rect GetPanelBounds() const OVERRIDE; | 27 virtual gfx::Rect GetPanelBounds() const OVERRIDE; |
| 30 virtual void SetPanelBounds(const gfx::Rect& bounds) OVERRIDE; | 28 virtual void SetPanelBounds(const gfx::Rect& bounds) OVERRIDE; |
| 31 virtual void SetPanelBoundsInstantly(const gfx::Rect& bounds) OVERRIDE; | 29 virtual void SetPanelBoundsInstantly(const gfx::Rect& bounds) OVERRIDE; |
| 32 virtual void ClosePanel() OVERRIDE; | 30 virtual void ClosePanel() OVERRIDE; |
| 33 virtual void ActivatePanel() OVERRIDE; | 31 virtual void ActivatePanel() OVERRIDE; |
| 34 virtual void DeactivatePanel() OVERRIDE; | 32 virtual void DeactivatePanel() OVERRIDE; |
| 35 virtual bool IsPanelActive() const OVERRIDE; | 33 virtual bool IsPanelActive() const OVERRIDE; |
| 36 virtual void PreventActivationByOS(bool prevent_activation) OVERRIDE; | 34 virtual void PreventActivationByOS(bool prevent_activation) OVERRIDE; |
| 37 virtual gfx::NativeWindow GetNativePanelHandle() OVERRIDE; | 35 virtual gfx::NativeWindow GetNativePanelHandle() OVERRIDE; |
| 38 virtual void UpdatePanelTitleBar() OVERRIDE; | 36 virtual void UpdatePanelTitleBar() OVERRIDE; |
| 39 virtual void UpdatePanelLoadingAnimations(bool should_animate) OVERRIDE; | 37 virtual void UpdatePanelLoadingAnimations(bool should_animate) OVERRIDE; |
| 40 virtual FindBar* CreatePanelFindBar() OVERRIDE; | |
| 41 virtual void NotifyPanelOnUserChangedTheme() OVERRIDE; | 38 virtual void NotifyPanelOnUserChangedTheme() OVERRIDE; |
| 42 virtual void PanelCut() OVERRIDE; | 39 virtual void PanelCut() OVERRIDE; |
| 43 virtual void PanelCopy() OVERRIDE; | 40 virtual void PanelCopy() OVERRIDE; |
| 44 virtual void PanelPaste() OVERRIDE; | 41 virtual void PanelPaste() OVERRIDE; |
| 45 virtual void DrawAttention(bool draw_attention) OVERRIDE; | 42 virtual void DrawAttention(bool draw_attention) OVERRIDE; |
| 46 virtual bool IsDrawingAttention() const OVERRIDE; | 43 virtual bool IsDrawingAttention() const OVERRIDE; |
| 47 virtual bool PreHandlePanelKeyboardEvent( | |
| 48 const content::NativeWebKeyboardEvent& event, | |
| 49 bool* is_keyboard_shortcut) OVERRIDE; | |
| 50 virtual void HandlePanelKeyboardEvent( | 44 virtual void HandlePanelKeyboardEvent( |
| 51 const content::NativeWebKeyboardEvent& event) OVERRIDE; | 45 const content::NativeWebKeyboardEvent& event) OVERRIDE; |
| 52 virtual void FullScreenModeChanged(bool is_full_screen) OVERRIDE; | 46 virtual void FullScreenModeChanged(bool is_full_screen) OVERRIDE; |
| 53 virtual Browser* GetPanelBrowser() const OVERRIDE; | |
| 54 virtual void EnsurePanelFullyVisible() OVERRIDE; | |
| 55 virtual void SetPanelAlwaysOnTop(bool on_top) OVERRIDE; | 47 virtual void SetPanelAlwaysOnTop(bool on_top) OVERRIDE; |
| 56 virtual void EnableResizeByMouse(bool enable) OVERRIDE; | 48 virtual void EnableResizeByMouse(bool enable) OVERRIDE; |
| 57 virtual void UpdatePanelMinimizeRestoreButtonVisibility() OVERRIDE; | 49 virtual void UpdatePanelMinimizeRestoreButtonVisibility() OVERRIDE; |
| 58 virtual void PanelExpansionStateChanging( | 50 virtual void PanelExpansionStateChanging( |
| 59 Panel::ExpansionState old_state, | 51 Panel::ExpansionState old_state, |
| 60 Panel::ExpansionState new_state) OVERRIDE; | 52 Panel::ExpansionState new_state) OVERRIDE; |
| 61 virtual void AttachWebContents(content::WebContents* contents) OVERRIDE; | 53 virtual void AttachWebContents(content::WebContents* contents) OVERRIDE; |
| 62 virtual void DetachWebContents(content::WebContents* contents) OVERRIDE; | 54 virtual void DetachWebContents(content::WebContents* contents) OVERRIDE; |
| 63 | 55 |
| 64 // These sizes are in screen coordinates. | 56 // These sizes are in screen coordinates. |
| 65 virtual gfx::Size WindowSizeFromContentSize( | 57 virtual gfx::Size WindowSizeFromContentSize( |
| 66 const gfx::Size& content_size) const OVERRIDE; | 58 const gfx::Size& content_size) const OVERRIDE; |
| 67 virtual gfx::Size ContentSizeFromWindowSize( | 59 virtual gfx::Size ContentSizeFromWindowSize( |
| 68 const gfx::Size& window_size) const OVERRIDE; | 60 const gfx::Size& window_size) const OVERRIDE; |
| 69 virtual int TitleOnlyHeight() const OVERRIDE; | 61 virtual int TitleOnlyHeight() const OVERRIDE; |
| 70 | 62 |
| 71 virtual NativePanelTesting* CreateNativePanelTesting() OVERRIDE; | 63 virtual NativePanelTesting* CreateNativePanelTesting() OVERRIDE; |
| 72 | 64 |
| 73 // Overridden from NativePanelCocoa. | 65 Panel* panel() const; |
| 74 virtual Panel* panel() const OVERRIDE; | 66 void DidCloseNativeWindow(); |
| 75 virtual void DidCloseNativeWindow() OVERRIDE; | |
| 76 | 67 |
| 77 private: | 68 private: |
| 78 friend class CocoaNativePanelTesting; | 69 friend class CocoaNativePanelTesting; |
| 79 friend class PanelCocoaTest; | 70 friend class PanelCocoaTest; |
| 80 FRIEND_TEST_ALL_PREFIXES(PanelCocoaTest, CreateClose); | 71 FRIEND_TEST_ALL_PREFIXES(PanelCocoaTest, CreateClose); |
| 81 FRIEND_TEST_ALL_PREFIXES(PanelCocoaTest, NativeBounds); | 72 FRIEND_TEST_ALL_PREFIXES(PanelCocoaTest, NativeBounds); |
| 82 FRIEND_TEST_ALL_PREFIXES(PanelCocoaTest, TitlebarViewCreate); | 73 FRIEND_TEST_ALL_PREFIXES(PanelCocoaTest, TitlebarViewCreate); |
| 83 FRIEND_TEST_ALL_PREFIXES(PanelCocoaTest, TitlebarViewSizing); | 74 FRIEND_TEST_ALL_PREFIXES(PanelCocoaTest, TitlebarViewSizing); |
| 84 FRIEND_TEST_ALL_PREFIXES(PanelCocoaTest, TitlebarViewClose); | 75 FRIEND_TEST_ALL_PREFIXES(PanelCocoaTest, TitlebarViewClose); |
| 85 FRIEND_TEST_ALL_PREFIXES(PanelCocoaTest, MenuItems); | 76 FRIEND_TEST_ALL_PREFIXES(PanelCocoaTest, MenuItems); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 99 // screen coordinates before calling Cocoa API. | 90 // screen coordinates before calling Cocoa API. |
| 100 gfx::Rect bounds_; | 91 gfx::Rect bounds_; |
| 101 | 92 |
| 102 bool is_shown_; // Panel is hidden on creation, Show() changes that forever. | 93 bool is_shown_; // Panel is hidden on creation, Show() changes that forever. |
| 103 NSInteger attention_request_id_; // identifier from requestUserAttention. | 94 NSInteger attention_request_id_; // identifier from requestUserAttention. |
| 104 | 95 |
| 105 DISALLOW_COPY_AND_ASSIGN(PanelCocoa); | 96 DISALLOW_COPY_AND_ASSIGN(PanelCocoa); |
| 106 }; | 97 }; |
| 107 | 98 |
| 108 #endif // CHROME_BROWSER_UI_PANELS_PANEL_COCOA_H_ | 99 #endif // CHROME_BROWSER_UI_PANELS_PANEL_COCOA_H_ |
| OLD | NEW |