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/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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, chrome::NOTIFICATION_EXTENSION_LOADED, | 63 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, |
64 content::Source<Profile>(profile)); | 64 content::Source<Profile>(profile)); |
65 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, | 65 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
66 content::Source<Profile>(profile)); | 66 content::Source<Profile>(profile)); |
67 } | 67 } |
68 | 68 |
69 private: | 69 private: |
70 // NotificationObserver implementation. Tells the controller to start showing | 70 // NotificationObserver implementation. Tells the controller to start showing |
71 // its window on the main thread when the extension has finished loading. | 71 // its window on the main thread when the extension has finished loading. |
72 virtual void Observe( | 72 virtual void Observe( |
73 int type, | 73 int type, |
74 const content::NotificationSource& source, | 74 const content::NotificationSource& source, |
75 const content::NotificationDetails& details) OVERRIDE { | 75 const content::NotificationDetails& details) OVERRIDE { |
76 if (type == chrome::NOTIFICATION_EXTENSION_LOADED) { | 76 if (type == chrome::NOTIFICATION_EXTENSION_LOADED) { |
77 const Extension* extension = | 77 const Extension* extension = |
78 content::Details<const Extension>(details).ptr(); | 78 content::Details<const Extension>(details).ptr(); |
79 if (extension == [controller_ extension]) { | 79 if (extension == [controller_ extension]) { |
80 [controller_ performSelectorOnMainThread:@selector(showWindow:) | 80 [controller_ performSelectorOnMainThread:@selector(showWindow:) |
81 withObject:controller_ | 81 withObject:controller_ |
82 waitUntilDone:NO]; | 82 waitUntilDone:NO]; |
83 } | 83 } |
84 } else if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { | 84 } else if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED) { |
85 const Extension* extension = | 85 const Extension* extension = |
86 content::Details<const UnloadedExtensionInfo>(details)->extension; | 86 content::Details<const UnloadedExtensionInfo>(details)->extension; |
87 if (extension == [controller_ extension]) { | 87 if (extension == [controller_ extension]) { |
88 [controller_ performSelectorOnMainThread:@selector(extensionUnloaded:) | 88 [controller_ performSelectorOnMainThread:@selector(extensionUnloaded:) |
89 withObject:controller_ | 89 withObject:controller_ |
90 waitUntilDone:NO]; | 90 waitUntilDone:NO]; |
91 } | 91 } |
92 } else { | 92 } else { |
93 NOTREACHED() << "Received unexpected notification."; | 93 NOTREACHED() << "Received unexpected notification."; |
94 } | 94 } |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 ExtensionInstallUI::OpenAppInstalledUI(browser_->profile(), extension_->id()); | 695 ExtensionInstallUI::OpenAppInstalledUI(browser_->profile(), extension_->id()); |
696 } | 696 } |
697 | 697 |
698 - (void)awakeFromNib { | 698 - (void)awakeFromNib { |
699 if (bundle_) | 699 if (bundle_) |
700 return; | 700 return; |
701 [self initializeLabel]; | 701 [self initializeLabel]; |
702 } | 702 } |
703 | 703 |
704 @end | 704 @end |
OLD | NEW |