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

Side by Side Diff: chrome/browser/ui/cocoa/extensions/browser_action_button.mm

Issue 197333005: Disabled context menu for external component extension icon on MAC (to be consistent with Windows). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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
« no previous file with comments | « no previous file | no next file » | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/extensions/browser_action_button.h" 5 #import "chrome/browser/ui/cocoa/extensions/browser_action_button.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 forButtonState:image_button_cell::kHoverState]; 142 forButtonState:image_button_cell::kHoverState];
143 [cell setImageID:IDR_BROWSER_ACTION_P 143 [cell setImageID:IDR_BROWSER_ACTION_P
144 forButtonState:image_button_cell::kPressedState]; 144 forButtonState:image_button_cell::kPressedState];
145 [cell setImageID:IDR_BROWSER_ACTION 145 [cell setImageID:IDR_BROWSER_ACTION
146 forButtonState:image_button_cell::kDisabledState]; 146 forButtonState:image_button_cell::kDisabledState];
147 147
148 [self setTitle:@""]; 148 [self setTitle:@""];
149 [self setButtonType:NSMomentaryChangeButton]; 149 [self setButtonType:NSMomentaryChangeButton];
150 [self setShowsBorderOnlyWhileMouseInside:YES]; 150 [self setShowsBorderOnlyWhileMouseInside:YES];
151 151
152 contextMenuController_.reset([[ExtensionActionContextMenuController alloc] 152 contextMenuController_.reset([[ExtensionActionContextMenuController alloc]
groby-ooo-7-16 2014/03/25 20:10:10 I believe that can move into the if() too, no?
yefimt 2014/03/25 21:12:17 not sure, in menuNeedsUpdate code expects it exist
groby-ooo-7-16 2014/03/25 21:15:53 menuNeedsUpdate is the menu's delegate. If menu is
yefimt 2014/03/25 21:19:24 Done.
153 initWithExtension:extension 153 initWithExtension:extension
154 browser:browser 154 browser:browser
155 extensionAction:browser_action]); 155 extensionAction:browser_action]);
156 base::scoped_nsobject<NSMenu> contextMenu( 156 if (extension->ShowConfigureContextMenus()) {
157 [[NSMenu alloc] initWithTitle:@""]); 157 base::scoped_nsobject<NSMenu> contextMenu(
158 [contextMenu setDelegate:self]; 158 [[NSMenu alloc] initWithTitle:@""]);
159 [self setMenu:contextMenu]; 159 [contextMenu setDelegate:self];
160 [self setMenu:contextMenu];
161 }
groby-ooo-7-16 2014/03/25 20:10:10 Do we need to reset the menu to nil in an else bra
yefimt 2014/03/25 21:12:17 I don't think it is necessary. It is the only plac
160 162
161 tabId_ = tabId; 163 tabId_ = tabId;
162 extension_ = extension; 164 extension_ = extension;
163 iconFactoryBridge_.reset(new ExtensionActionIconFactoryBridge( 165 iconFactoryBridge_.reset(new ExtensionActionIconFactoryBridge(
164 self, browser->profile(), extension)); 166 self, browser->profile(), extension));
165 167
166 moveAnimation_.reset([[NSViewAnimation alloc] init]); 168 moveAnimation_.reset([[NSViewAnimation alloc] init]);
167 [moveAnimation_ gtm_setDuration:kAnimationDuration 169 [moveAnimation_ gtm_setDuration:kAnimationDuration
168 eventMask:NSLeftMouseUpMask]; 170 eventMask:NSLeftMouseUpMask];
169 [moveAnimation_ setAnimationBlockingMode:NSAnimationNonblocking]; 171 [moveAnimation_ setAnimationBlockingMode:NSAnimationNonblocking];
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 operation:NSCompositeSourceOver 348 operation:NSCompositeSourceOver
347 fraction:enabled ? 1.0 : 0.4 349 fraction:enabled ? 1.0 : 0.4
348 respectFlipped:YES 350 respectFlipped:YES
349 hints:nil]; 351 hints:nil];
350 352
351 cellFrame.origin.y += kBrowserActionBadgeOriginYOffset; 353 cellFrame.origin.y += kBrowserActionBadgeOriginYOffset;
352 [self drawBadgeWithinFrame:cellFrame]; 354 [self drawBadgeWithinFrame:cellFrame];
353 } 355 }
354 356
355 @end 357 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698