| 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/memory/scoped_nsobject.h" | 8 #include "base/memory/scoped_nsobject.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_model.h" | 10 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 11 #include "chrome/browser/extensions/extension_keybinding_registry.h" | 11 #include "chrome/browser/extensions/extension_keybinding_registry.h" |
| 12 #include "chrome/browser/ui/browser_window.h" | 12 #include "chrome/browser/ui/browser_window.h" |
| 13 #include "chrome/browser/ui/search/search_model_observer.h" |
| 13 #include "ui/base/ui_base_types.h" | 14 #include "ui/base/ui_base_types.h" |
| 14 | 15 |
| 15 class Browser; | 16 class Browser; |
| 16 @class BrowserWindowController; | 17 @class BrowserWindowController; |
| 17 @class FindBarCocoaController; | 18 @class FindBarCocoaController; |
| 18 @class NSEvent; | 19 @class NSEvent; |
| 19 @class NSMenu; | 20 @class NSMenu; |
| 20 @class NSWindow; | 21 @class NSWindow; |
| 21 | 22 |
| 22 namespace extensions { | 23 namespace extensions { |
| 23 class ActiveTabPermissionGranter; | 24 class ActiveTabPermissionGranter; |
| 24 class Extension; | 25 class Extension; |
| 25 } | 26 } |
| 26 | 27 |
| 27 // An implementation of BrowserWindow for Cocoa. Bridges between C++ and | 28 // An implementation of BrowserWindow for Cocoa. Bridges between C++ and |
| 28 // the Cocoa NSWindow. Cross-platform code will interact with this object when | 29 // the Cocoa NSWindow. Cross-platform code will interact with this object when |
| 29 // it needs to manipulate the window. | 30 // it needs to manipulate the window. |
| 30 | 31 |
| 31 class BrowserWindowCocoa : | 32 class BrowserWindowCocoa : |
| 32 public BrowserWindow, | 33 public BrowserWindow, |
| 33 public extensions::ExtensionKeybindingRegistry::Delegate { | 34 public extensions::ExtensionKeybindingRegistry::Delegate, |
| 35 public chrome::search::SearchModelObserver { |
| 34 public: | 36 public: |
| 35 BrowserWindowCocoa(Browser* browser, | 37 BrowserWindowCocoa(Browser* browser, |
| 36 BrowserWindowController* controller); | 38 BrowserWindowController* controller); |
| 37 virtual ~BrowserWindowCocoa(); | 39 virtual ~BrowserWindowCocoa(); |
| 38 | 40 |
| 39 // Overridden from BrowserWindow | 41 // Overridden from BrowserWindow |
| 40 virtual void Show() OVERRIDE; | 42 virtual void Show() OVERRIDE; |
| 41 virtual void ShowInactive() OVERRIDE; | 43 virtual void ShowInactive() OVERRIDE; |
| 42 virtual void Hide() OVERRIDE; | 44 virtual void Hide() OVERRIDE; |
| 43 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; | 45 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 virtual void ShowAvatarBubbleFromAvatarButton() OVERRIDE; | 147 virtual void ShowAvatarBubbleFromAvatarButton() OVERRIDE; |
| 146 virtual void ShowPasswordGenerationBubble( | 148 virtual void ShowPasswordGenerationBubble( |
| 147 const gfx::Rect& rect, | 149 const gfx::Rect& rect, |
| 148 const content::PasswordForm& form, | 150 const content::PasswordForm& form, |
| 149 autofill::PasswordGenerator* password_generator) OVERRIDE; | 151 autofill::PasswordGenerator* password_generator) OVERRIDE; |
| 150 | 152 |
| 151 // Overridden from ExtensionKeybindingRegistry::Delegate: | 153 // Overridden from ExtensionKeybindingRegistry::Delegate: |
| 152 virtual extensions::ActiveTabPermissionGranter* | 154 virtual extensions::ActiveTabPermissionGranter* |
| 153 GetActiveTabPermissionGranter() OVERRIDE; | 155 GetActiveTabPermissionGranter() OVERRIDE; |
| 154 | 156 |
| 157 // Overridden from chrome::search::SearchModelObserver: |
| 158 virtual void ModeChanged(const chrome::search::Mode& old_mode, |
| 159 const chrome::search::Mode& new_mode) OVERRIDE; |
| 160 |
| 155 // Adds the given FindBar cocoa controller to this browser window. | 161 // Adds the given FindBar cocoa controller to this browser window. |
| 156 void AddFindBar(FindBarCocoaController* find_bar_cocoa_controller); | 162 void AddFindBar(FindBarCocoaController* find_bar_cocoa_controller); |
| 157 | 163 |
| 158 // Returns the cocoa-world BrowserWindowController | 164 // Returns the cocoa-world BrowserWindowController |
| 159 BrowserWindowController* cocoa_controller() { return controller_; } | 165 BrowserWindowController* cocoa_controller() { return controller_; } |
| 160 | 166 |
| 161 protected: | 167 protected: |
| 162 virtual void DestroyBrowser() OVERRIDE; | 168 virtual void DestroyBrowser() OVERRIDE; |
| 163 | 169 |
| 164 private: | 170 private: |
| 165 NSWindow* window() const; // Accessor for the (current) |NSWindow|. | 171 NSWindow* window() const; // Accessor for the (current) |NSWindow|. |
| 166 | 172 |
| 167 Browser* browser_; // weak, owned by controller | 173 Browser* browser_; // weak, owned by controller |
| 168 BrowserWindowController* controller_; // weak, owns us | 174 BrowserWindowController* controller_; // weak, owns us |
| 169 base::WeakPtrFactory<Browser> confirm_close_factory_; | 175 base::WeakPtrFactory<Browser> confirm_close_factory_; |
| 170 scoped_nsobject<NSString> pending_window_title_; | 176 scoped_nsobject<NSString> pending_window_title_; |
| 171 ui::WindowShowState initial_show_state_; | 177 ui::WindowShowState initial_show_state_; |
| 172 NSInteger attention_request_id_; // identifier from requestUserAttention | 178 NSInteger attention_request_id_; // identifier from requestUserAttention |
| 173 }; | 179 }; |
| 174 | 180 |
| 175 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_COCOA_H_ | 181 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_COCOA_H_ |
| OLD | NEW |