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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 browser_action_([[owner cell] extensionAction]), | 53 browser_action_([[owner cell] extensionAction]), |
54 icon_factory_(profile, extension, browser_action_, this) { | 54 icon_factory_(profile, extension, browser_action_, this) { |
55 registrar_.Add( | 55 registrar_.Add( |
56 this, chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED, | 56 this, chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED, |
57 content::Source<ExtensionAction>(browser_action_)); | 57 content::Source<ExtensionAction>(browser_action_)); |
58 } | 58 } |
59 | 59 |
60 virtual ~ExtensionActionIconFactoryBridge() {} | 60 virtual ~ExtensionActionIconFactoryBridge() {} |
61 | 61 |
62 // ExtensionActionIconFactory::Observer implementation. | 62 // ExtensionActionIconFactory::Observer implementation. |
63 void OnIconUpdated() OVERRIDE { | 63 virtual void OnIconUpdated() OVERRIDE { |
64 [owner_ updateState]; | 64 [owner_ updateState]; |
65 } | 65 } |
66 | 66 |
67 // Overridden from content::NotificationObserver. | 67 // Overridden from content::NotificationObserver. |
68 void Observe(int type, | 68 virtual void Observe( |
69 const content::NotificationSource& source, | 69 int type, |
70 const content::NotificationDetails& details) { | 70 const content::NotificationSource& source, |
| 71 const content::NotificationDetails& details) OVERRIDE { |
71 if (type == chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED) | 72 if (type == chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED) |
72 [owner_ updateState]; | 73 [owner_ updateState]; |
73 else | 74 else |
74 NOTREACHED(); | 75 NOTREACHED(); |
75 } | 76 } |
76 | 77 |
77 gfx::Image GetIcon(int tabId) { | 78 gfx::Image GetIcon(int tabId) { |
78 return icon_factory_.GetIcon(tabId); | 79 return icon_factory_.GetIcon(tabId); |
79 } | 80 } |
80 | 81 |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 operation:NSCompositeSourceOver | 329 operation:NSCompositeSourceOver |
329 fraction:enabled ? 1.0 : 0.4 | 330 fraction:enabled ? 1.0 : 0.4 |
330 respectFlipped:YES | 331 respectFlipped:YES |
331 hints:nil]; | 332 hints:nil]; |
332 | 333 |
333 cellFrame.origin.y += kBrowserActionBadgeOriginYOffset; | 334 cellFrame.origin.y += kBrowserActionBadgeOriginYOffset; |
334 [self drawBadgeWithinFrame:cellFrame]; | 335 [self drawBadgeWithinFrame:cellFrame]; |
335 } | 336 } |
336 | 337 |
337 @end | 338 @end |
OLD | NEW |