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

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

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "browser_actions_controller.h" 5 #import "browser_actions_controller.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <string> 8 #include <string>
9 9
10 #include "base/sys_string_conversions.h" 10 #include "base/sys_string_conversions.h"
11 #include "chrome/browser/extensions/extension_browser_event_router.h" 11 #include "chrome/browser/extensions/extension_browser_event_router.h"
12 #include "chrome/browser/extensions/extension_service.h" 12 #include "chrome/browser/extensions/extension_service.h"
13 #include "chrome/browser/extensions/extension_toolbar_model.h" 13 #include "chrome/browser/extensions/extension_toolbar_model.h"
14 #include "chrome/browser/prefs/pref_service.h" 14 #include "chrome/browser/prefs/pref_service.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/sessions/restore_tab_helper.h" 16 #include "chrome/browser/sessions/restore_tab_helper.h"
17 #include "chrome/browser/ui/browser.h" 17 #include "chrome/browser/ui/browser.h"
18 #import "chrome/browser/ui/cocoa/extensions/browser_action_button.h" 18 #import "chrome/browser/ui/cocoa/extensions/browser_action_button.h"
19 #import "chrome/browser/ui/cocoa/extensions/browser_actions_container_view.h" 19 #import "chrome/browser/ui/cocoa/extensions/browser_actions_container_view.h"
20 #import "chrome/browser/ui/cocoa/extensions/chevron_menu_button.h" 20 #import "chrome/browser/ui/cocoa/extensions/chevron_menu_button.h"
21 #import "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h" 21 #import "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h"
22 #import "chrome/browser/ui/cocoa/image_button_cell.h" 22 #import "chrome/browser/ui/cocoa/image_button_cell.h"
23 #import "chrome/browser/ui/cocoa/menu_button.h" 23 #import "chrome/browser/ui/cocoa/menu_button.h"
24 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 24 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
25 #include "chrome/common/chrome_notification_types.h"
25 #include "chrome/common/extensions/extension_action.h" 26 #include "chrome/common/extensions/extension_action.h"
26 #include "chrome/common/pref_names.h" 27 #include "chrome/common/pref_names.h"
27 #include "content/browser/tab_contents/tab_contents.h" 28 #include "content/browser/tab_contents/tab_contents.h"
28 #include "content/common/notification_details.h" 29 #include "content/common/notification_details.h"
29 #include "content/common/notification_observer.h" 30 #include "content/common/notification_observer.h"
30 #include "content/common/notification_registrar.h" 31 #include "content/common/notification_registrar.h"
31 #include "content/common/notification_source.h" 32 #include "content/common/notification_source.h"
32 #include "grit/theme_resources.h" 33 #include "grit/theme_resources.h"
33 #include "grit/theme_resources_standard.h" 34 #include "grit/theme_resources_standard.h"
34 #import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h" 35 #import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 - (int)currentTabId; 177 - (int)currentTabId;
177 @end 178 @end
178 179
179 // A helper class to proxy extension notifications to the view controller's 180 // A helper class to proxy extension notifications to the view controller's
180 // appropriate methods. 181 // appropriate methods.
181 class ExtensionServiceObserverBridge : public NotificationObserver, 182 class ExtensionServiceObserverBridge : public NotificationObserver,
182 public ExtensionToolbarModel::Observer { 183 public ExtensionToolbarModel::Observer {
183 public: 184 public:
184 ExtensionServiceObserverBridge(BrowserActionsController* owner, 185 ExtensionServiceObserverBridge(BrowserActionsController* owner,
185 Profile* profile) : owner_(owner) { 186 Profile* profile) : owner_(owner) {
186 registrar_.Add(this, NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE, 187 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE,
187 Source<Profile>(profile)); 188 Source<Profile>(profile));
188 } 189 }
189 190
190 // Overridden from NotificationObserver. 191 // Overridden from NotificationObserver.
191 void Observe(NotificationType type, 192 void Observe(int type,
192 const NotificationSource& source, 193 const NotificationSource& source,
193 const NotificationDetails& details) { 194 const NotificationDetails& details) {
194 switch (type.value) { 195 switch (type) {
195 case NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE: { 196 case chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE: {
196 ExtensionPopupController* popup = [ExtensionPopupController popup]; 197 ExtensionPopupController* popup = [ExtensionPopupController popup];
197 if (popup && ![popup isClosing]) 198 if (popup && ![popup isClosing])
198 [popup close]; 199 [popup close];
199 200
200 break; 201 break;
201 } 202 }
202 default: 203 default:
203 NOTREACHED() << L"Unexpected notification"; 204 NOTREACHED() << L"Unexpected notification";
204 } 205 }
205 } 206 }
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 if (profile_->IsOffTheRecord()) 860 if (profile_->IsOffTheRecord())
860 index = toolbarModel_->IncognitoIndexToOriginal(index); 861 index = toolbarModel_->IncognitoIndexToOriginal(index);
861 if (index < toolbarModel_->size()) { 862 if (index < toolbarModel_->size()) {
862 const Extension* extension = toolbarModel_->GetExtensionByIndex(index); 863 const Extension* extension = toolbarModel_->GetExtensionByIndex(index);
863 return [buttons_ objectForKey:base::SysUTF8ToNSString(extension->id())]; 864 return [buttons_ objectForKey:base::SysUTF8ToNSString(extension->id())];
864 } 865 }
865 return nil; 866 return nil;
866 } 867 }
867 868
868 @end 869 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698