| 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_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 | 7 |
| 8 #include "base/mac/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "chrome/browser/extensions/extension_keybinding_registry.h" | 10 #include "chrome/browser/extensions/extension_keybinding_registry.h" |
| 11 #include "chrome/browser/signin/signin_header_helper.h" | 11 #include "chrome/browser/signin/signin_header_helper.h" |
| 12 #include "chrome/browser/ui/browser_window.h" | 12 #include "chrome/browser/ui/browser_window.h" |
| 13 #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h" |
| 13 #include "chrome/browser/ui/search/search_model_observer.h" | 14 #include "chrome/browser/ui/search/search_model_observer.h" |
| 14 #include "components/bookmarks/browser/bookmark_model.h" | 15 #include "components/bookmarks/browser/bookmark_model.h" |
| 15 #include "ui/base/ui_base_types.h" | 16 #include "ui/base/ui_base_types.h" |
| 16 | 17 |
| 17 class Browser; | 18 class Browser; |
| 18 @class BrowserWindowController; | 19 @class BrowserWindowController; |
| 19 @class FindBarCocoaController; | 20 @class FindBarCocoaController; |
| 20 @class NSEvent; | 21 @class NSEvent; |
| 21 @class NSMenu; | 22 @class NSMenu; |
| 22 @class NSWindow; | 23 @class NSWindow; |
| 23 | 24 |
| 24 namespace extensions { | 25 namespace extensions { |
| 25 class ActiveTabPermissionGranter; | 26 class ActiveTabPermissionGranter; |
| 26 class Command; | 27 class Command; |
| 27 class Extension; | 28 class Extension; |
| 28 } | 29 } |
| 29 | 30 |
| 30 // An implementation of BrowserWindow for Cocoa. Bridges between C++ and | 31 // An implementation of BrowserWindow for Cocoa. Bridges between C++ and |
| 31 // the Cocoa NSWindow. Cross-platform code will interact with this object when | 32 // the Cocoa NSWindow. Cross-platform code will interact with this object when |
| 32 // it needs to manipulate the window. | 33 // it needs to manipulate the window. |
| 33 | 34 |
| 34 class BrowserWindowCocoa : | 35 class BrowserWindowCocoa |
| 35 public BrowserWindow, | 36 : public BrowserWindow, |
| 36 public extensions::ExtensionKeybindingRegistry::Delegate, | 37 public ExclusiveAccessContext, |
| 37 public SearchModelObserver { | 38 public extensions::ExtensionKeybindingRegistry::Delegate, |
| 39 public SearchModelObserver { |
| 38 public: | 40 public: |
| 39 BrowserWindowCocoa(Browser* browser, | 41 BrowserWindowCocoa(Browser* browser, |
| 40 BrowserWindowController* controller); | 42 BrowserWindowController* controller); |
| 41 ~BrowserWindowCocoa() override; | 43 ~BrowserWindowCocoa() override; |
| 42 | 44 |
| 43 // Overridden from BrowserWindow | 45 // Overridden from BrowserWindow |
| 44 void Show() override; | 46 void Show() override; |
| 45 void ShowInactive() override; | 47 void ShowInactive() override; |
| 46 void Hide() override; | 48 void Hide() override; |
| 47 void SetBounds(const gfx::Rect& bounds) override; | 49 void SetBounds(const gfx::Rect& bounds) override; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 71 gfx::Rect GetBounds() const override; | 73 gfx::Rect GetBounds() const override; |
| 72 bool IsMaximized() const override; | 74 bool IsMaximized() const override; |
| 73 bool IsMinimized() const override; | 75 bool IsMinimized() const override; |
| 74 void Maximize() override; | 76 void Maximize() override; |
| 75 void Minimize() override; | 77 void Minimize() override; |
| 76 void Restore() override; | 78 void Restore() override; |
| 77 void EnterFullscreen(const GURL& url, | 79 void EnterFullscreen(const GURL& url, |
| 78 ExclusiveAccessBubbleType type, | 80 ExclusiveAccessBubbleType type, |
| 79 bool with_toolbar) override; | 81 bool with_toolbar) override; |
| 80 void ExitFullscreen() override; | 82 void ExitFullscreen() override; |
| 81 void UpdateFullscreenExitBubbleContent( | 83 void UpdateExclusiveAccessExitBubbleContent( |
| 82 const GURL& url, | 84 const GURL& url, |
| 83 ExclusiveAccessBubbleType bubble_type) override; | 85 ExclusiveAccessBubbleType bubble_type) override; |
| 84 bool ShouldHideUIForFullscreen() const override; | 86 bool ShouldHideUIForFullscreen() const override; |
| 85 bool IsFullscreen() const override; | 87 bool IsFullscreen() const override; |
| 86 bool IsFullscreenBubbleVisible() const override; | 88 bool IsFullscreenBubbleVisible() const override; |
| 87 bool SupportsFullscreenWithToolbar() const override; | 89 bool SupportsFullscreenWithToolbar() const override; |
| 88 void UpdateFullscreenWithToolbar(bool with_toolbar) override; | 90 void UpdateFullscreenWithToolbar(bool with_toolbar) override; |
| 89 bool IsFullscreenWithToolbar() const override; | 91 bool IsFullscreenWithToolbar() const override; |
| 90 LocationBar* GetLocationBar() const override; | 92 LocationBar* GetLocationBar() const override; |
| 91 void SetFocusToLocationBar(bool select_all) override; | 93 void SetFocusToLocationBar(bool select_all) override; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 const gfx::Rect& bounds) override; | 152 const gfx::Rect& bounds) override; |
| 151 FindBar* CreateFindBar() override; | 153 FindBar* CreateFindBar() override; |
| 152 web_modal::WebContentsModalDialogHost* GetWebContentsModalDialogHost() | 154 web_modal::WebContentsModalDialogHost* GetWebContentsModalDialogHost() |
| 153 override; | 155 override; |
| 154 void ShowAvatarBubbleFromAvatarButton( | 156 void ShowAvatarBubbleFromAvatarButton( |
| 155 AvatarBubbleMode mode, | 157 AvatarBubbleMode mode, |
| 156 const signin::ManageAccountsParams& manage_accounts_params) override; | 158 const signin::ManageAccountsParams& manage_accounts_params) override; |
| 157 int GetRenderViewHeightInsetWithDetachedBookmarkBar() override; | 159 int GetRenderViewHeightInsetWithDetachedBookmarkBar() override; |
| 158 void ExecuteExtensionCommand(const extensions::Extension* extension, | 160 void ExecuteExtensionCommand(const extensions::Extension* extension, |
| 159 const extensions::Command& command) override; | 161 const extensions::Command& command) override; |
| 162 ExclusiveAccessContext* GetExclusiveAccessContext() override; |
| 163 |
| 164 // ExclusiveAccessContext interface |
| 165 Profile* GetProfile() override; |
| 166 content::WebContents* GetActiveWebContents() override; |
| 167 void UnhideDownloadShelf() override; |
| 168 void HideDownloadShelf() override; |
| 160 | 169 |
| 161 // Overridden from ExtensionKeybindingRegistry::Delegate: | 170 // Overridden from ExtensionKeybindingRegistry::Delegate: |
| 162 extensions::ActiveTabPermissionGranter* GetActiveTabPermissionGranter() | 171 extensions::ActiveTabPermissionGranter* GetActiveTabPermissionGranter() |
| 163 override; | 172 override; |
| 164 | 173 |
| 165 // Overridden from SearchModelObserver: | 174 // Overridden from SearchModelObserver: |
| 166 void ModelChanged(const SearchModel::State& old_state, | 175 void ModelChanged(const SearchModel::State& old_state, |
| 167 const SearchModel::State& new_state) override; | 176 const SearchModel::State& new_state) override; |
| 168 | 177 |
| 169 // Adds the given FindBar cocoa controller to this browser window. | 178 // Adds the given FindBar cocoa controller to this browser window. |
| 170 void AddFindBar(FindBarCocoaController* find_bar_cocoa_controller); | 179 void AddFindBar(FindBarCocoaController* find_bar_cocoa_controller); |
| 171 | 180 |
| 172 // Returns the cocoa-world BrowserWindowController | 181 // Returns the cocoa-world BrowserWindowController |
| 173 BrowserWindowController* cocoa_controller() { return controller_; } | 182 BrowserWindowController* cocoa_controller() { return controller_; } |
| 174 | 183 |
| 175 protected: | 184 protected: |
| 176 void DestroyBrowser() override; | 185 void DestroyBrowser() override; |
| 177 | 186 |
| 178 private: | 187 private: |
| 179 NSWindow* window() const; // Accessor for the (current) |NSWindow|. | 188 NSWindow* window() const; // Accessor for the (current) |NSWindow|. |
| 180 | 189 |
| 181 Browser* browser_; // weak, owned by controller | 190 Browser* browser_; // weak, owned by controller |
| 182 BrowserWindowController* controller_; // weak, owns us | 191 BrowserWindowController* controller_; // weak, owns us |
| 183 base::scoped_nsobject<NSString> pending_window_title_; | 192 base::scoped_nsobject<NSString> pending_window_title_; |
| 184 ui::WindowShowState initial_show_state_; | 193 ui::WindowShowState initial_show_state_; |
| 185 NSInteger attention_request_id_; // identifier from requestUserAttention | 194 NSInteger attention_request_id_; // identifier from requestUserAttention |
| 186 }; | 195 }; |
| 187 | 196 |
| 188 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_COCOA_H_ | 197 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_COCOA_H_ |
| OLD | NEW |