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" |
11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
12 #include "chrome/browser/ui/browser_window.h" | 12 #include "chrome/browser/ui/browser_window.h" |
13 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" | 13 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" |
14 #include "chrome/browser/ui/cocoa/browser_window_controller.h" | 14 #include "chrome/browser/ui/cocoa/browser_window_controller.h" |
15 #include "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h" | 15 #include "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h" |
16 #include "chrome/browser/ui/cocoa/hover_close_button.h" | 16 #include "chrome/browser/ui/cocoa/hover_close_button.h" |
17 #include "chrome/browser/ui/cocoa/info_bubble_view.h" | 17 #include "chrome/browser/ui/cocoa/info_bubble_view.h" |
18 #include "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" | 18 #include "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" |
19 #include "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" | 19 #include "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" |
| 20 #include "chrome/common/chrome_notification_types.h" |
20 #include "chrome/common/extensions/extension.h" | 21 #include "chrome/common/extensions/extension.h" |
21 #include "chrome/common/extensions/extension_action.h" | 22 #include "chrome/common/extensions/extension_action.h" |
22 #include "content/common/notification_details.h" | 23 #include "content/common/notification_details.h" |
23 #include "content/common/notification_registrar.h" | 24 #include "content/common/notification_registrar.h" |
24 #include "content/common/notification_source.h" | 25 #include "content/common/notification_source.h" |
25 #include "grit/generated_resources.h" | 26 #include "grit/generated_resources.h" |
26 #import "skia/ext/skia_utils_mac.h" | 27 #import "skia/ext/skia_utils_mac.h" |
27 #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" | 28 #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" |
28 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
29 | 30 |
30 | 31 |
31 // C++ class that receives EXTENSION_LOADED notifications and proxies them back | 32 // C++ class that receives EXTENSION_LOADED notifications and proxies them back |
32 // to |controller|. | 33 // to |controller|. |
33 class ExtensionLoadedNotificationObserver : public NotificationObserver { | 34 class ExtensionLoadedNotificationObserver : public NotificationObserver { |
34 public: | 35 public: |
35 ExtensionLoadedNotificationObserver( | 36 ExtensionLoadedNotificationObserver( |
36 ExtensionInstalledBubbleController* controller, Profile* profile) | 37 ExtensionInstalledBubbleController* controller, Profile* profile) |
37 : controller_(controller) { | 38 : controller_(controller) { |
38 registrar_.Add(this, NotificationType::EXTENSION_LOADED, | 39 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, |
39 Source<Profile>(profile)); | 40 Source<Profile>(profile)); |
40 registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, | 41 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, |
41 Source<Profile>(profile)); | 42 Source<Profile>(profile)); |
42 } | 43 } |
43 | 44 |
44 private: | 45 private: |
45 // NotificationObserver implementation. Tells the controller to start showing | 46 // NotificationObserver implementation. Tells the controller to start showing |
46 // its window on the main thread when the extension has finished loading. | 47 // its window on the main thread when the extension has finished loading. |
47 void Observe(NotificationType type, | 48 void Observe(int type, |
48 const NotificationSource& source, | 49 const NotificationSource& source, |
49 const NotificationDetails& details) { | 50 const NotificationDetails& details) { |
50 if (type == NotificationType::EXTENSION_LOADED) { | 51 if (type == chrome::NOTIFICATION_EXTENSION_LOADED) { |
51 const Extension* extension = Details<const Extension>(details).ptr(); | 52 const Extension* extension = Details<const Extension>(details).ptr(); |
52 if (extension == [controller_ extension]) { | 53 if (extension == [controller_ extension]) { |
53 [controller_ performSelectorOnMainThread:@selector(showWindow:) | 54 [controller_ performSelectorOnMainThread:@selector(showWindow:) |
54 withObject:controller_ | 55 withObject:controller_ |
55 waitUntilDone:NO]; | 56 waitUntilDone:NO]; |
56 } | 57 } |
57 } else if (type == NotificationType::EXTENSION_UNLOADED) { | 58 } else if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { |
58 const Extension* extension = Details<const Extension>(details).ptr(); | 59 const Extension* extension = Details<const Extension>(details).ptr(); |
59 if (extension == [controller_ extension]) { | 60 if (extension == [controller_ extension]) { |
60 [controller_ performSelectorOnMainThread:@selector(extensionUnloaded:) | 61 [controller_ performSelectorOnMainThread:@selector(extensionUnloaded:) |
61 withObject:controller_ | 62 withObject:controller_ |
62 waitUntilDone:NO]; | 63 waitUntilDone:NO]; |
63 } | 64 } |
64 } else { | 65 } else { |
65 NOTREACHED() << "Received unexpected notification."; | 66 NOTREACHED() << "Received unexpected notification."; |
66 } | 67 } |
67 } | 68 } |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 | 370 |
370 - (NSRect)getExtensionInstalledInfoMsgFrame { | 371 - (NSRect)getExtensionInstalledInfoMsgFrame { |
371 return [extensionInstalledInfoMsg_ frame]; | 372 return [extensionInstalledInfoMsg_ frame]; |
372 } | 373 } |
373 | 374 |
374 - (void)extensionUnloaded:(id)sender { | 375 - (void)extensionUnloaded:(id)sender { |
375 extension_ = NULL; | 376 extension_ = NULL; |
376 } | 377 } |
377 | 378 |
378 @end | 379 @end |
OLD | NEW |