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

Unified Diff: chrome/browser/profile.cc

Issue 1383001: Hook up extension apps notification permission, take two (Closed)
Patch Set: pre commit Created 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/profile.h ('k') | chrome/browser/renderer_host/resource_message_filter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profile.cc
diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc
index 7287f265f579e3e67d3b5b6ecdccb58ad8c6501d..c808574c3dc0443bd5b44b89e2507e6b0f0306a6 100644
--- a/chrome/browser/profile.cc
+++ b/chrome/browser/profile.cc
@@ -130,6 +130,34 @@ bool HasACacheSubdir(const FilePath &dir) {
file_util::PathExists(GetMediaCachePath(dir));
}
+void PostExtensionLoadedToContextGetter(ChromeURLRequestContextGetter* getter,
+ Extension* extension) {
+ if (!getter)
+ return;
+ // Callee takes ownership of new ExtensionInfo struct.
+ ChromeThread::PostTask(
+ ChromeThread::IO, FROM_HERE,
+ NewRunnableMethod(getter,
+ &ChromeURLRequestContextGetter::OnNewExtensions,
+ extension->id(),
+ new ChromeURLRequestContext::ExtensionInfo(
+ extension->path(),
+ extension->default_locale(),
+ extension->web_extent(),
+ extension->api_permissions())));
+}
+
+void PostExtensionUnloadedToContextGetter(ChromeURLRequestContextGetter* getter,
+ Extension* extension) {
+ if (!getter)
+ return;
+ ChromeThread::PostTask(
+ ChromeThread::IO, FROM_HERE,
+ NewRunnableMethod(getter,
+ &ChromeURLRequestContextGetter::OnUnloadedExtension,
+ extension->id()));
+}
+
} // namespace
// A pointer to the request context for the default profile. See comments on
@@ -977,6 +1005,38 @@ URLRequestContextGetter* ProfileImpl::GetRequestContextForExtensions() {
return extensions_request_context_;
}
+void ProfileImpl::RegisterExtensionWithRequestContexts(
+ Extension* extension) {
+ // Notify the default, extension and media contexts on the IO thread.
+ PostExtensionLoadedToContextGetter(
+ static_cast<ChromeURLRequestContextGetter*>(GetRequestContext()),
+ extension);
+ PostExtensionLoadedToContextGetter(
+ static_cast<ChromeURLRequestContextGetter*>(
+ GetRequestContextForExtensions()),
+ extension);
+ PostExtensionLoadedToContextGetter(
+ static_cast<ChromeURLRequestContextGetter*>(
+ GetRequestContextForMedia()),
+ extension);
+}
+
+void ProfileImpl::UnregisterExtensionWithRequestContexts(
+ Extension* extension) {
+ // Notify the default, extension and media contexts on the IO thread.
+ PostExtensionUnloadedToContextGetter(
+ static_cast<ChromeURLRequestContextGetter*>(GetRequestContext()),
+ extension);
+ PostExtensionUnloadedToContextGetter(
+ static_cast<ChromeURLRequestContextGetter*>(
+ GetRequestContextForExtensions()),
+ extension);
+ PostExtensionUnloadedToContextGetter(
+ static_cast<ChromeURLRequestContextGetter*>(
+ GetRequestContextForMedia()),
+ extension);
+}
+
net::SSLConfigService* ProfileImpl::GetSSLConfigService() {
return ssl_config_service_manager_->Get();
}
« no previous file with comments | « chrome/browser/profile.h ('k') | chrome/browser/renderer_host/resource_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698