diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-30 10:09:04 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-30 10:09:04 +0000 |
commit | d0331589eb9e9d7d4d26658652ad5e0d60f8df6a (patch) | |
tree | a2318bc17615dc0c5a15a6cc79de6a28afa697b3 /chrome/common | |
parent | e358debf2c2c8aff5a9620e36421ba55d4b8e446 (diff) | |
download | chromium_src-d0331589eb9e9d7d4d26658652ad5e0d60f8df6a.zip chromium_src-d0331589eb9e9d7d4d26658652ad5e0d60f8df6a.tar.gz chromium_src-d0331589eb9e9d7d4d26658652ad5e0d60f8df6a.tar.bz2 |
Merge 37628 - IPC perhost content settings to the renderers.
BUG=32719
TEST=none
Review URL: http://codereview.chromium.org/549218
TBR=thakis@chromium.org
Review URL: http://codereview.chromium.org/553167
git-svn-id: svn://svn.chromium.org/chrome/branches/249/src@37633 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r-- | chrome/common/common_param_traits.cc | 27 | ||||
-rw-r--r-- | chrome/common/common_param_traits.h | 12 | ||||
-rw-r--r-- | chrome/common/render_messages_internal.h | 14 |
3 files changed, 50 insertions, 3 deletions
diff --git a/chrome/common/common_param_traits.cc b/chrome/common/common_param_traits.cc index 684337d..7d7c5be 100644 --- a/chrome/common/common_param_traits.cc +++ b/chrome/common/common_param_traits.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 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. @@ -178,6 +178,31 @@ void ParamTraits<gfx::Size>::Log(const gfx::Size& p, std::wstring* l) { l->append(StringPrintf(L"(%d, %d)", p.width(), p.height())); } +void ParamTraits<ContentSettings>::Write( + Message* m, const ContentSettings& settings) { + for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) + WriteParam(m, static_cast<int>(settings.settings[i])); +} + +bool ParamTraits<ContentSettings>::Read( + const Message* m, void** iter, ContentSettings* r) { + for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { + int local_setting; + if (!m->ReadInt(iter, &local_setting)) + return false; + if (local_setting < 0 || + local_setting >= static_cast<int>(CONTENT_SETTING_NUM_SETTINGS)) + return false; + r->settings[i] = static_cast<ContentSetting>(local_setting); + } + return true; +} + +void ParamTraits<ContentSettings>::Log( + const ContentSettings& p, std::wstring* l) { + l->append(StringPrintf(L"<ContentSettings>")); +} + void ParamTraits<webkit_glue::WebApplicationInfo>::Write( Message* m, const webkit_glue::WebApplicationInfo& p) { WriteParam(m, p.title); diff --git a/chrome/common/common_param_traits.h b/chrome/common/common_param_traits.h index cb0ba43..e365b62 100644 --- a/chrome/common/common_param_traits.h +++ b/chrome/common/common_param_traits.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. @@ -14,6 +14,7 @@ #include <vector> #include "app/gfx/native_widget_types.h" +#include "chrome/common/content_settings.h" #include "chrome/common/thumbnail_score.h" #include "chrome/common/transport_dib.h" #include "ipc/ipc_message_utils.h" @@ -87,6 +88,14 @@ struct ParamTraits<gfx::Size> { }; template <> +struct ParamTraits<ContentSettings> { + typedef ContentSettings param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* r); + static void Log(const param_type& p, std::wstring* l); +}; + +template <> struct ParamTraits<gfx::NativeWindow> { typedef gfx::NativeWindow param_type; static void Write(Message* m, const param_type& p) { @@ -101,7 +110,6 @@ struct ParamTraits<gfx::NativeWindow> { } }; - template <> struct ParamTraits<WindowOpenDisposition> { typedef WindowOpenDisposition param_type; diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index 6359d5b..d6cd2d3 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -20,6 +20,7 @@ #include "base/gfx/rect.h" #include "base/shared_memory.h" #include "base/values.h" +#include "chrome/common/content_settings.h" #include "chrome/common/css_colors.h" #include "chrome/common/extensions/update_manifest.h" #include "chrome/common/nacl_types.h" @@ -345,6 +346,19 @@ IPC_BEGIN_MESSAGES(View) IPC_MESSAGE_ROUTED1(ViewMsg_Zoom, int /* One of PageZoom::Function */) + // Set the content settings for a particular hostname that the renderer is in + // the process of loading. This will be stored, to be used if the load + // commits and ignored otherwise. + IPC_MESSAGE_ROUTED2(ViewMsg_SetContentSettingsForLoadingHost, + std::string /* host */, + ContentSettings /* content_settings */) + + // Set the content settings for a particular hostname, so all render views + // displaying this host can update their content settings to match. + IPC_MESSAGE_CONTROL2(ViewMsg_SetContentSettingsForCurrentHost, + std::string /* host */, + ContentSettings /* content_settings */) + // Change encoding of page in the renderer. IPC_MESSAGE_ROUTED1(ViewMsg_SetPageEncoding, std::string /*new encoding name*/) |