summaryrefslogtreecommitdiffstats
path: root/chrome/renderer
diff options
context:
space:
mode:
authorjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-29 12:41:28 +0000
committerjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-29 12:41:28 +0000
commit6787d0c8ea33ceb8094db48d1b5bc24208bad433 (patch)
tree075db87129cb882dcb5117aaa7cb7684cd5882ef /chrome/renderer
parent8b6c5a26007dae63d32e0fcaec9bd687a2e3e8b7 (diff)
downloadchromium_src-6787d0c8ea33ceb8094db48d1b5bc24208bad433.zip
chromium_src-6787d0c8ea33ceb8094db48d1b5bc24208bad433.tar.gz
chromium_src-6787d0c8ea33ceb8094db48d1b5bc24208bad433.tar.bz2
Implement HostContentSettingsMap
This map stores whether a given host may load images or use plugins and javascript. And makes this information available to the render view BUG=32782 TEST=none Review URL: http://codereview.chromium.org/551149 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37508 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r--chrome/renderer/navigation_state.h12
-rw-r--r--chrome/renderer/render_view.cc14
-rw-r--r--chrome/renderer/render_view.h4
3 files changed, 28 insertions, 2 deletions
diff --git a/chrome/renderer/navigation_state.h b/chrome/renderer/navigation_state.h
index 12580f8..7d4271ea 100644
--- a/chrome/renderer/navigation_state.h
+++ b/chrome/renderer/navigation_state.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,6 +7,7 @@
#include "base/scoped_ptr.h"
#include "base/time.h"
+#include "chrome/common/content_permission_types.h"
#include "chrome/common/page_transition_types.h"
#include "chrome/renderer/user_script_idle_scheduler.h"
#include "third_party/WebKit/WebKit/chromium/public/WebDataSource.h"
@@ -207,6 +208,13 @@ class NavigationState : public WebKit::WebDataSource::ExtraData {
void set_was_fetched_via_spdy(bool value) { was_fetched_via_spdy_ = value; }
bool was_fetched_via_spdy() const { return was_fetched_via_spdy_; }
+ void set_content_permissions(const ContentPermissions& value) {
+ content_permissions_ = value;
+ }
+ ContentPermissions content_permissions() const {
+ return content_permissions_;
+ }
+
private:
NavigationState(PageTransition::Type transition_type,
const base::Time& request_time,
@@ -254,6 +262,8 @@ class NavigationState : public WebKit::WebDataSource::ExtraData {
bool was_fetched_via_spdy_;
+ ContentPermissions content_permissions_;
+
DISALLOW_COPY_AND_ASSIGN(NavigationState);
};
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index a27792f4..c101235 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -494,6 +494,8 @@ void RenderView::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(ViewMsg_ExecuteEditCommand, OnExecuteEditCommand)
IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind)
IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom)
+ IPC_MESSAGE_HANDLER(ViewMsg_SetContentSettingsForLoadingHost,
+ OnSetContentSettingsForLoadingHost)
IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingHost,
OnSetZoomLevelForLoadingHost)
IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding)
@@ -3136,6 +3138,18 @@ void RenderView::OnZoom(PageZoom::Function function) {
Send(new ViewHostMsg_DidZoomHost(host, new_zoom_level));
}
+void RenderView::OnSetContentSettingsForLoadingHost(std::string host,
+ int content_settings) {
+ WebFrame* main_frame = webview()->mainFrame();
+ DCHECK(main_frame);
+ WebDataSource* ds = main_frame->provisionalDataSource();
+ DCHECK(ds);
+ NavigationState* navigation_state = NavigationState::FromDataSource(ds);
+ DCHECK(navigation_state);
+ navigation_state->set_content_permissions(
+ ContentPermissions::FromInteger(content_settings));
+}
+
void RenderView::OnSetZoomLevelForLoadingHost(std::string host,
int zoom_level) {
host_zoom_levels_[host] = zoom_level;
diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h
index dfc4cdb..233be9a 100644
--- a/chrome/renderer/render_view.h
+++ b/chrome/renderer/render_view.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -581,6 +581,8 @@ class RenderView : public RenderWidget,
void OnFind(int request_id, const string16&, const WebKit::WebFindOptions&);
void OnDeterminePageLanguage();
void OnZoom(PageZoom::Function function);
+ void OnSetContentSettingsForLoadingHost(std::string host,
+ int content_settings);
void OnSetZoomLevelForLoadingHost(std::string host, int zoom_level);
void OnSetPageEncoding(const std::string& encoding_name);
void OnResetPageEncodingToDefault();