| 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |