| 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" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 } | 29 } |
| 30 | 30 |
| 31 // An implementation of BrowserWindow for Cocoa. Bridges between C++ and | 31 // An implementation of BrowserWindow for Cocoa. Bridges between C++ and |
| 32 // 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 |
| 33 // it needs to manipulate the window. | 33 // it needs to manipulate the window. |
| 34 | 34 |
| 35 class BrowserWindowCocoa | 35 class BrowserWindowCocoa |
| 36 : public BrowserWindow, | 36 : public BrowserWindow, |
| 37 public ExclusiveAccessContext, | 37 public ExclusiveAccessContext, |
| 38 public extensions::ExtensionKeybindingRegistry::Delegate, | 38 public extensions::ExtensionKeybindingRegistry::Delegate, |
| 39 public content::NotificationObserver, |
| 39 public SearchModelObserver { | 40 public SearchModelObserver { |
| 40 public: | 41 public: |
| 41 BrowserWindowCocoa(Browser* browser, | 42 BrowserWindowCocoa(Browser* browser, |
| 42 BrowserWindowController* controller); | 43 BrowserWindowController* controller); |
| 43 ~BrowserWindowCocoa() override; | 44 ~BrowserWindowCocoa() override; |
| 44 | 45 |
| 45 // Overridden from BrowserWindow | 46 // Overridden from BrowserWindow |
| 46 void Show() override; | 47 void Show() override; |
| 47 void ShowInactive() override; | 48 void ShowInactive() override; |
| 48 void Hide() override; | 49 void Hide() override; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 FindBar* CreateFindBar() override; | 151 FindBar* CreateFindBar() override; |
| 151 web_modal::WebContentsModalDialogHost* GetWebContentsModalDialogHost() | 152 web_modal::WebContentsModalDialogHost* GetWebContentsModalDialogHost() |
| 152 override; | 153 override; |
| 153 void ShowAvatarBubbleFromAvatarButton( | 154 void ShowAvatarBubbleFromAvatarButton( |
| 154 AvatarBubbleMode mode, | 155 AvatarBubbleMode mode, |
| 155 const signin::ManageAccountsParams& manage_accounts_params) override; | 156 const signin::ManageAccountsParams& manage_accounts_params) override; |
| 156 void CloseAvatarBubbleFromAvatarButton() override; | 157 void CloseAvatarBubbleFromAvatarButton() override; |
| 157 int GetRenderViewHeightInsetWithDetachedBookmarkBar() override; | 158 int GetRenderViewHeightInsetWithDetachedBookmarkBar() override; |
| 158 void ExecuteExtensionCommand(const extensions::Extension* extension, | 159 void ExecuteExtensionCommand(const extensions::Extension* extension, |
| 159 const extensions::Command& command) override; | 160 const extensions::Command& command) override; |
| 161 // content::NotificationObserver overrides: |
| 162 void Observe(int type, |
| 163 const content::NotificationSource& source, |
| 164 const content::NotificationDetails& details) override; |
| 165 |
| 160 ExclusiveAccessContext* GetExclusiveAccessContext() override; | 166 ExclusiveAccessContext* GetExclusiveAccessContext() override; |
| 161 | 167 |
| 162 // ExclusiveAccessContext interface | 168 // ExclusiveAccessContext interface |
| 163 Profile* GetProfile() override; | 169 Profile* GetProfile() override; |
| 164 content::WebContents* GetActiveWebContents() override; | 170 content::WebContents* GetActiveWebContents() override; |
| 165 void UnhideDownloadShelf() override; | 171 void UnhideDownloadShelf() override; |
| 166 void HideDownloadShelf() override; | 172 void HideDownloadShelf() override; |
| 167 | 173 |
| 168 // Overridden from ExtensionKeybindingRegistry::Delegate: | 174 // Overridden from ExtensionKeybindingRegistry::Delegate: |
| 169 extensions::ActiveTabPermissionGranter* GetActiveTabPermissionGranter() | 175 extensions::ActiveTabPermissionGranter* GetActiveTabPermissionGranter() |
| 170 override; | 176 override; |
| 171 | 177 |
| 172 // Overridden from SearchModelObserver: | 178 // Overridden from SearchModelObserver: |
| 173 void ModelChanged(const SearchModel::State& old_state, | 179 void ModelChanged(const SearchModel::State& old_state, |
| 174 const SearchModel::State& new_state) override; | 180 const SearchModel::State& new_state) override; |
| 175 | 181 |
| 176 // Adds the given FindBar cocoa controller to this browser window. | 182 // Adds the given FindBar cocoa controller to this browser window. |
| 177 void AddFindBar(FindBarCocoaController* find_bar_cocoa_controller); | 183 void AddFindBar(FindBarCocoaController* find_bar_cocoa_controller); |
| 178 | 184 |
| 179 // Returns the cocoa-world BrowserWindowController | 185 // Returns the cocoa-world BrowserWindowController |
| 180 BrowserWindowController* cocoa_controller() { return controller_; } | 186 BrowserWindowController* cocoa_controller() { return controller_; } |
| 181 | 187 |
| 182 protected: | 188 protected: |
| 183 void DestroyBrowser() override; | 189 void DestroyBrowser() override; |
| 184 | 190 |
| 185 private: | 191 private: |
| 186 NSWindow* window() const; // Accessor for the (current) |NSWindow|. | 192 NSWindow* window() const; // Accessor for the (current) |NSWindow|. |
| 187 | 193 void UpdateSidebarForContents(content::WebContents* tab_contents); |
| 194 content::NotificationRegistrar registrar_; |
| 188 Browser* browser_; // weak, owned by controller | 195 Browser* browser_; // weak, owned by controller |
| 189 BrowserWindowController* controller_; // weak, owns us | 196 BrowserWindowController* controller_; // weak, owns us |
| 190 base::scoped_nsobject<NSString> pending_window_title_; | 197 base::scoped_nsobject<NSString> pending_window_title_; |
| 191 ui::WindowShowState initial_show_state_; | 198 ui::WindowShowState initial_show_state_; |
| 192 NSInteger attention_request_id_; // identifier from requestUserAttention | 199 NSInteger attention_request_id_; // identifier from requestUserAttention |
| 193 }; | 200 }; |
| 194 | 201 |
| 195 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_COCOA_H_ | 202 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_COCOA_H_ |
| OLD | NEW |