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

Unified Diff: chrome/browser/chrome_content_browser_client.cc

Issue 78303005: ContentSettings API should not interact with <webview> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Small cleanup/refactor Created 7 years, 1 month 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
Index: chrome/browser/chrome_content_browser_client.cc
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index 84a118f400868bb78d7e28382ba5bd85e6fe843c..b4e43b3bc7d753a9808f05650e7608df1ee685c3 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -941,10 +941,45 @@ void ChromeContentBrowserClient::RenderProcessHostCreated(
profile->IsOffTheRecord()));
SendExtensionWebRequestStatusToHost(host);
+}
+
+// static
+void ChromeContentBrowserClient::SetContentSettingRules(
+ content::RenderViewHost* host) {
+ // <*view> guests should not be affected by ContentSettingRules.
+ if (host->GetProcess()->IsGuest())
+ return;
+
+ SiteInstance* site_instance = host->GetSiteInstance();
+ if (!site_instance)
+ return;
+
+ Profile* profile = Profile::FromBrowserContext(
+ host->GetProcess()->GetBrowserContext());
+ if (!profile)
+ return;
+
+ ExtensionService* extension_service =
+ extensions::ExtensionSystem::Get(profile)->extension_service();
+ if (!extension_service)
+ return;
+
+ // Extensions should not be affected by ContentSettingRules.
+ const Extension* extension = extension_service->extensions()->
+ GetHostedAppByURL(site_instance->GetSiteURL());
+ if (extension)
+ return;
RendererContentSettingRules rules;
- GetRendererContentSettingRules(profile->GetHostContentSettingsMap(), &rules);
- host->Send(new ChromeViewMsg_SetContentSettingRules(rules));
+ GetRendererContentSettingRules(profile->GetHostContentSettingsMap(),
+ &rules);
markusheintz_ 2013/11/25 18:04:41 nit: I guess this fits into the line above.
Fady Samuel 2013/11/25 21:54:02 Done.
+ host->Send(new ChromeViewMsg_SetContentSettingRules(
+ host->GetRoutingID(), rules));
+}
+
+void ChromeContentBrowserClient::RenderViewReady(
+ content::RenderViewHost* host) {
+ SetContentSettingRules(host);
}
GURL ChromeContentBrowserClient::GetEffectiveURL(

Powered by Google App Engine
This is Rietveld 408576698