summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/render_view.cc
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-30 20:20:01 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-30 20:20:01 +0000
commit433819da3ead5c8ef282c3068c61c8ecfc2e31c7 (patch)
tree7aa109eaf3c5809ea878f84bf2a8873b8c101d5e /chrome/renderer/render_view.cc
parent07286bd43719ee728a238ad1cfe1547de9e661d5 (diff)
downloadchromium_src-433819da3ead5c8ef282c3068c61c8ecfc2e31c7.zip
chromium_src-433819da3ead5c8ef282c3068c61c8ecfc2e31c7.tar.gz
chromium_src-433819da3ead5c8ef282c3068c61c8ecfc2e31c7.tar.bz2
Fix api misunderstanding.
BUG=32719 TEST=none Review URL: http://codereview.chromium.org/554145 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37645 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/render_view.cc')
-rw-r--r--chrome/renderer/render_view.cc30
1 files changed, 13 insertions, 17 deletions
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 183fbd3..ad16f25 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -1084,16 +1084,8 @@ void RenderView::OnSetInitialFocus(bool reverse) {
///////////////////////////////////////////////////////////////////////////////
-void RenderView::ApplyContentSettings(
- WebKit::WebFrame* frame,
- const ContentSettings& settings) {
- // CONTENT_SETTING_ASK is only valid for cookies.
- allowImages(frame, settings.settings[CONTENT_SETTINGS_TYPE_IMAGES] ==
- CONTENT_SETTING_ALLOW);
- allowScript(frame, settings.settings[CONTENT_SETTINGS_TYPE_JAVASCRIPT] ==
- CONTENT_SETTING_ALLOW);
- allowPlugins(frame, settings.settings[CONTENT_SETTINGS_TYPE_PLUGINS] ==
- CONTENT_SETTING_ALLOW);
+void RenderView::SetContentSettings(const ContentSettings& settings) {
+ current_content_settings_ = settings;
}
// Tell the embedding application that the URL of the active page has changed
@@ -1153,7 +1145,7 @@ void RenderView::UpdateURL(WebFrame* frame) {
HostContentSettings::iterator host_content_settings =
host_content_settings_.find(GURL(request.url()).host());
if (host_content_settings != host_content_settings_.end()) {
- ApplyContentSettings(frame, host_content_settings->second);
+ SetContentSettings(host_content_settings->second);
// These content settings were merely recorded transiently for this load.
// We can erase them now. If at some point we reload this page, the
@@ -2031,15 +2023,17 @@ void RenderView::willClose(WebFrame* frame) {
bool RenderView::allowPlugins(WebFrame* frame, bool enabled_per_settings) {
if (!enabled_per_settings)
return false;
- // TODO(darin): Apply policy from content settings.
- return true;
+ // CONTENT_SETTING_ASK is only valid for cookies.
+ return current_content_settings_.settings[CONTENT_SETTINGS_TYPE_PLUGINS] !=
+ CONTENT_SETTING_BLOCK;
}
bool RenderView::allowImages(WebFrame* frame, bool enabled_per_settings) {
if (!enabled_per_settings)
return false;
- // TODO(darin): Apply policy from content settings.
- return true;
+ // CONTENT_SETTING_ASK is only valid for cookies.
+ return current_content_settings_.settings[CONTENT_SETTINGS_TYPE_IMAGES] !=
+ CONTENT_SETTING_BLOCK;
}
void RenderView::loadURLExternally(
@@ -2671,8 +2665,10 @@ void RenderView::didRunInsecureContent(
bool RenderView::allowScript(WebFrame* frame, bool enabled_per_settings) {
if (enabled_per_settings) {
- // TODO(darin): Apply policy from content settings.
- return true;
+ // CONTENT_SETTING_ASK is only valid for cookies.
+ return
+ current_content_settings_.settings[CONTENT_SETTINGS_TYPE_JAVASCRIPT] !=
+ CONTENT_SETTING_BLOCK;
}
WebSecurityOrigin origin = frame->securityOrigin();