diff options
author | tommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-04 23:07:40 +0000 |
---|---|---|
committer | tommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-04 23:07:40 +0000 |
commit | 5ac670a3a8c4e3e2f2b7ed3ad1190f9ed34dd512 (patch) | |
tree | cff9275bd93bc02c09e2d9836a82b086745a9852 /chrome_frame/policy_settings.cc | |
parent | 10da830b7fe028f85cf2167fadb64852cfe526ee (diff) | |
download | chromium_src-5ac670a3a8c4e3e2f2b7ed3ad1190f9ed34dd512.zip chromium_src-5ac670a3a8c4e3e2f2b7ed3ad1190f9ed34dd512.tar.gz chromium_src-5ac670a3a8c4e3e2f2b7ed3ad1190f9ed34dd512.tar.bz2 |
Policy support for being able to specify a list of content types that Chrome Frame should handle.
TEST=This adds a new policy list for Chrome Frame, "ChromeFrameContentTypes", which can be used to specify a list of content types that should always be rendered in Chrome Frame.
BUG=56543
Review URL: http://codereview.chromium.org/3611002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61432 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/policy_settings.cc')
-rw-r--r-- | chrome_frame/policy_settings.cc | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/chrome_frame/policy_settings.cc b/chrome_frame/policy_settings.cc index f1c9984..7e5be2c 100644 --- a/chrome_frame/policy_settings.cc +++ b/chrome_frame/policy_settings.cc @@ -9,6 +9,7 @@ #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "chrome/common/policy_constants.h" +#include "chrome_frame/utils.h" PolicySettings::RendererForUrl PolicySettings::GetRendererForUrl( const wchar_t* url) { @@ -25,6 +26,21 @@ PolicySettings::RendererForUrl PolicySettings::GetRendererForUrl( return renderer; } +PolicySettings::RendererForUrl PolicySettings::GetRendererForContentType( + const wchar_t* content_type) { + DCHECK(content_type); + RendererForUrl renderer = RENDERER_NOT_SPECIFIED; + std::vector<std::wstring>::const_iterator it; + for (it = content_type_list_.begin(); + it != content_type_list_.end(); ++it) { + if (lstrcmpiW(content_type, (*it).c_str()) == 0) { + renderer = RENDER_IN_CHROME_FRAME; + break; + } + } + return renderer; +} + void PolicySettings::RefreshFromRegistry() { default_renderer_ = RENDERER_NOT_SPECIFIED; renderer_exclusion_list_.clear(); @@ -56,15 +72,21 @@ void PolicySettings::RefreshFromRegistry() { policy::key::kRenderInChromeFrameList : policy::key::kRenderInHostList; - RegistryValueIterator url_list(config_key.Handle(), - ASCIIToWide(exclusion_list_name).c_str()); - while (url_list.Valid()) { - renderer_exclusion_list_.push_back(url_list.Value()); - ++url_list; - } + EnumerateKeyValues(config_key.Handle(), + ASCIIToWide(exclusion_list_name).c_str(), &renderer_exclusion_list_); + DLOG(INFO) << "Default renderer as specified via policy: " << default_renderer_ << " exclusion list size: " << renderer_exclusion_list_.size(); } + + std::wstring sub_key(policy::kRegistrySubKey); + sub_key += L"\\"; + sub_key += ASCIIToWide(policy::key::kChromeFrameContentTypes); + + for (int i = 0; i < arraysize(root_key) && content_type_list_.size() == 0; + ++i) { + EnumerateKeyValues(root_key[i], sub_key.c_str(), &content_type_list_); + } } |