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 #include "chrome/browser/extensions/extension_web_ui_override_registrar.h" | 5 #include "chrome/browser/extensions/extension_web_ui_override_registrar.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
9 #include "chrome/browser/extensions/extension_web_ui.h" | 9 #include "chrome/browser/extensions/extension_web_ui.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
11 #include "content/public/browser/notification_details.h" | 11 #include "content/public/browser/notification_details.h" |
12 #include "content/public/browser/notification_service.h" | 12 #include "content/public/browser/notification_service.h" |
13 | 13 |
14 namespace extensions { | 14 namespace extensions { |
15 | 15 |
16 ExtensionWebUIOverrideRegistrar::ExtensionWebUIOverrideRegistrar( | 16 ExtensionWebUIOverrideRegistrar::ExtensionWebUIOverrideRegistrar( |
17 Profile* profile) : profile_(profile) { | 17 content::BrowserContext* context) |
18 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, | 18 : profile_(Profile::FromBrowserContext(context)) { |
19 content::Source<Profile>(profile)); | 19 registrar_.Add(this, |
20 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, | 20 chrome::NOTIFICATION_EXTENSION_LOADED, |
21 content::Source<Profile>(profile)); | 21 content::Source<Profile>(profile_)); |
| 22 registrar_.Add(this, |
| 23 chrome::NOTIFICATION_EXTENSION_UNLOADED, |
| 24 content::Source<Profile>(profile_)); |
22 } | 25 } |
23 | 26 |
24 ExtensionWebUIOverrideRegistrar::~ExtensionWebUIOverrideRegistrar() { | 27 ExtensionWebUIOverrideRegistrar::~ExtensionWebUIOverrideRegistrar() { |
25 } | 28 } |
26 | 29 |
27 void ExtensionWebUIOverrideRegistrar::Observe( | 30 void ExtensionWebUIOverrideRegistrar::Observe( |
28 int type, | 31 int type, |
29 const content::NotificationSource& source, | 32 const content::NotificationSource& source, |
30 const content::NotificationDetails& details) { | 33 const content::NotificationDetails& details) { |
31 if (type == chrome::NOTIFICATION_EXTENSION_LOADED) { | 34 if (type == chrome::NOTIFICATION_EXTENSION_LOADED) { |
(...skipping 14 matching lines...) Expand all Loading... |
46 ProfileKeyedAPIFactory<ExtensionWebUIOverrideRegistrar> > | 49 ProfileKeyedAPIFactory<ExtensionWebUIOverrideRegistrar> > |
47 g_factory = LAZY_INSTANCE_INITIALIZER; | 50 g_factory = LAZY_INSTANCE_INITIALIZER; |
48 | 51 |
49 // static | 52 // static |
50 ProfileKeyedAPIFactory<ExtensionWebUIOverrideRegistrar>* | 53 ProfileKeyedAPIFactory<ExtensionWebUIOverrideRegistrar>* |
51 ExtensionWebUIOverrideRegistrar::GetFactoryInstance() { | 54 ExtensionWebUIOverrideRegistrar::GetFactoryInstance() { |
52 return g_factory.Pointer(); | 55 return g_factory.Pointer(); |
53 } | 56 } |
54 | 57 |
55 } // namespace extensions | 58 } // namespace extensions |
OLD | NEW |