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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 virtual void ShowAvatarBubbleFromAvatarButton() OVERRIDE; | 146 virtual void ShowAvatarBubbleFromAvatarButton() OVERRIDE; |
145 virtual void ShowPasswordGenerationBubble( | 147 virtual void ShowPasswordGenerationBubble( |
146 const gfx::Rect& rect, | 148 const gfx::Rect& rect, |
147 const content::PasswordForm& form, | 149 const content::PasswordForm& form, |
148 autofill::PasswordGenerator* password_generator) OVERRIDE; | 150 autofill::PasswordGenerator* password_generator) OVERRIDE; |
149 | 151 |
150 // Overridden from ExtensionKeybindingRegistry::Delegate: | 152 // Overridden from ExtensionKeybindingRegistry::Delegate: |
151 virtual extensions::ActiveTabPermissionGranter* | 153 virtual extensions::ActiveTabPermissionGranter* |
152 GetActiveTabPermissionGranter() OVERRIDE; | 154 GetActiveTabPermissionGranter() OVERRIDE; |
153 | 155 |
| 156 // Overridden from chrome::search::SearchModelObserver: |
| 157 virtual void ModeChanged(const chrome::search::Mode& old_mode, |
| 158 const chrome::search::Mode& new_mode) OVERRIDE; |
| 159 |
154 // Adds the given FindBar cocoa controller to this browser window. | 160 // Adds the given FindBar cocoa controller to this browser window. |
155 void AddFindBar(FindBarCocoaController* find_bar_cocoa_controller); | 161 void AddFindBar(FindBarCocoaController* find_bar_cocoa_controller); |
156 | 162 |
157 // Returns the cocoa-world BrowserWindowController | 163 // Returns the cocoa-world BrowserWindowController |
158 BrowserWindowController* cocoa_controller() { return controller_; } | 164 BrowserWindowController* cocoa_controller() { return controller_; } |
159 | 165 |
160 protected: | 166 protected: |
161 virtual void DestroyBrowser() OVERRIDE; | 167 virtual void DestroyBrowser() OVERRIDE; |
162 | 168 |
163 private: | 169 private: |
164 NSWindow* window() const; // Accessor for the (current) |NSWindow|. | 170 NSWindow* window() const; // Accessor for the (current) |NSWindow|. |
165 | 171 |
166 Browser* browser_; // weak, owned by controller | 172 Browser* browser_; // weak, owned by controller |
167 BrowserWindowController* controller_; // weak, owns us | 173 BrowserWindowController* controller_; // weak, owns us |
168 base::WeakPtrFactory<Browser> confirm_close_factory_; | 174 base::WeakPtrFactory<Browser> confirm_close_factory_; |
169 scoped_nsobject<NSString> pending_window_title_; | 175 scoped_nsobject<NSString> pending_window_title_; |
170 ui::WindowShowState initial_show_state_; | 176 ui::WindowShowState initial_show_state_; |
171 NSInteger attention_request_id_; // identifier from requestUserAttention | 177 NSInteger attention_request_id_; // identifier from requestUserAttention |
172 }; | 178 }; |
173 | 179 |
174 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_COCOA_H_ | 180 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_COCOA_H_ |
OLD | NEW |