OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/mac_util.h" | 8 #include "base/mac/mac_util.h" |
9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "ui/base/l10n/l10n_util.h" | 28 #include "ui/base/l10n/l10n_util.h" |
29 | 29 |
30 | 30 |
31 // C++ class that receives EXTENSION_LOADED notifications and proxies them back | 31 // C++ class that receives EXTENSION_LOADED notifications and proxies them back |
32 // to |controller|. | 32 // to |controller|. |
33 class ExtensionLoadedNotificationObserver : public NotificationObserver { | 33 class ExtensionLoadedNotificationObserver : public NotificationObserver { |
34 public: | 34 public: |
35 ExtensionLoadedNotificationObserver( | 35 ExtensionLoadedNotificationObserver( |
36 ExtensionInstalledBubbleController* controller, Profile* profile) | 36 ExtensionInstalledBubbleController* controller, Profile* profile) |
37 : controller_(controller) { | 37 : controller_(controller) { |
38 registrar_.Add(this, NotificationType::EXTENSION_LOADED, | 38 registrar_.Add(this, chrome::EXTENSION_LOADED, |
39 Source<Profile>(profile)); | 39 Source<Profile>(profile)); |
40 registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, | 40 registrar_.Add(this, chrome::EXTENSION_UNLOADED, |
41 Source<Profile>(profile)); | 41 Source<Profile>(profile)); |
42 } | 42 } |
43 | 43 |
44 private: | 44 private: |
45 // NotificationObserver implementation. Tells the controller to start showing | 45 // NotificationObserver implementation. Tells the controller to start showing |
46 // its window on the main thread when the extension has finished loading. | 46 // its window on the main thread when the extension has finished loading. |
47 void Observe(NotificationType type, | 47 void Observe(int type, |
48 const NotificationSource& source, | 48 const NotificationSource& source, |
49 const NotificationDetails& details) { | 49 const NotificationDetails& details) { |
50 if (type == NotificationType::EXTENSION_LOADED) { | 50 if (type == chrome::EXTENSION_LOADED) { |
51 const Extension* extension = Details<const Extension>(details).ptr(); | 51 const Extension* extension = Details<const Extension>(details).ptr(); |
52 if (extension == [controller_ extension]) { | 52 if (extension == [controller_ extension]) { |
53 [controller_ performSelectorOnMainThread:@selector(showWindow:) | 53 [controller_ performSelectorOnMainThread:@selector(showWindow:) |
54 withObject:controller_ | 54 withObject:controller_ |
55 waitUntilDone:NO]; | 55 waitUntilDone:NO]; |
56 } | 56 } |
57 } else if (type == NotificationType::EXTENSION_UNLOADED) { | 57 } else if (type == chrome::EXTENSION_UNLOADED) { |
58 const Extension* extension = Details<const Extension>(details).ptr(); | 58 const Extension* extension = Details<const Extension>(details).ptr(); |
59 if (extension == [controller_ extension]) { | 59 if (extension == [controller_ extension]) { |
60 [controller_ performSelectorOnMainThread:@selector(extensionUnloaded:) | 60 [controller_ performSelectorOnMainThread:@selector(extensionUnloaded:) |
61 withObject:controller_ | 61 withObject:controller_ |
62 waitUntilDone:NO]; | 62 waitUntilDone:NO]; |
63 } | 63 } |
64 } else { | 64 } else { |
65 NOTREACHED() << "Received unexpected notification."; | 65 NOTREACHED() << "Received unexpected notification."; |
66 } | 66 } |
67 } | 67 } |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 | 369 |
370 - (NSRect)getExtensionInstalledInfoMsgFrame { | 370 - (NSRect)getExtensionInstalledInfoMsgFrame { |
371 return [extensionInstalledInfoMsg_ frame]; | 371 return [extensionInstalledInfoMsg_ frame]; |
372 } | 372 } |
373 | 373 |
374 - (void)extensionUnloaded:(id)sender { | 374 - (void)extensionUnloaded:(id)sender { |
375 extension_ = NULL; | 375 extension_ = NULL; |
376 } | 376 } |
377 | 377 |
378 @end | 378 @end |
OLD | NEW |