Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: chrome/browser/extensions/extension_web_ui_override_registrar.cc

Issue 204703002: Rename NOTIFICATION_EXTENSION_UNLOADED to (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: maybe upload wont do something bizarre this time Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 content::BrowserContext* context) 17 content::BrowserContext* context)
18 : profile_(Profile::FromBrowserContext(context)) { 18 : profile_(Profile::FromBrowserContext(context)) {
19 registrar_.Add(this, 19 registrar_.Add(this,
20 chrome::NOTIFICATION_EXTENSION_LOADED, 20 chrome::NOTIFICATION_EXTENSION_LOADED,
21 content::Source<Profile>(profile_)); 21 content::Source<Profile>(profile_));
22 registrar_.Add(this, 22 registrar_.Add(this,
23 chrome::NOTIFICATION_EXTENSION_UNLOADED, 23 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED,
24 content::Source<Profile>(profile_)); 24 content::Source<Profile>(profile_));
25 } 25 }
26 26
27 ExtensionWebUIOverrideRegistrar::~ExtensionWebUIOverrideRegistrar() { 27 ExtensionWebUIOverrideRegistrar::~ExtensionWebUIOverrideRegistrar() {
28 } 28 }
29 29
30 void ExtensionWebUIOverrideRegistrar::Observe( 30 void ExtensionWebUIOverrideRegistrar::Observe(
31 int type, 31 int type,
32 const content::NotificationSource& source, 32 const content::NotificationSource& source,
33 const content::NotificationDetails& details) { 33 const content::NotificationDetails& details) {
34 if (type == chrome::NOTIFICATION_EXTENSION_LOADED) { 34 if (type == chrome::NOTIFICATION_EXTENSION_LOADED) {
35 const Extension* extension = 35 const Extension* extension =
36 content::Details<const Extension>(details).ptr(); 36 content::Details<const Extension>(details).ptr();
37 ExtensionWebUI::RegisterChromeURLOverrides( 37 ExtensionWebUI::RegisterChromeURLOverrides(
38 profile_, URLOverrides::GetChromeURLOverrides(extension)); 38 profile_, URLOverrides::GetChromeURLOverrides(extension));
39 39
40 } else if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { 40 } else if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED) {
41 const Extension* extension = 41 const Extension* extension =
42 content::Details<UnloadedExtensionInfo>(details)->extension; 42 content::Details<UnloadedExtensionInfo>(details)->extension;
43 ExtensionWebUI::UnregisterChromeURLOverrides( 43 ExtensionWebUI::UnregisterChromeURLOverrides(
44 profile_, URLOverrides::GetChromeURLOverrides(extension)); 44 profile_, URLOverrides::GetChromeURLOverrides(extension));
45 } 45 }
46 } 46 }
47 47
48 static base::LazyInstance< 48 static base::LazyInstance<
49 BrowserContextKeyedAPIFactory<ExtensionWebUIOverrideRegistrar> > g_factory = 49 BrowserContextKeyedAPIFactory<ExtensionWebUIOverrideRegistrar> > g_factory =
50 LAZY_INSTANCE_INITIALIZER; 50 LAZY_INSTANCE_INITIALIZER;
51 51
52 // static 52 // static
53 BrowserContextKeyedAPIFactory<ExtensionWebUIOverrideRegistrar>* 53 BrowserContextKeyedAPIFactory<ExtensionWebUIOverrideRegistrar>*
54 ExtensionWebUIOverrideRegistrar::GetFactoryInstance() { 54 ExtensionWebUIOverrideRegistrar::GetFactoryInstance() {
55 return g_factory.Pointer(); 55 return g_factory.Pointer();
56 } 56 }
57 57
58 } // namespace extensions 58 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_warning_service.cc ('k') | chrome/browser/extensions/image_loader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698