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

Side by Side Diff: chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm

Issue 425303002: Move extension notifications to extensions/browser/notification_types.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: (extension-notifications) rebase Created 6 years, 4 months 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 #import "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h" 5 #import "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <string> 8 #include <string>
9 9
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 177
178 // A helper class to proxy extension notifications to the view controller's 178 // A helper class to proxy extension notifications to the view controller's
179 // appropriate methods. 179 // appropriate methods.
180 class ExtensionServiceObserverBridge 180 class ExtensionServiceObserverBridge
181 : public content::NotificationObserver, 181 : public content::NotificationObserver,
182 public extensions::ExtensionToolbarModel::Observer { 182 public extensions::ExtensionToolbarModel::Observer {
183 public: 183 public:
184 ExtensionServiceObserverBridge(BrowserActionsController* owner, 184 ExtensionServiceObserverBridge(BrowserActionsController* owner,
185 Browser* browser) 185 Browser* browser)
186 : owner_(owner), browser_(browser) { 186 : owner_(owner), browser_(browser) {
187 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, 187 registrar_.Add(this,
188 extensions::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE,
188 content::Source<Profile>(browser->profile())); 189 content::Source<Profile>(browser->profile()));
189 registrar_.Add(this, 190 registrar_.Add(
190 chrome::NOTIFICATION_EXTENSION_COMMAND_BROWSER_ACTION_MAC, 191 this,
191 content::Source<Profile>(browser->profile())); 192 extensions::NOTIFICATION_EXTENSION_COMMAND_BROWSER_ACTION_MAC,
193 content::Source<Profile>(browser->profile()));
192 } 194 }
193 195
194 // Overridden from content::NotificationObserver. 196 // Overridden from content::NotificationObserver.
195 virtual void Observe( 197 virtual void Observe(
196 int type, 198 int type,
197 const content::NotificationSource& source, 199 const content::NotificationSource& source,
198 const content::NotificationDetails& details) OVERRIDE { 200 const content::NotificationDetails& details) OVERRIDE {
199 switch (type) { 201 switch (type) {
200 case chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE: { 202 case extensions::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE: {
201 ExtensionPopupController* popup = [ExtensionPopupController popup]; 203 ExtensionPopupController* popup = [ExtensionPopupController popup];
202 if (popup && ![popup isClosing]) 204 if (popup && ![popup isClosing])
203 [popup close]; 205 [popup close];
204 206
205 break; 207 break;
206 } 208 }
207 case chrome::NOTIFICATION_EXTENSION_COMMAND_BROWSER_ACTION_MAC: { 209 case extensions::NOTIFICATION_EXTENSION_COMMAND_BROWSER_ACTION_MAC: {
208 std::pair<const std::string, gfx::NativeWindow>* payload = 210 std::pair<const std::string, gfx::NativeWindow>* payload =
209 content::Details<std::pair<const std::string, gfx::NativeWindow> >( 211 content::Details<std::pair<const std::string, gfx::NativeWindow> >(
210 details).ptr(); 212 details).ptr();
211 std::string extension_id = payload->first; 213 std::string extension_id = payload->first;
212 gfx::NativeWindow window = payload->second; 214 gfx::NativeWindow window = payload->second;
213 if (window != browser_->window()->GetNativeWindow()) 215 if (window != browser_->window()->GetNativeWindow())
214 break; 216 break;
215 [owner_ activateBrowserAction:extension_id]; 217 [owner_ activateBrowserAction:extension_id];
216 break; 218 break;
217 } 219 }
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 const extensions::ExtensionList& toolbar_items = 886 const extensions::ExtensionList& toolbar_items =
885 toolbarModel_->toolbar_items(); 887 toolbarModel_->toolbar_items();
886 if (index < toolbar_items.size()) { 888 if (index < toolbar_items.size()) {
887 const Extension* extension = toolbar_items[index].get(); 889 const Extension* extension = toolbar_items[index].get();
888 return [buttons_ objectForKey:base::SysUTF8ToNSString(extension->id())]; 890 return [buttons_ objectForKey:base::SysUTF8ToNSString(extension->id())];
889 } 891 }
890 return nil; 892 return nil;
891 } 893 }
892 894
893 @end 895 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698