| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 : public ExtensionActionIconFactory::Observer { | 42 : public ExtensionActionIconFactory::Observer { |
| 43 public: | 43 public: |
| 44 ExtensionActionIconFactoryBridge(BrowserActionButton* owner, | 44 ExtensionActionIconFactoryBridge(BrowserActionButton* owner, |
| 45 Profile* profile, | 45 Profile* profile, |
| 46 const Extension* extension) | 46 const Extension* extension) |
| 47 : owner_(owner), | 47 : owner_(owner), |
| 48 browser_action_([[owner cell] extensionAction]), | 48 browser_action_([[owner cell] extensionAction]), |
| 49 icon_factory_(profile, extension, browser_action_, this) { | 49 icon_factory_(profile, extension, browser_action_, this) { |
| 50 } | 50 } |
| 51 | 51 |
| 52 virtual ~ExtensionActionIconFactoryBridge() {} | 52 ~ExtensionActionIconFactoryBridge() override {} |
| 53 | 53 |
| 54 // ExtensionActionIconFactory::Observer implementation. | 54 // ExtensionActionIconFactory::Observer implementation. |
| 55 virtual void OnIconUpdated() override { | 55 void OnIconUpdated() override { [owner_ updateState]; } |
| 56 [owner_ updateState]; | |
| 57 } | |
| 58 | 56 |
| 59 gfx::Image GetIcon(int tabId) { | 57 gfx::Image GetIcon(int tabId) { |
| 60 return icon_factory_.GetIcon(tabId); | 58 return icon_factory_.GetIcon(tabId); |
| 61 } | 59 } |
| 62 | 60 |
| 63 private: | 61 private: |
| 64 // Weak. Owns us. | 62 // Weak. Owns us. |
| 65 BrowserActionButton* owner_; | 63 BrowserActionButton* owner_; |
| 66 | 64 |
| 67 // The browser action whose images we're loading. | 65 // The browser action whose images we're loading. |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 operation:NSCompositeSourceOver | 329 operation:NSCompositeSourceOver |
| 332 fraction:enabled ? 1.0 : 0.4 | 330 fraction:enabled ? 1.0 : 0.4 |
| 333 respectFlipped:YES | 331 respectFlipped:YES |
| 334 hints:nil]; | 332 hints:nil]; |
| 335 | 333 |
| 336 cellFrame.origin.y += kBrowserActionBadgeOriginYOffset; | 334 cellFrame.origin.y += kBrowserActionBadgeOriginYOffset; |
| 337 [self drawBadgeWithinFrame:cellFrame]; | 335 [self drawBadgeWithinFrame:cellFrame]; |
| 338 } | 336 } |
| 339 | 337 |
| 340 @end | 338 @end |
| OLD | NEW |