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

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

Issue 425303002: Move extension notifications to extensions/browser/notification_types.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: (extension-notifications) rebase Created 6 years, 4 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 class ExtensionActionIconFactoryBridge 45 class ExtensionActionIconFactoryBridge
46 : public content::NotificationObserver, 46 : public content::NotificationObserver,
47 public ExtensionActionIconFactory::Observer { 47 public ExtensionActionIconFactory::Observer {
48 public: 48 public:
49 ExtensionActionIconFactoryBridge(BrowserActionButton* owner, 49 ExtensionActionIconFactoryBridge(BrowserActionButton* owner,
50 Profile* profile, 50 Profile* profile,
51 const Extension* extension) 51 const Extension* extension)
52 : owner_(owner), 52 : owner_(owner),
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(this,
56 this, chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED, 56 extensions::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 virtual 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 virtual void Observe( 68 virtual void Observe(
69 int type, 69 int type,
70 const content::NotificationSource& source, 70 const content::NotificationSource& source,
71 const content::NotificationDetails& details) OVERRIDE { 71 const content::NotificationDetails& details) OVERRIDE {
72 if (type == chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED) 72 if (type == extensions::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED)
73 [owner_ updateState]; 73 [owner_ updateState];
74 else 74 else
75 NOTREACHED(); 75 NOTREACHED();
76 } 76 }
77 77
78 gfx::Image GetIcon(int tabId) { 78 gfx::Image GetIcon(int tabId) {
79 return icon_factory_.GetIcon(tabId); 79 return icon_factory_.GetIcon(tabId);
80 } 80 }
81 81
82 private: 82 private:
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 operation:NSCompositeSourceOver 353 operation:NSCompositeSourceOver
354 fraction:enabled ? 1.0 : 0.4 354 fraction:enabled ? 1.0 : 0.4
355 respectFlipped:YES 355 respectFlipped:YES
356 hints:nil]; 356 hints:nil];
357 357
358 cellFrame.origin.y += kBrowserActionBadgeOriginYOffset; 358 cellFrame.origin.y += kBrowserActionBadgeOriginYOffset;
359 [self drawBadgeWithinFrame:cellFrame]; 359 [self drawBadgeWithinFrame:cellFrame];
360 } 360 }
361 361
362 @end 362 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.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