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

Unified Diff: chrome/browser/extensions/manifest_url_parser.cc

Issue 11660016: Move the parsing of "chrome_url_overrides" out of Extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: patch-rebased Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/manifest_url_parser.h ('k') | chrome/browser/ui/webui/uber/uber_ui.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/manifest_url_parser.cc
diff --git a/chrome/browser/extensions/manifest_url_parser.cc b/chrome/browser/extensions/manifest_url_parser.cc
index e6aa80f196184021021084393011206b1b80b0eb..4afc76ea069e75afd075995a603914eed269964c 100644
--- a/chrome/browser/extensions/manifest_url_parser.cc
+++ b/chrome/browser/extensions/manifest_url_parser.cc
@@ -5,23 +5,52 @@
#include "chrome/browser/extensions/manifest_url_parser.h"
#include "base/lazy_instance.h"
+#include "chrome/browser/extensions/extension_web_ui.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/extensions/extension_manifest_constants.h"
#include "chrome/common/extensions/manifest_handler.h"
#include "chrome/common/extensions/manifest_url_handler.h"
+#include "content/public/browser/notification_details.h"
+#include "content/public/browser/notification_service.h"
namespace extensions {
-ManifestURLParser::ManifestURLParser(Profile* profile) {
+ManifestURLParser::ManifestURLParser(Profile* profile)
+ : profile_(profile) {
ManifestHandler::Register(extension_manifest_keys::kDevToolsPage,
new DevToolsPageHandler);
ManifestHandler::Register(extension_manifest_keys::kHomepageURL,
new HomepageURLHandler);
+ ManifestHandler::Register(extension_manifest_keys::kChromeURLOverrides,
+ new URLOverridesHandler);
+
+ registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED,
+ content::Source<Profile>(profile));
+ registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
+ content::Source<Profile>(profile));
}
ManifestURLParser::~ManifestURLParser() {
}
+void ManifestURLParser::Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) {
+ if (type == chrome::NOTIFICATION_EXTENSION_LOADED) {
+ const Extension* extension =
+ content::Details<const Extension>(details).ptr();
+ ExtensionWebUI::RegisterChromeURLOverrides(
+ profile_, URLOverrides::GetChromeURLOverrides(extension));
+
+ } else if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) {
+ const Extension* extension =
+ content::Details<const UnloadedExtensionInfo>(details)->extension;
+ ExtensionWebUI::UnregisterChromeURLOverrides(
+ profile_, URLOverrides::GetChromeURLOverrides(extension));
+ }
+}
+
static base::LazyInstance<ProfileKeyedAPIFactory<ManifestURLParser> >
g_factory = LAZY_INSTANCE_INITIALIZER;
« no previous file with comments | « chrome/browser/extensions/manifest_url_parser.h ('k') | chrome/browser/ui/webui/uber/uber_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698