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