Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(273)

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_cocoa.h

Issue 11345008: Remove content::NotificationObserver dependency from most Prefs code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head for commit Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/prefs/public/pref_change_registrar.h" 10 #include "base/prefs/public/pref_change_registrar.h"
11 #include "base/prefs/public/pref_observer.h"
11 #include "chrome/browser/bookmarks/bookmark_model.h" 12 #include "chrome/browser/bookmarks/bookmark_model.h"
12 #include "chrome/browser/extensions/extension_keybinding_registry.h" 13 #include "chrome/browser/extensions/extension_keybinding_registry.h"
13 #include "chrome/browser/ui/browser_window.h" 14 #include "chrome/browser/ui/browser_window.h"
14 #include "content/public/browser/notification_registrar.h"
15 #include "ui/base/ui_base_types.h" 15 #include "ui/base/ui_base_types.h"
16 16
17 class Browser; 17 class Browser;
18 @class BrowserWindowController; 18 @class BrowserWindowController;
19 @class FindBarCocoaController; 19 @class FindBarCocoaController;
20 @class NSEvent; 20 @class NSEvent;
21 @class NSMenu; 21 @class NSMenu;
22 @class NSWindow; 22 @class NSWindow;
23 23
24 namespace extensions { 24 namespace extensions {
25 class ActiveTabPermissionGranter; 25 class ActiveTabPermissionGranter;
26 class Extension; 26 class Extension;
27 } 27 }
28 28
29 // An implementation of BrowserWindow for Cocoa. Bridges between C++ and 29 // An implementation of BrowserWindow for Cocoa. Bridges between C++ and
30 // the Cocoa NSWindow. Cross-platform code will interact with this object when 30 // the Cocoa NSWindow. Cross-platform code will interact with this object when
31 // it needs to manipulate the window. 31 // it needs to manipulate the window.
32 32
33 class BrowserWindowCocoa : 33 class BrowserWindowCocoa :
34 public BrowserWindow, 34 public BrowserWindow,
35 public content::NotificationObserver, 35 public PrefObserver,
36 public extensions::ExtensionKeybindingRegistry::Delegate { 36 public extensions::ExtensionKeybindingRegistry::Delegate {
37 public: 37 public:
38 BrowserWindowCocoa(Browser* browser, 38 BrowserWindowCocoa(Browser* browser,
39 BrowserWindowController* controller); 39 BrowserWindowController* controller);
40 virtual ~BrowserWindowCocoa(); 40 virtual ~BrowserWindowCocoa();
41 41
42 // Overridden from BrowserWindow 42 // Overridden from BrowserWindow
43 virtual void Show() OVERRIDE; 43 virtual void Show() OVERRIDE;
44 virtual void ShowInactive() OVERRIDE; 44 virtual void ShowInactive() OVERRIDE;
45 virtual void Hide() OVERRIDE; 45 virtual void Hide() OVERRIDE;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 virtual bool IsInstantTabShowing() OVERRIDE; 140 virtual bool IsInstantTabShowing() OVERRIDE;
141 virtual WindowOpenDisposition GetDispositionForPopupBounds( 141 virtual WindowOpenDisposition GetDispositionForPopupBounds(
142 const gfx::Rect& bounds) OVERRIDE; 142 const gfx::Rect& bounds) OVERRIDE;
143 virtual FindBar* CreateFindBar() OVERRIDE; 143 virtual FindBar* CreateFindBar() OVERRIDE;
144 virtual bool GetConstrainedWindowTopY(int* top_y) OVERRIDE; 144 virtual bool GetConstrainedWindowTopY(int* top_y) OVERRIDE;
145 virtual void ShowAvatarBubble(content::WebContents* web_contents, 145 virtual void ShowAvatarBubble(content::WebContents* web_contents,
146 const gfx::Rect& rect) OVERRIDE; 146 const gfx::Rect& rect) OVERRIDE;
147 virtual void ShowAvatarBubbleFromAvatarButton() OVERRIDE; 147 virtual void ShowAvatarBubbleFromAvatarButton() OVERRIDE;
148 148
149 // Overridden from NotificationObserver 149 // Overridden from NotificationObserver
150 virtual void Observe(int type, 150 virtual void OnPreferenceChanged(PrefServiceBase* service,
151 const content::NotificationSource& source, 151 const std::string& pref_name) OVERRIDE;
152 const content::NotificationDetails& details) OVERRIDE;
153 152
154 // Overridden from ExtensionKeybindingRegistry::Delegate: 153 // Overridden from ExtensionKeybindingRegistry::Delegate:
155 virtual extensions::ActiveTabPermissionGranter* 154 virtual extensions::ActiveTabPermissionGranter*
156 GetActiveTabPermissionGranter() OVERRIDE; 155 GetActiveTabPermissionGranter() OVERRIDE;
157 156
158 // Adds the given FindBar cocoa controller to this browser window. 157 // Adds the given FindBar cocoa controller to this browser window.
159 void AddFindBar(FindBarCocoaController* find_bar_cocoa_controller); 158 void AddFindBar(FindBarCocoaController* find_bar_cocoa_controller);
160 159
161 // Returns the cocoa-world BrowserWindowController 160 // Returns the cocoa-world BrowserWindowController
162 BrowserWindowController* cocoa_controller() { return controller_; } 161 BrowserWindowController* cocoa_controller() { return controller_; }
163 162
164 protected: 163 protected:
165 virtual void DestroyBrowser() OVERRIDE; 164 virtual void DestroyBrowser() OVERRIDE;
166 165
167 private: 166 private:
168 NSWindow* window() const; // Accessor for the (current) |NSWindow|. 167 NSWindow* window() const; // Accessor for the (current) |NSWindow|.
169 168
170 content::NotificationRegistrar registrar_;
171 PrefChangeRegistrar pref_change_registrar_; 169 PrefChangeRegistrar pref_change_registrar_;
172 Browser* browser_; // weak, owned by controller 170 Browser* browser_; // weak, owned by controller
173 BrowserWindowController* controller_; // weak, owns us 171 BrowserWindowController* controller_; // weak, owns us
174 base::WeakPtrFactory<Browser> confirm_close_factory_; 172 base::WeakPtrFactory<Browser> confirm_close_factory_;
175 scoped_nsobject<NSString> pending_window_title_; 173 scoped_nsobject<NSString> pending_window_title_;
176 ui::WindowShowState initial_show_state_; 174 ui::WindowShowState initial_show_state_;
177 NSInteger attention_request_id_; // identifier from requestUserAttention 175 NSInteger attention_request_id_; // identifier from requestUserAttention
178 }; 176 };
179 177
180 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_COCOA_H_ 178 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_COCOA_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_instant_controller.cc ('k') | chrome/browser/ui/cocoa/browser_window_cocoa.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698