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 #include "chrome/browser/automation/automation_extension_tracker.h" | 5 #include "chrome/browser/automation/automation_extension_tracker.h" |
6 #include "chrome/browser/extensions/extension_service.h" | 6 #include "chrome/browser/extensions/extension_service.h" |
7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
| 8 #include "chrome/common/chrome_notification_types.h" |
8 #include "chrome/common/extensions/extension.h" | 9 #include "chrome/common/extensions/extension.h" |
9 #include "content/common/notification_service.h" | 10 #include "content/common/notification_service.h" |
10 | 11 |
11 AutomationExtensionTracker::AutomationExtensionTracker( | 12 AutomationExtensionTracker::AutomationExtensionTracker( |
12 IPC::Message::Sender* automation) | 13 IPC::Message::Sender* automation) |
13 : AutomationResourceTracker<const Extension*>(automation) { | 14 : AutomationResourceTracker<const Extension*>(automation) { |
14 registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, | 15 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, |
15 NotificationService::AllSources()); | 16 NotificationService::AllSources()); |
16 } | 17 } |
17 | 18 |
18 AutomationExtensionTracker::~AutomationExtensionTracker() { | 19 AutomationExtensionTracker::~AutomationExtensionTracker() { |
19 } | 20 } |
20 | 21 |
21 void AutomationExtensionTracker::AddObserver(const Extension* resource) {} | 22 void AutomationExtensionTracker::AddObserver(const Extension* resource) {} |
22 | 23 |
23 void AutomationExtensionTracker::RemoveObserver(const Extension* resource) {} | 24 void AutomationExtensionTracker::RemoveObserver(const Extension* resource) {} |
24 | 25 |
25 void AutomationExtensionTracker::Observe(NotificationType type, | 26 void AutomationExtensionTracker::Observe(int type, |
26 const NotificationSource& source, | 27 const NotificationSource& source, |
27 const NotificationDetails& details) { | 28 const NotificationDetails& details) { |
28 if (type != NotificationType::EXTENSION_UNLOADED) { | 29 if (type != chrome::NOTIFICATION_EXTENSION_UNLOADED) { |
29 NOTREACHED(); | 30 NOTREACHED(); |
30 return; | 31 return; |
31 } | 32 } |
32 UnloadedExtensionInfo* info = Details<UnloadedExtensionInfo>(details).ptr(); | 33 UnloadedExtensionInfo* info = Details<UnloadedExtensionInfo>(details).ptr(); |
33 const Extension* extension = info->extension; | 34 const Extension* extension = info->extension; |
34 Profile* profile = Source<Profile>(source).ptr(); | 35 Profile* profile = Source<Profile>(source).ptr(); |
35 if (profile) { | 36 if (profile) { |
36 ExtensionService* service = profile->GetExtensionService(); | 37 ExtensionService* service = profile->GetExtensionService(); |
37 if (service && info->reason == UnloadedExtensionInfo::UNINSTALL) { | 38 if (service && info->reason == UnloadedExtensionInfo::UNINSTALL) { |
38 // Remove this extension only if it is uninstalled, not just disabled. | 39 // Remove this extension only if it is uninstalled, not just disabled. |
39 CloseResource(extension); | 40 CloseResource(extension); |
40 } | 41 } |
41 } | 42 } |
42 } | 43 } |
OLD | NEW |