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

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

Issue 8919017: Split UserMetrics into API vs. implementation. Move API to content/public. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Version for commit (merged again). Created 9 years 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/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/ui/browser.h" 14 #include "chrome/browser/ui/browser.h"
15 #include "chrome/browser/ui/browser_window.h" 15 #include "chrome/browser/ui/browser_window.h"
16 #import "chrome/browser/ui/cocoa/accelerators_cocoa.h" 16 #import "chrome/browser/ui/cocoa/accelerators_cocoa.h"
17 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h" 17 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h"
18 #import "chrome/browser/ui/cocoa/encoding_menu_controller_delegate_mac.h" 18 #import "chrome/browser/ui/cocoa/encoding_menu_controller_delegate_mac.h"
19 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" 19 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h"
20 #import "chrome/browser/ui/cocoa/wrench_menu/menu_tracked_root_view.h" 20 #import "chrome/browser/ui/cocoa/wrench_menu/menu_tracked_root_view.h"
21 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" 21 #include "chrome/browser/ui/toolbar/wrench_menu_model.h"
22 #include "content/browser/user_metrics.h"
23 #include "content/public/browser/notification_observer.h" 22 #include "content/public/browser/notification_observer.h"
24 #include "content/public/browser/notification_service.h" 23 #include "content/public/browser/notification_service.h"
25 #include "content/public/browser/notification_source.h" 24 #include "content/public/browser/notification_source.h"
26 #include "content/public/browser/notification_types.h" 25 #include "content/public/browser/notification_types.h"
26 #include "content/public/browser/user_metrics.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/accelerators/accelerator_cocoa.h" 29 #include "ui/base/accelerators/accelerator_cocoa.h"
30 #include "ui/base/l10n/l10n_util.h" 30 #include "ui/base/l10n/l10n_util.h"
31 #include "ui/base/models/menu_model.h" 31 #include "ui/base/models/menu_model.h"
32 32
33 using content::UserMetricsAction;
34
33 @interface WrenchMenuController (Private) 35 @interface WrenchMenuController (Private)
34 - (void)createModel; 36 - (void)createModel;
35 - (void)adjustPositioning; 37 - (void)adjustPositioning;
36 - (void)performCommandDispatch:(NSNumber*)tag; 38 - (void)performCommandDispatch:(NSNumber*)tag;
37 - (NSButton*)zoomDisplay; 39 - (NSButton*)zoomDisplay;
38 - (void)removeAllItems:(NSMenu*)menu; 40 - (void)removeAllItems:(NSMenu*)menu;
39 @end 41 @end
40 42
41 namespace WrenchMenuControllerInternal { 43 namespace WrenchMenuControllerInternal {
42 44
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 bookmarkMenu)); 163 bookmarkMenu));
162 } 164 }
163 165
164 - (void)menuWillOpen:(NSMenu*)menu { 166 - (void)menuWillOpen:(NSMenu*)menu {
165 [super menuWillOpen:menu]; 167 [super menuWillOpen:menu];
166 168
167 NSString* title = base::SysUTF16ToNSString( 169 NSString* title = base::SysUTF16ToNSString(
168 [self wrenchMenuModel]->GetLabelForCommandId(IDC_ZOOM_PERCENT_DISPLAY)); 170 [self wrenchMenuModel]->GetLabelForCommandId(IDC_ZOOM_PERCENT_DISPLAY));
169 [[[buttonViewController_ zoomItem] viewWithTag:IDC_ZOOM_PERCENT_DISPLAY] 171 [[[buttonViewController_ zoomItem] viewWithTag:IDC_ZOOM_PERCENT_DISPLAY]
170 setTitle:title]; 172 setTitle:title];
171 UserMetrics::RecordAction(UserMetricsAction("ShowAppMenu")); 173 content::RecordAction(UserMetricsAction("ShowAppMenu"));
172 174
173 NSImage* icon = [self wrenchMenuModel]->browser()->window()->IsFullscreen() ? 175 NSImage* icon = [self wrenchMenuModel]->browser()->window()->IsFullscreen() ?
174 [NSImage imageNamed:NSImageNameExitFullScreenTemplate] : 176 [NSImage imageNamed:NSImageNameExitFullScreenTemplate] :
175 [NSImage imageNamed:NSImageNameEnterFullScreenTemplate]; 177 [NSImage imageNamed:NSImageNameEnterFullScreenTemplate];
176 [[buttonViewController_ zoomFullScreen] setImage:icon]; 178 [[buttonViewController_ zoomFullScreen] setImage:icon];
177 } 179 }
178 180
179 - (void)menuNeedsUpdate:(NSMenu*)menu { 181 - (void)menuNeedsUpdate:(NSMenu*)menu {
180 // First empty out the menu and create a new model. 182 // First empty out the menu and create a new model.
181 [self removeAllItems:menu]; 183 [self removeAllItems:menu];
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 controller_ = controller; 325 controller_ = controller;
324 } 326 }
325 return self; 327 return self;
326 } 328 }
327 329
328 - (IBAction)dispatchWrenchMenuCommand:(id)sender { 330 - (IBAction)dispatchWrenchMenuCommand:(id)sender {
329 [controller_ dispatchWrenchMenuCommand:sender]; 331 [controller_ dispatchWrenchMenuCommand:sender];
330 } 332 }
331 333
332 @end // @implementation WrenchMenuButtonViewController 334 @end // @implementation WrenchMenuButtonViewController
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698