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

Side by Side Diff: chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.mm

Issue 8342048: Make NotificationService an interface in the content namespace, and switch callers to use it. Mov... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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 "chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.h" 5 #import "chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/mac/mac_util.h" 8 #include "base/mac/mac_util.h"
9 #include "base/string16.h" 9 #include "base/string16.h"
10 #include "base/sys_string_conversions.h" 10 #include "base/sys_string_conversions.h"
11 #include "chrome/app/chrome_command_ids.h" 11 #include "chrome/app/chrome_command_ids.h"
12 #import "chrome/browser/app_controller_mac.h" 12 #import "chrome/browser/app_controller_mac.h"
13 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
14 #include "chrome/browser/ui/browser_window.h" 14 #include "chrome/browser/ui/browser_window.h"
15 #import "chrome/browser/ui/cocoa/accelerators_cocoa.h" 15 #import "chrome/browser/ui/cocoa/accelerators_cocoa.h"
16 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h" 16 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h"
17 #import "chrome/browser/ui/cocoa/encoding_menu_controller_delegate_mac.h" 17 #import "chrome/browser/ui/cocoa/encoding_menu_controller_delegate_mac.h"
18 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" 18 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h"
19 #import "chrome/browser/ui/cocoa/wrench_menu/menu_tracked_root_view.h" 19 #import "chrome/browser/ui/cocoa/wrench_menu/menu_tracked_root_view.h"
20 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" 20 #include "chrome/browser/ui/toolbar/wrench_menu_model.h"
21 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
22 #include "content/browser/user_metrics.h" 22 #include "content/browser/user_metrics.h"
23 #include "content/public/browser/notification_observer.h" 23 #include "content/public/browser/notification_observer.h"
24 #include "content/common/notification_service.h" 24 #include "content/public/browser/notification_service.h"
25 #include "content/public/browser/notification_source.h" 25 #include "content/public/browser/notification_source.h"
26 #include "content/public/browser/notification_types.h" 26 #include "content/public/browser/notification_types.h"
27 #include "grit/chromium_strings.h" 27 #include "grit/chromium_strings.h"
28 #include "grit/generated_resources.h" 28 #include "grit/generated_resources.h"
29 #include "ui/base/l10n/l10n_util.h" 29 #include "ui/base/l10n/l10n_util.h"
30 #include "ui/base/models/accelerator_cocoa.h" 30 #include "ui/base/models/accelerator_cocoa.h"
31 #include "ui/base/models/menu_model.h" 31 #include "ui/base/models/menu_model.h"
32 32
33 @interface WrenchMenuController (Private) 33 @interface WrenchMenuController (Private)
34 - (void)createModel; 34 - (void)createModel;
(...skipping 22 matching lines...) Expand all
57 return true; 57 return true;
58 } 58 }
59 return false; 59 return false;
60 } 60 }
61 }; 61 };
62 62
63 class ZoomLevelObserver : public content::NotificationObserver { 63 class ZoomLevelObserver : public content::NotificationObserver {
64 public: 64 public:
65 explicit ZoomLevelObserver(WrenchMenuController* controller) 65 explicit ZoomLevelObserver(WrenchMenuController* controller)
66 : controller_(controller) { 66 : controller_(controller) {
67 registrar_.Add(this, content::NOTIFICATION_ZOOM_LEVEL_CHANGED, 67 registrar_.Add(
68 NotificationService::AllBrowserContextsAndSources()); 68 this, content::NOTIFICATION_ZOOM_LEVEL_CHANGED,
69 content::NotificationService::AllBrowserContextsAndSources());
69 } 70 }
70 71
71 void Observe(int type, 72 void Observe(int type,
72 const content::NotificationSource& source, 73 const content::NotificationSource& source,
73 const content::NotificationDetails& details) { 74 const content::NotificationDetails& details) {
74 DCHECK_EQ(type, content::NOTIFICATION_ZOOM_LEVEL_CHANGED); 75 DCHECK_EQ(type, content::NOTIFICATION_ZOOM_LEVEL_CHANGED);
75 WrenchMenuModel* wrenchMenuModel = [controller_ wrenchMenuModel]; 76 WrenchMenuModel* wrenchMenuModel = [controller_ wrenchMenuModel];
76 if (wrenchMenuModel->browser()->profile()->GetHostZoomMap() != 77 if (wrenchMenuModel->browser()->profile()->GetHostZoomMap() !=
77 content::Source<HostZoomMap>(source).ptr()) { 78 content::Source<HostZoomMap>(source).ptr()) {
78 return; 79 return;
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 controller_ = controller; 329 controller_ = controller;
329 } 330 }
330 return self; 331 return self;
331 } 332 }
332 333
333 - (IBAction)dispatchWrenchMenuCommand:(id)sender { 334 - (IBAction)dispatchWrenchMenuCommand:(id)sender {
334 [controller_ dispatchWrenchMenuCommand:sender]; 335 [controller_ dispatchWrenchMenuCommand:sender];
335 } 336 }
336 337
337 @end // @implementation WrenchMenuButtonViewController 338 @end // @implementation WrenchMenuButtonViewController
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698