Chromium Code Reviews

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

Issue 3026025: The Mac wrench menu zoom controls honor the global enabled state of the zoom commands. (Closed)
Patch Set: Removed unneeded disabling of percentage display. Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « app/menus/button_menu_item_model.cc ('k') | chrome/browser/wrench_menu_model.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/cocoa/wrench_menu_controller.h" 5 #import "chrome/browser/cocoa/wrench_menu_controller.h"
6 6
7 #include "app/menus/menu_model.h" 7 #include "app/menus/menu_model.h"
8 #include "base/sys_string_conversions.h" 8 #include "base/sys_string_conversions.h"
9 #include "chrome/app/chrome_dll_resource.h" 9 #include "chrome/app/chrome_dll_resource.h"
10 #include "chrome/browser/browser.h" 10 #include "chrome/browser/browser.h"
(...skipping 56 matching lines...)
67 if (![menu delegate]) { 67 if (![menu delegate]) {
68 [menu setDelegate:self]; 68 [menu setDelegate:self];
69 } 69 }
70 return menu; 70 return menu;
71 } 71 }
72 72
73 - (void)menuWillOpen:(NSMenu*)menu { 73 - (void)menuWillOpen:(NSMenu*)menu {
74 NSString* title = base::SysUTF16ToNSString( 74 NSString* title = base::SysUTF16ToNSString(
75 [self wrenchMenuModel]->GetLabelForCommandId(IDC_ZOOM_PERCENT_DISPLAY)); 75 [self wrenchMenuModel]->GetLabelForCommandId(IDC_ZOOM_PERCENT_DISPLAY));
76 [[zoomItem_ viewWithTag:IDC_ZOOM_PERCENT_DISPLAY] setTitle:title]; 76 [[zoomItem_ viewWithTag:IDC_ZOOM_PERCENT_DISPLAY] setTitle:title];
77 bool plusEnabled = [self wrenchMenuModel]->IsCommandIdEnabled(IDC_ZOOM_PLUS);
78 bool minusEnabled = [self wrenchMenuModel]->IsCommandIdEnabled(
79 IDC_ZOOM_MINUS);
80
81 [zoomPlus_ setEnabled:plusEnabled];
82 [zoomMinus_ setEnabled:minusEnabled];
77 83
78 NSImage* icon = [self wrenchMenuModel]->browser()->window()->IsFullscreen() ? 84 NSImage* icon = [self wrenchMenuModel]->browser()->window()->IsFullscreen() ?
79 [NSImage imageNamed:NSImageNameExitFullScreenTemplate] : 85 [NSImage imageNamed:NSImageNameExitFullScreenTemplate] :
80 [NSImage imageNamed:NSImageNameEnterFullScreenTemplate]; 86 [NSImage imageNamed:NSImageNameEnterFullScreenTemplate];
81 [zoomFullScreen_ setImage:icon]; 87 [zoomFullScreen_ setImage:icon];
82 } 88 }
83 89
84 // Used to dispatch commands from the Wrench menu. The custom items within the 90 // Used to dispatch commands from the Wrench menu. The custom items within the
85 // menu cannot be hooked up directly to First Responder because the window in 91 // menu cannot be hooked up directly to First Responder because the window in
86 // which the controls reside is not the BrowserWindowController, but a 92 // which the controls reside is not the BrowserWindowController, but a
(...skipping 49 matching lines...)
136 // of the segmented control. 142 // of the segmented control.
137 itemFrame.size.width += resizeAmount; 143 itemFrame.size.width += resizeAmount;
138 [editItem_ setFrame:itemFrame]; 144 [editItem_ setFrame:itemFrame];
139 145
140 // Keep the spacing between the right edges of the menu and the control. 146 // Keep the spacing between the right edges of the menu and the control.
141 controlFrame.origin.x = NSWidth(itemFrame) - edge - NSWidth(controlFrame); 147 controlFrame.origin.x = NSWidth(itemFrame) - edge - NSWidth(controlFrame);
142 [editControl_ setFrame:controlFrame]; 148 [editControl_ setFrame:controlFrame];
143 } 149 }
144 150
145 @end // @implementation WrenchMenuController 151 @end // @implementation WrenchMenuController
OLDNEW
« no previous file with comments | « app/menus/button_menu_item_model.cc ('k') | chrome/browser/wrench_menu_model.h » ('j') | no next file with comments »

Powered by Google App Engine