| OLD | NEW |
| 1 // Copyright (c) 2010 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_controller.h" | 5 #import "chrome/browser/ui/cocoa/wrench_menu_controller.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/menus/menu_model.h" | 8 #include "app/menus/menu_model.h" |
| 9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
| 10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
| 11 #include "chrome/browser/background_page_tracker.h" | 11 #include "chrome/browser/background_page_tracker.h" |
| 12 #include "chrome/browser/metrics/user_metrics.h" |
| 12 #import "chrome/browser/ui/cocoa/menu_tracked_root_view.h" | 13 #import "chrome/browser/ui/cocoa/menu_tracked_root_view.h" |
| 13 #import "chrome/browser/ui/cocoa/toolbar_controller.h" | 14 #import "chrome/browser/ui/cocoa/toolbar_controller.h" |
| 14 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
| 15 #include "chrome/browser/ui/browser_window.h" | 16 #include "chrome/browser/ui/browser_window.h" |
| 16 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" | 17 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" |
| 17 #include "chrome/common/notification_observer.h" | 18 #include "chrome/common/notification_observer.h" |
| 18 #include "chrome/common/notification_service.h" | 19 #include "chrome/common/notification_service.h" |
| 19 #include "chrome/common/notification_source.h" | 20 #include "chrome/common/notification_source.h" |
| 20 #include "chrome/common/notification_type.h" | 21 #include "chrome/common/notification_type.h" |
| 21 #include "grit/chromium_strings.h" | 22 #include "grit/chromium_strings.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 if (![menu delegate]) { | 109 if (![menu delegate]) { |
| 109 [menu setDelegate:self]; | 110 [menu setDelegate:self]; |
| 110 } | 111 } |
| 111 return menu; | 112 return menu; |
| 112 } | 113 } |
| 113 | 114 |
| 114 - (void)menuWillOpen:(NSMenu*)menu { | 115 - (void)menuWillOpen:(NSMenu*)menu { |
| 115 NSString* title = base::SysUTF16ToNSString( | 116 NSString* title = base::SysUTF16ToNSString( |
| 116 [self wrenchMenuModel]->GetLabelForCommandId(IDC_ZOOM_PERCENT_DISPLAY)); | 117 [self wrenchMenuModel]->GetLabelForCommandId(IDC_ZOOM_PERCENT_DISPLAY)); |
| 117 [[zoomItem_ viewWithTag:IDC_ZOOM_PERCENT_DISPLAY] setTitle:title]; | 118 [[zoomItem_ viewWithTag:IDC_ZOOM_PERCENT_DISPLAY] setTitle:title]; |
| 119 UserMetrics::RecordAction(UserMetricsAction("ShowAppMenu")); |
| 118 | 120 |
| 119 NSImage* icon = [self wrenchMenuModel]->browser()->window()->IsFullscreen() ? | 121 NSImage* icon = [self wrenchMenuModel]->browser()->window()->IsFullscreen() ? |
| 120 [NSImage imageNamed:NSImageNameExitFullScreenTemplate] : | 122 [NSImage imageNamed:NSImageNameExitFullScreenTemplate] : |
| 121 [NSImage imageNamed:NSImageNameEnterFullScreenTemplate]; | 123 [NSImage imageNamed:NSImageNameEnterFullScreenTemplate]; |
| 122 [zoomFullScreen_ setImage:icon]; | 124 [zoomFullScreen_ setImage:icon]; |
| 123 } | 125 } |
| 124 | 126 |
| 125 - (void)menuDidClose:(NSMenu*)menu { | 127 - (void)menuDidClose:(NSMenu*)menu { |
| 126 // When the menu is closed, acknowledge the background pages so the badges go | 128 // When the menu is closed, acknowledge the background pages so the badges go |
| 127 // away. | 129 // away. |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 parentFrame.size.width += delta; | 213 parentFrame.size.width += delta; |
| 212 parentFrame.origin.x -= delta; | 214 parentFrame.origin.x -= delta; |
| 213 [[editCut_ superview] setFrame:parentFrame]; | 215 [[editCut_ superview] setFrame:parentFrame]; |
| 214 } | 216 } |
| 215 | 217 |
| 216 - (NSButton*)zoomDisplay { | 218 - (NSButton*)zoomDisplay { |
| 217 return zoomDisplay_; | 219 return zoomDisplay_; |
| 218 } | 220 } |
| 219 | 221 |
| 220 @end // @implementation WrenchMenuController | 222 @end // @implementation WrenchMenuController |
| OLD | NEW |