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

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: Fixed nits + Added missing file 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 a95a29a9dc71e20dec0ee34be3e077d53594267f..566014c8b5cf25c8fcb0594af09eeda1d54b0e57 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -941,10 +941,44 @@ 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));
+ 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