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

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

Issue 9416070: Move creation and ownership of HostZoomMap to content instead of having every embedder do this. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix mac/cros browsertests Created 8 years, 10 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/bundle_locations.h" 8 #include "base/mac/bundle_locations.h"
9 #include "base/mac/mac_util.h" 9 #include "base/mac/mac_util.h"
10 #include "base/string16.h" 10 #include "base/string16.h"
11 #include "base/sys_string_conversions.h" 11 #include "base/sys_string_conversions.h"
12 #include "chrome/app/chrome_command_ids.h" 12 #include "chrome/app/chrome_command_ids.h"
13 #import "chrome/browser/app_controller_mac.h" 13 #import "chrome/browser/app_controller_mac.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/ui/browser.h" 15 #include "chrome/browser/ui/browser.h"
16 #include "chrome/browser/ui/browser_window.h" 16 #include "chrome/browser/ui/browser_window.h"
17 #import "chrome/browser/ui/cocoa/accelerators_cocoa.h" 17 #import "chrome/browser/ui/cocoa/accelerators_cocoa.h"
18 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h" 18 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h"
19 #import "chrome/browser/ui/cocoa/encoding_menu_controller_delegate_mac.h" 19 #import "chrome/browser/ui/cocoa/encoding_menu_controller_delegate_mac.h"
20 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" 20 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h"
21 #import "chrome/browser/ui/cocoa/wrench_menu/menu_tracked_root_view.h" 21 #import "chrome/browser/ui/cocoa/wrench_menu/menu_tracked_root_view.h"
22 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" 22 #include "chrome/browser/ui/toolbar/wrench_menu_model.h"
23 #include "content/public/browser/host_zoom_map.h"
23 #include "content/public/browser/notification_observer.h" 24 #include "content/public/browser/notification_observer.h"
24 #include "content/public/browser/notification_service.h" 25 #include "content/public/browser/notification_service.h"
25 #include "content/public/browser/notification_source.h" 26 #include "content/public/browser/notification_source.h"
26 #include "content/public/browser/notification_types.h" 27 #include "content/public/browser/notification_types.h"
27 #include "content/public/browser/user_metrics.h" 28 #include "content/public/browser/user_metrics.h"
28 #include "grit/chromium_strings.h" 29 #include "grit/chromium_strings.h"
29 #include "grit/generated_resources.h" 30 #include "grit/generated_resources.h"
30 #include "ui/base/accelerators/accelerator_cocoa.h" 31 #include "ui/base/accelerators/accelerator_cocoa.h"
31 #include "ui/base/l10n/l10n_util.h" 32 #include "ui/base/l10n/l10n_util.h"
32 #include "ui/base/models/menu_model.h" 33 #include "ui/base/models/menu_model.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 registrar_.Add( 72 registrar_.Add(
72 this, content::NOTIFICATION_ZOOM_LEVEL_CHANGED, 73 this, content::NOTIFICATION_ZOOM_LEVEL_CHANGED,
73 content::NotificationService::AllBrowserContextsAndSources()); 74 content::NotificationService::AllBrowserContextsAndSources());
74 } 75 }
75 76
76 void Observe(int type, 77 void Observe(int type,
77 const content::NotificationSource& source, 78 const content::NotificationSource& source,
78 const content::NotificationDetails& details) { 79 const content::NotificationDetails& details) {
79 DCHECK_EQ(type, content::NOTIFICATION_ZOOM_LEVEL_CHANGED); 80 DCHECK_EQ(type, content::NOTIFICATION_ZOOM_LEVEL_CHANGED);
80 WrenchMenuModel* wrenchMenuModel = [controller_ wrenchMenuModel]; 81 WrenchMenuModel* wrenchMenuModel = [controller_ wrenchMenuModel];
81 if (wrenchMenuModel->browser()->profile()->GetHostZoomMap() != 82 if (HostZoomMap::GetForBrowserContext(
83 wrenchMenuModel->browser()->profile()) !=
82 content::Source<HostZoomMap>(source).ptr()) { 84 content::Source<HostZoomMap>(source).ptr()) {
83 return; 85 return;
84 } 86 }
85 87
86 wrenchMenuModel->UpdateZoomControls(); 88 wrenchMenuModel->UpdateZoomControls();
87 const string16 level = 89 const string16 level =
88 wrenchMenuModel->GetLabelForCommandId(IDC_ZOOM_PERCENT_DISPLAY); 90 wrenchMenuModel->GetLabelForCommandId(IDC_ZOOM_PERCENT_DISPLAY);
89 [[controller_ zoomDisplay] setTitle:SysUTF16ToNSString(level)]; 91 [[controller_ zoomDisplay] setTitle:SysUTF16ToNSString(level)];
90 } 92 }
91 93
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 controller_ = controller; 329 controller_ = controller;
328 } 330 }
329 return self; 331 return self;
330 } 332 }
331 333
332 - (IBAction)dispatchWrenchMenuCommand:(id)sender { 334 - (IBAction)dispatchWrenchMenuCommand:(id)sender {
333 [controller_ dispatchWrenchMenuCommand:sender]; 335 [controller_ dispatchWrenchMenuCommand:sender];
334 } 336 }
335 337
336 @end // @implementation WrenchMenuButtonViewController 338 @end // @implementation WrenchMenuButtonViewController
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_io_data.cc ('k') | chrome/browser/ui/gtk/browser_toolbar_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698