| OLD | NEW |
| 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 Loading... |
| 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 if (extension->ShowConfigureContextMenus()) { |
| 153 initWithExtension:extension | 153 contextMenuController_.reset([[ExtensionActionContextMenuController alloc] |
| 154 browser:browser | 154 initWithExtension:extension |
| 155 extensionAction:browser_action]); | 155 browser:browser |
| 156 base::scoped_nsobject<NSMenu> contextMenu( | 156 extensionAction:browser_action]); |
| 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 } |
| 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 Loading... |
| 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 |
| OLD | NEW |