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

Unified Diff: chrome/browser/net/chrome_url_request_context.cc

Issue 255047: Ensure ChromeURLRequestContext finds out first about extension loading (Closed)
Patch Set: cr changes Created 11 years, 3 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/net/chrome_url_request_context.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/chrome_url_request_context.cc
diff --git a/chrome/browser/net/chrome_url_request_context.cc b/chrome/browser/net/chrome_url_request_context.cc
index 5de62c1f7337979ad883b46da8c3a8eaea3fb236..2c68419049d820e24a8aeeacf8315949d4baf2fe 100644
--- a/chrome/browser/net/chrome_url_request_context.cc
+++ b/chrome/browser/net/chrome_url_request_context.cc
@@ -367,13 +367,6 @@ ChromeURLRequestContext::ChromeURLRequestContext(
prefs_->AddPrefObserver(prefs::kCookieBehavior, this);
prefs_->AddPrefObserver(prefs::kDefaultCharset, this);
- if (!is_off_the_record_) {
- registrar_.Add(this, NotificationType::EXTENSION_LOADED,
- NotificationService::AllSources());
- registrar_.Add(this, NotificationType::EXTENSION_UNLOADED,
- NotificationService::AllSources());
- }
-
ssl_config_service_ = profile->GetSSLConfigService();
}
@@ -432,20 +425,6 @@ void ChromeURLRequestContext::Observe(NotificationType type,
&ChromeURLRequestContext::OnDefaultCharsetChange,
default_charset));
}
- } else if (NotificationType::EXTENSION_LOADED == type) {
- ExtensionPaths* new_paths = new ExtensionPaths;
- Extension* extension = Details<Extension>(details).ptr();
- DCHECK(extension);
- new_paths->insert(ExtensionPaths::value_type(extension->id(),
- extension->path()));
- g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE,
- NewRunnableMethod(this, &ChromeURLRequestContext::OnNewExtensions,
- new_paths));
- } else if (NotificationType::EXTENSION_UNLOADED == type) {
- Extension* extension = Details<Extension>(details).ptr();
- g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE,
- NewRunnableMethod(this, &ChromeURLRequestContext::OnUnloadedExtension,
- extension->id()));
} else {
NOTREACHED();
}
@@ -539,14 +518,17 @@ void ChromeURLRequestContext::OnDefaultCharsetChange(
net::HttpUtil::GenerateAcceptCharsetHeader(default_charset);
}
-void ChromeURLRequestContext::OnNewExtensions(ExtensionPaths* new_paths) {
- extension_paths_.insert(new_paths->begin(), new_paths->end());
- delete new_paths;
+void ChromeURLRequestContext::OnNewExtensions(const std::string& id,
+ const FilePath& path) {
+ if (!is_off_the_record_) {
Matt Perry 2009/10/01 22:33:59 nit: remove braces
+ extension_paths_[id] = path;
+ }
}
-void ChromeURLRequestContext::OnUnloadedExtension(
- const std::string& extension_id) {
- ExtensionPaths::iterator iter = extension_paths_.find(extension_id);
+void ChromeURLRequestContext::OnUnloadedExtension(const std::string& id) {
+ if (is_off_the_record_)
+ return;
+ ExtensionPaths::iterator iter = extension_paths_.find(id);
DCHECK(iter != extension_paths_.end());
extension_paths_.erase(iter);
}
« no previous file with comments | « chrome/browser/net/chrome_url_request_context.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698