| 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_COCOA_BROWSER_WINDOW_COCOA_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_COCOA_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_COCOA_H_ | 6 #define CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_COCOA_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/memory/scoped_nsobject.h" | 9 #include "base/memory/scoped_nsobject.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // it needs to manipulate the window. | 26 // it needs to manipulate the window. |
| 27 | 27 |
| 28 class BrowserWindowCocoa : public BrowserWindow, | 28 class BrowserWindowCocoa : public BrowserWindow, |
| 29 public content::NotificationObserver { | 29 public content::NotificationObserver { |
| 30 public: | 30 public: |
| 31 BrowserWindowCocoa(Browser* browser, | 31 BrowserWindowCocoa(Browser* browser, |
| 32 BrowserWindowController* controller); | 32 BrowserWindowController* controller); |
| 33 virtual ~BrowserWindowCocoa(); | 33 virtual ~BrowserWindowCocoa(); |
| 34 | 34 |
| 35 // Overridden from BrowserWindow | 35 // Overridden from BrowserWindow |
| 36 virtual void Show(); | 36 virtual void Show() OVERRIDE; |
| 37 virtual void ShowInactive(); | 37 virtual void ShowInactive() OVERRIDE; |
| 38 virtual void SetBounds(const gfx::Rect& bounds); | 38 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; |
| 39 virtual void Close(); | 39 virtual void Close() OVERRIDE; |
| 40 virtual void Activate(); | 40 virtual void Activate() OVERRIDE; |
| 41 virtual void Deactivate(); | 41 virtual void Deactivate() OVERRIDE; |
| 42 virtual bool IsActive() const; | 42 virtual bool IsActive() const OVERRIDE; |
| 43 virtual void FlashFrame(); | 43 virtual void FlashFrame() OVERRIDE; |
| 44 virtual gfx::NativeWindow GetNativeHandle(); | 44 virtual gfx::NativeWindow GetNativeHandle() OVERRIDE; |
| 45 virtual BrowserWindowTesting* GetBrowserWindowTesting(); | 45 virtual BrowserWindowTesting* GetBrowserWindowTesting() OVERRIDE; |
| 46 virtual StatusBubble* GetStatusBubble(); | 46 virtual StatusBubble* GetStatusBubble() OVERRIDE; |
| 47 virtual void ToolbarSizeChanged(bool is_animating); | 47 virtual void ToolbarSizeChanged(bool is_animating) OVERRIDE; |
| 48 virtual void UpdateTitleBar(); | 48 virtual void UpdateTitleBar() OVERRIDE; |
| 49 virtual void BookmarkBarStateChanged( | 49 virtual void BookmarkBarStateChanged( |
| 50 BookmarkBar::AnimateChangeType change_type); | 50 BookmarkBar::AnimateChangeType change_type) OVERRIDE; |
| 51 virtual void UpdateDevTools(); | 51 virtual void UpdateDevTools() OVERRIDE; |
| 52 virtual void UpdateLoadingAnimations(bool should_animate); | 52 virtual void UpdateLoadingAnimations(bool should_animate) OVERRIDE; |
| 53 virtual void SetStarredState(bool is_starred); | 53 virtual void SetStarredState(bool is_starred) OVERRIDE; |
| 54 virtual gfx::Rect GetRestoredBounds() const; | 54 virtual gfx::Rect GetRestoredBounds() const OVERRIDE; |
| 55 virtual gfx::Rect GetBounds() const; | 55 virtual gfx::Rect GetBounds() const OVERRIDE; |
| 56 virtual bool IsMaximized() const; | 56 virtual bool IsMaximized() const OVERRIDE; |
| 57 virtual bool IsMinimized() const; | 57 virtual bool IsMinimized() const OVERRIDE; |
| 58 virtual void EnterFullscreen( | 58 virtual void EnterFullscreen( |
| 59 const GURL& url, FullscreenExitBubbleType type) OVERRIDE; | 59 const GURL& url, FullscreenExitBubbleType type) OVERRIDE; |
| 60 virtual void ExitFullscreen() OVERRIDE; | 60 virtual void ExitFullscreen() OVERRIDE; |
| 61 virtual void UpdateFullscreenExitBubbleContent( | 61 virtual void UpdateFullscreenExitBubbleContent( |
| 62 const GURL& url, | 62 const GURL& url, |
| 63 FullscreenExitBubbleType bubble_type) OVERRIDE; | 63 FullscreenExitBubbleType bubble_type) OVERRIDE; |
| 64 virtual bool IsFullscreen() const; | 64 virtual bool IsFullscreen() const OVERRIDE; |
| 65 virtual bool IsFullscreenBubbleVisible() const; | 65 virtual bool IsFullscreenBubbleVisible() const OVERRIDE; |
| 66 virtual LocationBar* GetLocationBar() const; | 66 virtual LocationBar* GetLocationBar() const OVERRIDE; |
| 67 virtual void SetFocusToLocationBar(bool select_all); | 67 virtual void SetFocusToLocationBar(bool select_all) OVERRIDE; |
| 68 virtual void UpdateReloadStopState(bool is_loading, bool force); | 68 virtual void UpdateReloadStopState(bool is_loading, bool force) OVERRIDE; |
| 69 virtual void UpdateToolbar(TabContentsWrapper* contents, | 69 virtual void UpdateToolbar(TabContentsWrapper* contents, |
| 70 bool should_restore_state); | 70 bool should_restore_state) OVERRIDE; |
| 71 virtual void FocusToolbar(); | 71 virtual void FocusToolbar() OVERRIDE; |
| 72 virtual void FocusAppMenu(); | 72 virtual void FocusAppMenu() OVERRIDE; |
| 73 virtual void FocusBookmarksToolbar(); | 73 virtual void FocusBookmarksToolbar() OVERRIDE; |
| 74 virtual void FocusChromeOSStatus(); | 74 virtual void FocusChromeOSStatus() OVERRIDE; |
| 75 virtual void RotatePaneFocus(bool forwards); | 75 virtual void RotatePaneFocus(bool forwards) OVERRIDE; |
| 76 virtual bool IsBookmarkBarVisible() const; | 76 virtual bool IsBookmarkBarVisible() const OVERRIDE; |
| 77 virtual bool IsBookmarkBarAnimating() const; | 77 virtual bool IsBookmarkBarAnimating() const OVERRIDE; |
| 78 virtual bool IsTabStripEditable() const; | 78 virtual bool IsTabStripEditable() const OVERRIDE; |
| 79 virtual bool IsToolbarVisible() const; | 79 virtual bool IsToolbarVisible() const OVERRIDE; |
| 80 virtual void ConfirmAddSearchProvider(const TemplateURL* template_url, | 80 virtual void ConfirmAddSearchProvider(const TemplateURL* template_url, |
| 81 Profile* profile); | 81 Profile* profile) OVERRIDE; |
| 82 virtual void ToggleBookmarkBar(); | 82 virtual void ToggleBookmarkBar() OVERRIDE; |
| 83 virtual void ShowAboutChromeDialog(); | 83 virtual void ShowAboutChromeDialog() OVERRIDE; |
| 84 virtual void ShowUpdateChromeDialog(); | 84 virtual void ShowUpdateChromeDialog() OVERRIDE; |
| 85 virtual void ShowTaskManager(); | 85 virtual void ShowTaskManager() OVERRIDE; |
| 86 virtual void ShowBackgroundPages(); | 86 virtual void ShowBackgroundPages() OVERRIDE; |
| 87 virtual void ShowBookmarkBubble(const GURL& url, bool already_bookmarked); | 87 virtual void ShowBookmarkBubble(const GURL& url, |
| 88 virtual bool IsDownloadShelfVisible() const; | 88 bool already_bookmarked) OVERRIDE; |
| 89 virtual DownloadShelf* GetDownloadShelf(); | 89 virtual bool IsDownloadShelfVisible() const OVERRIDE; |
| 90 virtual void ShowRepostFormWarningDialog(TabContents* tab_contents); | 90 virtual DownloadShelf* GetDownloadShelf() OVERRIDE; |
| 91 virtual void ShowCollectedCookiesDialog(TabContentsWrapper* wrapper); | 91 virtual void ShowRepostFormWarningDialog(TabContents* tab_contents) OVERRIDE; |
| 92 virtual void ConfirmBrowserCloseWithPendingDownloads(); | 92 virtual void ShowCollectedCookiesDialog(TabContentsWrapper* wrapper) OVERRIDE; |
| 93 virtual void UserChangedTheme(); | 93 virtual void ConfirmBrowserCloseWithPendingDownloads() OVERRIDE; |
| 94 virtual int GetExtraRenderViewHeight() const; | 94 virtual void UserChangedTheme() OVERRIDE; |
| 95 virtual void TabContentsFocused(TabContents* tab_contents); | 95 virtual int GetExtraRenderViewHeight() const OVERRIDE; |
| 96 virtual void TabContentsFocused(TabContents* tab_contents) OVERRIDE; |
| 96 virtual void ShowPageInfo(Profile* profile, | 97 virtual void ShowPageInfo(Profile* profile, |
| 97 const GURL& url, | 98 const GURL& url, |
| 98 const NavigationEntry::SSLStatus& ssl, | 99 const NavigationEntry::SSLStatus& ssl, |
| 99 bool show_history); | 100 bool show_history) OVERRIDE; |
| 100 virtual void ShowAppMenu(); | 101 virtual void ShowAppMenu() OVERRIDE; |
| 101 virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, | 102 virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, |
| 102 bool* is_keyboard_shortcut); | 103 bool* is_keyboard_shortcut) OVERRIDE; |
| 103 virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event); | 104 virtual void HandleKeyboardEvent( |
| 105 const NativeWebKeyboardEvent& event) OVERRIDE; |
| 104 virtual void ShowCreateWebAppShortcutsDialog( | 106 virtual void ShowCreateWebAppShortcutsDialog( |
| 105 TabContentsWrapper* tab_contents); | 107 TabContentsWrapper* tab_contents) OVERRIDE; |
| 106 virtual void ShowCreateChromeAppShortcutsDialog(Profile* profile, | 108 virtual void ShowCreateChromeAppShortcutsDialog( |
| 107 const Extension* app); | 109 Profile* profile, |
| 108 virtual void Cut(); | 110 const Extension* app) OVERRIDE; |
| 109 virtual void Copy(); | 111 virtual void Cut() OVERRIDE; |
| 110 virtual void Paste(); | 112 virtual void Copy() OVERRIDE; |
| 111 virtual void OpenTabpose(); | 113 virtual void Paste() OVERRIDE; |
| 114 virtual void OpenTabpose() OVERRIDE; |
| 112 virtual void EnterPresentationMode( | 115 virtual void EnterPresentationMode( |
| 113 const GURL& url, | 116 const GURL& url, |
| 114 FullscreenExitBubbleType bubble_type) OVERRIDE; | 117 FullscreenExitBubbleType bubble_type) OVERRIDE; |
| 115 virtual void ExitPresentationMode() OVERRIDE; | 118 virtual void ExitPresentationMode() OVERRIDE; |
| 116 virtual bool InPresentationMode(); | 119 virtual bool InPresentationMode() OVERRIDE; |
| 117 virtual void ShowInstant(TabContentsWrapper* preview); | 120 virtual void ShowInstant(TabContentsWrapper* preview) OVERRIDE; |
| 118 virtual void HideInstant(); | 121 virtual void HideInstant() OVERRIDE; |
| 119 virtual gfx::Rect GetInstantBounds(); | 122 virtual gfx::Rect GetInstantBounds() OVERRIDE; |
| 120 virtual WindowOpenDisposition GetDispositionForPopupBounds( | 123 virtual WindowOpenDisposition GetDispositionForPopupBounds( |
| 121 const gfx::Rect& bounds); | 124 const gfx::Rect& bounds) OVERRIDE; |
| 122 virtual FindBar* CreateFindBar() OVERRIDE; | 125 virtual FindBar* CreateFindBar() OVERRIDE; |
| 123 virtual void ShowAvatarBubble(TabContents* tab_contents, | 126 virtual void ShowAvatarBubble(TabContents* tab_contents, |
| 124 const gfx::Rect& rect) OVERRIDE; | 127 const gfx::Rect& rect) OVERRIDE; |
| 125 virtual void ShowAvatarBubbleFromAvatarButton() OVERRIDE; | 128 virtual void ShowAvatarBubbleFromAvatarButton() OVERRIDE; |
| 126 | 129 |
| 127 // Overridden from NotificationObserver | 130 // Overridden from NotificationObserver |
| 128 virtual void Observe(int type, | 131 virtual void Observe(int type, |
| 129 const content::NotificationSource& source, | 132 const content::NotificationSource& source, |
| 130 const content::NotificationDetails& details); | 133 const content::NotificationDetails& details) OVERRIDE; |
| 131 | 134 |
| 132 // Adds the given FindBar cocoa controller to this browser window. | 135 // Adds the given FindBar cocoa controller to this browser window. |
| 133 void AddFindBar(FindBarCocoaController* find_bar_cocoa_controller); | 136 void AddFindBar(FindBarCocoaController* find_bar_cocoa_controller); |
| 134 | 137 |
| 135 // Returns the cocoa-world BrowserWindowController | 138 // Returns the cocoa-world BrowserWindowController |
| 136 BrowserWindowController* cocoa_controller() { return controller_; } | 139 BrowserWindowController* cocoa_controller() { return controller_; } |
| 137 | 140 |
| 138 protected: | 141 protected: |
| 139 virtual void DestroyBrowser(); | 142 virtual void DestroyBrowser() OVERRIDE; |
| 140 | 143 |
| 141 private: | 144 private: |
| 142 NSWindow* window() const; // Accessor for the (current) |NSWindow|. | 145 NSWindow* window() const; // Accessor for the (current) |NSWindow|. |
| 143 void UpdateSidebarForContents(TabContents* tab_contents); | 146 void UpdateSidebarForContents(TabContents* tab_contents); |
| 144 | 147 |
| 145 content::NotificationRegistrar registrar_; | 148 content::NotificationRegistrar registrar_; |
| 146 PrefChangeRegistrar pref_change_registrar_; | 149 PrefChangeRegistrar pref_change_registrar_; |
| 147 Browser* browser_; // weak, owned by controller | 150 Browser* browser_; // weak, owned by controller |
| 148 BrowserWindowController* controller_; // weak, owns us | 151 BrowserWindowController* controller_; // weak, owns us |
| 149 base::WeakPtrFactory<Browser> confirm_close_factory_; | 152 base::WeakPtrFactory<Browser> confirm_close_factory_; |
| 150 scoped_nsobject<NSString> pending_window_title_; | 153 scoped_nsobject<NSString> pending_window_title_; |
| 151 ui::WindowShowState initial_show_state_; | 154 ui::WindowShowState initial_show_state_; |
| 152 }; | 155 }; |
| 153 | 156 |
| 154 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_COCOA_H_ | 157 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_COCOA_H_ |
| OLD | NEW |