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

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

Issue 10700007: Page actions behave as disableable browser actions when script badges are enabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: estade + sky Created 8 years, 5 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
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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 SkBitmap image = extension_->browser_action()->GetIcon(tabId_); 266 SkBitmap image = extension_->browser_action()->GetIcon(tabId_);
267 if (!image.isNull()) { 267 if (!image.isNull()) {
268 [self setTabSpecificIcon:gfx::SkBitmapToNSImage(image)]; 268 [self setTabSpecificIcon:gfx::SkBitmapToNSImage(image)];
269 [self setImage:tabSpecificIcon_]; 269 [self setImage:tabSpecificIcon_];
270 } else if (defaultIcon_) { 270 } else if (defaultIcon_) {
271 [self setImage:defaultIcon_]; 271 [self setImage:defaultIcon_];
272 } 272 }
273 273
274 [[self cell] setTabId:tabId_]; 274 [[self cell] setTabId:tabId_];
275 275
276 bool enabled = extension_->browser_action()->GetIsVisible(tabId_);
277 [self setEnabled:enabled ? YES : NO];
278
276 [self setNeedsDisplay:YES]; 279 [self setNeedsDisplay:YES];
277 280
278 [[NSNotificationCenter defaultCenter] 281 [[NSNotificationCenter defaultCenter]
279 postNotificationName:kBrowserActionButtonUpdatedNotification 282 postNotificationName:kBrowserActionButtonUpdatedNotification
280 object:self]; 283 object:self];
281 } 284 }
282 285
283 - (BOOL)isAnimating { 286 - (BOOL)isAnimating {
284 return [moveAnimation_ isAnimating]; 287 return [moveAnimation_ isAnimating];
285 } 288 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 } 329 }
327 330
328 - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView*)controlView { 331 - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView*)controlView {
329 gfx::ScopedNSGraphicsContextSaveGState scopedGState; 332 gfx::ScopedNSGraphicsContextSaveGState scopedGState;
330 [super drawInteriorWithFrame:cellFrame inView:controlView]; 333 [super drawInteriorWithFrame:cellFrame inView:controlView];
331 cellFrame.origin.y += kBrowserActionBadgeOriginYOffset; 334 cellFrame.origin.y += kBrowserActionBadgeOriginYOffset;
332 [self drawBadgeWithinFrame:cellFrame]; 335 [self drawBadgeWithinFrame:cellFrame];
333 } 336 }
334 337
335 @end 338 @end
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_toolbar_model.cc ('k') | chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698