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

Side by Side Diff: chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.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/extension_installed_bubble_controlle r.h" 5 #import "chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controlle r.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/mac/bundle_locations.h" 8 #include "base/mac/bundle_locations.h"
9 #include "base/mac/mac_util.h" 9 #include "base/mac/mac_util.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 // C++ class that receives EXTENSION_LOADED notifications and proxies them back 55 // C++ class that receives EXTENSION_LOADED notifications and proxies them back
56 // to |controller|. 56 // to |controller|.
57 class ExtensionLoadedNotificationObserver 57 class ExtensionLoadedNotificationObserver
58 : public content::NotificationObserver { 58 : public content::NotificationObserver {
59 public: 59 public:
60 ExtensionLoadedNotificationObserver( 60 ExtensionLoadedNotificationObserver(
61 ExtensionInstalledBubbleController* controller, Profile* profile) 61 ExtensionInstalledBubbleController* controller, Profile* profile)
62 : controller_(controller) { 62 : controller_(controller) {
63 registrar_.Add(this, 63 registrar_.Add(this,
64 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, 64 extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED,
65 content::Source<Profile>(profile)); 65 content::Source<Profile>(profile));
66 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, 66 registrar_.Add(this,
67 content::Source<Profile>(profile)); 67 extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED,
68 content::Source<Profile>(profile));
68 } 69 }
69 70
70 private: 71 private:
71 // NotificationObserver implementation. Tells the controller to start showing 72 // NotificationObserver implementation. Tells the controller to start showing
72 // its window on the main thread when the extension has finished loading. 73 // its window on the main thread when the extension has finished loading.
73 virtual void Observe( 74 virtual void Observe(
74 int type, 75 int type,
75 const content::NotificationSource& source, 76 const content::NotificationSource& source,
76 const content::NotificationDetails& details) OVERRIDE { 77 const content::NotificationDetails& details) OVERRIDE {
77 if (type == chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED) { 78 if (type == extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED) {
78 const Extension* extension = 79 const Extension* extension =
79 content::Details<const Extension>(details).ptr(); 80 content::Details<const Extension>(details).ptr();
80 if (extension == [controller_ extension]) { 81 if (extension == [controller_ extension]) {
81 [controller_ performSelectorOnMainThread:@selector(showWindow:) 82 [controller_ performSelectorOnMainThread:@selector(showWindow:)
82 withObject:controller_ 83 withObject:controller_
83 waitUntilDone:NO]; 84 waitUntilDone:NO];
84 } 85 }
85 } else if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED) { 86 } else if (type == extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED) {
86 const Extension* extension = 87 const Extension* extension =
87 content::Details<const UnloadedExtensionInfo>(details)->extension; 88 content::Details<const UnloadedExtensionInfo>(details)->extension;
88 if (extension == [controller_ extension]) { 89 if (extension == [controller_ extension]) {
89 [controller_ performSelectorOnMainThread:@selector(extensionUnloaded:) 90 [controller_ performSelectorOnMainThread:@selector(extensionUnloaded:)
90 withObject:controller_ 91 withObject:controller_
91 waitUntilDone:NO]; 92 waitUntilDone:NO];
92 } 93 }
93 } else { 94 } else {
94 NOTREACHED() << "Received unexpected notification."; 95 NOTREACHED() << "Received unexpected notification.";
95 } 96 }
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 ExtensionInstallUI::OpenAppInstalledUI(browser_->profile(), extension_->id()); 697 ExtensionInstallUI::OpenAppInstalledUI(browser_->profile(), extension_->id());
697 } 698 }
698 699
699 - (void)awakeFromNib { 700 - (void)awakeFromNib {
700 if (bundle_) 701 if (bundle_)
701 return; 702 return;
702 [self initializeLabel]; 703 [self initializeLabel];
703 } 704 }
704 705
705 @end 706 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698