summaryrefslogtreecommitdiffstats
path: root/chrome/browser/content_settings
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/content_settings')
-rw-r--r--chrome/browser/content_settings/content_settings_default_provider.cc33
-rw-r--r--chrome/browser/content_settings/content_settings_default_provider.h4
-rw-r--r--chrome/browser/content_settings/content_settings_pref_provider_unittest.cc9
-rw-r--r--chrome/browser/content_settings/host_content_settings_map.cc27
-rw-r--r--chrome/browser/content_settings/host_content_settings_map.h13
-rw-r--r--chrome/browser/content_settings/host_content_settings_map_unittest.cc145
-rw-r--r--chrome/browser/content_settings/mock_settings_observer.cc3
-rw-r--r--chrome/browser/content_settings/tab_specific_content_settings.cc17
-rw-r--r--chrome/browser/content_settings/tab_specific_content_settings.h1
9 files changed, 170 insertions, 82 deletions
diff --git a/chrome/browser/content_settings/content_settings_default_provider.cc b/chrome/browser/content_settings/content_settings_default_provider.cc
index d70a4d0..d1ff977 100644
--- a/chrome/browser/content_settings/content_settings_default_provider.cc
+++ b/chrome/browser/content_settings/content_settings_default_provider.cc
@@ -109,7 +109,7 @@ DefaultProvider::DefaultProvider(PrefService* prefs, bool incognito)
// Read global defaults.
ReadDefaultSettings(true);
- if (default_content_settings_[CONTENT_SETTINGS_TYPE_COOKIES] ==
+ if (default_content_settings_.settings[CONTENT_SETTINGS_TYPE_COOKIES] ==
CONTENT_SETTING_BLOCK) {
UserMetrics::RecordAction(
UserMetricsAction("CookieBlockingEnabledPerDefault"));
@@ -161,12 +161,12 @@ void DefaultProvider::SetContentSetting(
base::AutoLock lock(lock_);
if (setting == CONTENT_SETTING_DEFAULT ||
setting == kDefaultSettings[content_type]) {
- default_content_settings_[content_type] =
+ default_content_settings_.settings[content_type] =
kDefaultSettings[content_type];
default_settings_dictionary->RemoveWithoutPathExpansion(dictionary_path,
NULL);
} else {
- default_content_settings_[content_type] = setting;
+ default_content_settings_.settings[content_type] = setting;
default_settings_dictionary->SetWithoutPathExpansion(
dictionary_path, Value::CreateIntegerValue(setting));
}
@@ -194,7 +194,7 @@ RuleIterator* DefaultProvider::GetRuleIterator(
base::AutoLock lock(lock_);
if (resource_identifier.empty()) {
return new DefaultRuleIterator(
- default_content_settings_[content_type]);
+ default_content_settings_.settings[content_type]);
} else {
return new EmptyRuleIterator();
}
@@ -254,29 +254,27 @@ void DefaultProvider::ReadDefaultSettings(bool overwrite) {
const DictionaryValue* default_settings_dictionary =
prefs_->GetDictionary(prefs::kDefaultContentSettings);
- if (overwrite) {
- for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i)
- default_content_settings_[i] = CONTENT_SETTING_DEFAULT;
- }
+ if (overwrite)
+ default_content_settings_ = ContentSettings();
// Careful: The returned value could be NULL if the pref has never been set.
if (default_settings_dictionary) {
GetSettingsFromDictionary(default_settings_dictionary,
- default_content_settings_);
+ &default_content_settings_);
}
ForceDefaultsToBeExplicit();
}
void DefaultProvider::ForceDefaultsToBeExplicit() {
for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) {
- if (default_content_settings_[i] == CONTENT_SETTING_DEFAULT)
- default_content_settings_[i] = kDefaultSettings[i];
+ if (default_content_settings_.settings[i] == CONTENT_SETTING_DEFAULT)
+ default_content_settings_.settings[i] = kDefaultSettings[i];
}
}
void DefaultProvider::GetSettingsFromDictionary(
const DictionaryValue* dictionary,
- ContentSetting* settings) {
+ ContentSettings* settings) {
for (DictionaryValue::key_iterator i(dictionary->begin_keys());
i != dictionary->end_keys(); ++i) {
const std::string& content_type(*i);
@@ -286,18 +284,19 @@ void DefaultProvider::GetSettingsFromDictionary(
bool found = dictionary->GetIntegerWithoutPathExpansion(content_type,
&setting);
DCHECK(found);
- settings[type] = IntToContentSetting(setting);
+ settings->settings[type] = IntToContentSetting(setting);
break;
}
}
}
// Migrate obsolete cookie prompt mode/
- if (settings[CONTENT_SETTINGS_TYPE_COOKIES] == CONTENT_SETTING_ASK)
- settings[CONTENT_SETTINGS_TYPE_COOKIES] = CONTENT_SETTING_BLOCK;
+ if (settings->settings[CONTENT_SETTINGS_TYPE_COOKIES] ==
+ CONTENT_SETTING_ASK)
+ settings->settings[CONTENT_SETTINGS_TYPE_COOKIES] = CONTENT_SETTING_BLOCK;
- settings[CONTENT_SETTINGS_TYPE_PLUGINS] =
+ settings->settings[CONTENT_SETTINGS_TYPE_PLUGINS] =
ClickToPlayFixup(CONTENT_SETTINGS_TYPE_PLUGINS,
- settings[CONTENT_SETTINGS_TYPE_PLUGINS]);
+ settings->settings[CONTENT_SETTINGS_TYPE_PLUGINS]);
}
void DefaultProvider::MigrateObsoleteNotificationPref() {
diff --git a/chrome/browser/content_settings/content_settings_default_provider.h b/chrome/browser/content_settings/content_settings_default_provider.h
index f9ddaff..f4a9c34 100644
--- a/chrome/browser/content_settings/content_settings_default_provider.h
+++ b/chrome/browser/content_settings/content_settings_default_provider.h
@@ -57,7 +57,7 @@ class DefaultProvider : public ObservableProvider,
private:
// Sets the fields of |settings| based on the values in |dictionary|.
void GetSettingsFromDictionary(const base::DictionaryValue* dictionary,
- ContentSetting* settings);
+ ContentSettings* settings);
// Forces the default settings to be explicitly set instead of themselves
// being CONTENT_SETTING_DEFAULT.
@@ -71,7 +71,7 @@ class DefaultProvider : public ObservableProvider,
void MigrateObsoleteGeolocationPref();
// Copies of the pref data, so that we can read it on the IO thread.
- ContentSetting default_content_settings_[CONTENT_SETTINGS_NUM_TYPES];
+ ContentSettings default_content_settings_;
PrefService* prefs_;
diff --git a/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc b/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc
index edefe97..50e56ff 100644
--- a/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc
+++ b/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc
@@ -53,6 +53,15 @@ void ExpectObsoleteGeolocationSetting(
namespace content_settings {
+bool SettingsEqual(const ContentSettings& settings1,
+ const ContentSettings& settings2) {
+ for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) {
+ if (settings1.settings[i] != settings2.settings[i])
+ return false;
+ }
+ return true;
+}
+
class DeadlockCheckerThread : public base::PlatformThread::Delegate {
public:
explicit DeadlockCheckerThread(PrefProvider* provider)
diff --git a/chrome/browser/content_settings/host_content_settings_map.cc b/chrome/browser/content_settings/host_content_settings_map.cc
index 2c09ad2..b0baa04 100644
--- a/chrome/browser/content_settings/host_content_settings_map.cc
+++ b/chrome/browser/content_settings/host_content_settings_map.cc
@@ -163,6 +163,16 @@ ContentSetting HostContentSettingsMap::GetDefaultContentSetting(
return CONTENT_SETTING_DEFAULT;
}
+ContentSettings HostContentSettingsMap::GetDefaultContentSettings() const {
+ ContentSettings output(CONTENT_SETTING_DEFAULT);
+ for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) {
+ if (!ContentTypeHasCompoundValue(ContentSettingsType(i)))
+ output.settings[i] = GetDefaultContentSetting(ContentSettingsType(i),
+ NULL);
+ }
+ return output;
+}
+
ContentSetting HostContentSettingsMap::GetContentSetting(
const GURL& primary_url,
const GURL& secondary_url,
@@ -173,6 +183,23 @@ ContentSetting HostContentSettingsMap::GetContentSetting(
return content_settings::ValueToContentSetting(value.get());
}
+ContentSettings HostContentSettingsMap::GetContentSettings(
+ const GURL& primary_url) const {
+ ContentSettings output;
+ // If we require a resource identifier, set the content settings to default,
+ // otherwise make the defaults explicit. Values for content type
+ // CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE can't be mapped to the type
+ // |ContentSetting|. So we ignore them here.
+ for (int j = 0; j < CONTENT_SETTINGS_NUM_TYPES; ++j) {
+ ContentSettingsType type = ContentSettingsType(j);
+ if (!ContentTypeHasCompoundValue(type)) {
+ output.settings[j] = GetContentSetting(
+ primary_url, primary_url, ContentSettingsType(j), std::string());
+ }
+ }
+ return output;
+}
+
void HostContentSettingsMap::GetSettingsForOneType(
ContentSettingsType content_type,
const std::string& resource_identifier,
diff --git a/chrome/browser/content_settings/host_content_settings_map.h b/chrome/browser/content_settings/host_content_settings_map.h
index a6f8700..7c91008 100644
--- a/chrome/browser/content_settings/host_content_settings_map.h
+++ b/chrome/browser/content_settings/host_content_settings_map.h
@@ -60,6 +60,11 @@ class HostContentSettingsMap
ContentSetting GetDefaultContentSetting(ContentSettingsType content_type,
std::string* provider_id) const;
+ // Returns the default settings for all content types.
+ //
+ // This may be called on any thread.
+ ContentSettings GetDefaultContentSettings() const;
+
// Returns a single |ContentSetting| which applies to the given URLs. Note
// that certain internal schemes are whitelisted. For |CONTENT_TYPE_COOKIES|,
// |CookieSettings| should be used instead. For content types that can't be
@@ -93,6 +98,14 @@ class HostContentSettingsMap
const std::string& resource_identifier,
content_settings::SettingInfo* info) const;
+ // Returns all ContentSettings which apply to the given |primary_url|. For
+ // content setting types that require an additional resource identifier, the
+ // default content setting is returned.
+ //
+ // This may be called on any thread.
+ ContentSettings GetContentSettings(
+ const GURL& primary_url) const;
+
// For a given content type, returns all patterns with a non-default setting,
// mapped to their actual settings, in the precedence order of the rules.
// |settings| must be a non-NULL outparam.
diff --git a/chrome/browser/content_settings/host_content_settings_map_unittest.cc b/chrome/browser/content_settings/host_content_settings_map_unittest.cc
index 44fd8db..0965bc3 100644
--- a/chrome/browser/content_settings/host_content_settings_map_unittest.cc
+++ b/chrome/browser/content_settings/host_content_settings_map_unittest.cc
@@ -26,6 +26,23 @@ using content::BrowserThread;
using ::testing::_;
+namespace {
+
+bool SettingsEqual(const ContentSettings& settings1,
+ const ContentSettings& settings2) {
+ for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) {
+ if (settings1.settings[i] != settings2.settings[i]) {
+ LOG(ERROR) << "type: " << i
+ << " [expected: " << settings1.settings[i]
+ << " actual: " << settings2.settings[i] << "]";
+ return false;
+ }
+ }
+ return true;
+}
+
+} // namespace
+
class HostContentSettingsMapTest : public testing::Test {
public:
HostContentSettingsMapTest() : ui_thread_(BrowserThread::UI, &message_loop_) {
@@ -109,51 +126,48 @@ TEST_F(HostContentSettingsMapTest, IndividualSettings) {
host, host, CONTENT_SETTINGS_TYPE_PLUGINS, ""));
// Check returning all settings for a host.
+ ContentSettings desired_settings;
+ desired_settings.settings[CONTENT_SETTINGS_TYPE_COOKIES] =
+ CONTENT_SETTING_ALLOW;
host_content_settings_map->SetContentSetting(
pattern,
ContentSettingsPattern::Wildcard(),
CONTENT_SETTINGS_TYPE_IMAGES,
std::string(),
CONTENT_SETTING_DEFAULT);
- EXPECT_EQ(CONTENT_SETTING_ALLOW,
- host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, ""));
+ desired_settings.settings[CONTENT_SETTINGS_TYPE_IMAGES] =
+ CONTENT_SETTING_ALLOW;
host_content_settings_map->SetContentSetting(
pattern,
ContentSettingsPattern::Wildcard(),
CONTENT_SETTINGS_TYPE_JAVASCRIPT,
std::string(),
CONTENT_SETTING_BLOCK);
- EXPECT_EQ(CONTENT_SETTING_BLOCK,
- host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, ""));
+ desired_settings.settings[CONTENT_SETTINGS_TYPE_JAVASCRIPT] =
+ CONTENT_SETTING_BLOCK;
host_content_settings_map->SetContentSetting(
pattern,
ContentSettingsPattern::Wildcard(),
CONTENT_SETTINGS_TYPE_PLUGINS,
std::string(),
CONTENT_SETTING_ALLOW);
- EXPECT_EQ(CONTENT_SETTING_ALLOW,
- host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_PLUGINS, ""));
- EXPECT_EQ(CONTENT_SETTING_BLOCK,
- host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_POPUPS, ""));
- EXPECT_EQ(CONTENT_SETTING_ASK,
- host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_GEOLOCATION, ""));
- EXPECT_EQ(CONTENT_SETTING_ASK,
- host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, ""));
- EXPECT_EQ(CONTENT_SETTING_ASK,
- host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_INTENTS, ""));
- EXPECT_EQ(CONTENT_SETTING_ASK,
- host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_FULLSCREEN, ""));
- EXPECT_EQ(CONTENT_SETTING_ASK,
- host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_MOUSELOCK, ""));
+ desired_settings.settings[CONTENT_SETTINGS_TYPE_PLUGINS] =
+ CONTENT_SETTING_ALLOW;
+ desired_settings.settings[CONTENT_SETTINGS_TYPE_POPUPS] =
+ CONTENT_SETTING_BLOCK;
+ desired_settings.settings[CONTENT_SETTINGS_TYPE_GEOLOCATION] =
+ CONTENT_SETTING_ASK;
+ desired_settings.settings[CONTENT_SETTINGS_TYPE_NOTIFICATIONS] =
+ CONTENT_SETTING_ASK;
+ desired_settings.settings[CONTENT_SETTINGS_TYPE_INTENTS] =
+ CONTENT_SETTING_ASK;
+ desired_settings.settings[CONTENT_SETTINGS_TYPE_FULLSCREEN] =
+ CONTENT_SETTING_ASK;
+ desired_settings.settings[CONTENT_SETTINGS_TYPE_MOUSELOCK] =
+ CONTENT_SETTING_ASK;
+ ContentSettings settings =
+ host_content_settings_map->GetContentSettings(host);
+ EXPECT_TRUE(SettingsEqual(desired_settings, settings));
// Check returning all hosts for a setting.
ContentSettingsPattern pattern2 =
@@ -589,36 +603,48 @@ TEST_F(HostContentSettingsMapTest, NestedSettings) {
host_content_settings_map->SetDefaultContentSetting(
CONTENT_SETTINGS_TYPE_JAVASCRIPT, CONTENT_SETTING_BLOCK);
- EXPECT_EQ(CONTENT_SETTING_BLOCK,
- host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_COOKIES, ""));
- EXPECT_EQ(CONTENT_SETTING_BLOCK,
- host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, ""));
- EXPECT_EQ(CONTENT_SETTING_BLOCK,
- host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, ""));
- EXPECT_EQ(CONTENT_SETTING_BLOCK,
- host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_PLUGINS, ""));
- EXPECT_EQ(CONTENT_SETTING_BLOCK,
- host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_POPUPS, ""));
- EXPECT_EQ(CONTENT_SETTING_ASK,
- host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_GEOLOCATION, ""));
- EXPECT_EQ(CONTENT_SETTING_ASK,
- host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, ""));
- EXPECT_EQ(CONTENT_SETTING_ASK,
- host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_INTENTS, ""));
- EXPECT_EQ(CONTENT_SETTING_ASK,
- host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_FULLSCREEN, ""));
- EXPECT_EQ(CONTENT_SETTING_ASK,
- host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_MOUSELOCK, ""));
+ ContentSettings desired_settings;
+ desired_settings.settings[CONTENT_SETTINGS_TYPE_COOKIES] =
+ CONTENT_SETTING_BLOCK;
+ desired_settings.settings[CONTENT_SETTINGS_TYPE_IMAGES] =
+ CONTENT_SETTING_BLOCK;
+ desired_settings.settings[CONTENT_SETTINGS_TYPE_JAVASCRIPT] =
+ CONTENT_SETTING_BLOCK;
+ desired_settings.settings[CONTENT_SETTINGS_TYPE_PLUGINS] =
+ CONTENT_SETTING_BLOCK;
+ desired_settings.settings[CONTENT_SETTINGS_TYPE_POPUPS] =
+ CONTENT_SETTING_BLOCK;
+ desired_settings.settings[CONTENT_SETTINGS_TYPE_GEOLOCATION] =
+ CONTENT_SETTING_ASK;
+ desired_settings.settings[CONTENT_SETTINGS_TYPE_NOTIFICATIONS] =
+ CONTENT_SETTING_ASK;
+ desired_settings.settings[CONTENT_SETTINGS_TYPE_INTENTS] =
+ CONTENT_SETTING_ASK;
+ desired_settings.settings[CONTENT_SETTINGS_TYPE_FULLSCREEN] =
+ CONTENT_SETTING_ASK;
+ desired_settings.settings[CONTENT_SETTINGS_TYPE_MOUSELOCK] =
+ CONTENT_SETTING_ASK;
+ ContentSettings settings =
+ host_content_settings_map->GetContentSettings(host);
+ EXPECT_TRUE(SettingsEqual(desired_settings, settings));
+ EXPECT_EQ(desired_settings.settings[CONTENT_SETTINGS_TYPE_COOKIES],
+ settings.settings[CONTENT_SETTINGS_TYPE_COOKIES]);
+ EXPECT_EQ(desired_settings.settings[CONTENT_SETTINGS_TYPE_IMAGES],
+ settings.settings[CONTENT_SETTINGS_TYPE_IMAGES]);
+ EXPECT_EQ(desired_settings.settings[CONTENT_SETTINGS_TYPE_PLUGINS],
+ settings.settings[CONTENT_SETTINGS_TYPE_PLUGINS]);
+ EXPECT_EQ(desired_settings.settings[CONTENT_SETTINGS_TYPE_POPUPS],
+ settings.settings[CONTENT_SETTINGS_TYPE_POPUPS]);
+ EXPECT_EQ(desired_settings.settings[CONTENT_SETTINGS_TYPE_GEOLOCATION],
+ settings.settings[CONTENT_SETTINGS_TYPE_GEOLOCATION]);
+ EXPECT_EQ(desired_settings.settings[CONTENT_SETTINGS_TYPE_COOKIES],
+ settings.settings[CONTENT_SETTINGS_TYPE_COOKIES]);
+ EXPECT_EQ(desired_settings.settings[CONTENT_SETTINGS_TYPE_INTENTS],
+ settings.settings[CONTENT_SETTINGS_TYPE_INTENTS]);
+ EXPECT_EQ(desired_settings.settings[CONTENT_SETTINGS_TYPE_FULLSCREEN],
+ settings.settings[CONTENT_SETTINGS_TYPE_FULLSCREEN]);
+ EXPECT_EQ(desired_settings.settings[CONTENT_SETTINGS_TYPE_MOUSELOCK],
+ settings.settings[CONTENT_SETTINGS_TYPE_MOUSELOCK]);
}
TEST_F(HostContentSettingsMapTest, OffTheRecord) {
@@ -788,9 +814,10 @@ TEST_F(HostContentSettingsMapTest, ResourceIdentifier) {
ContentSetting default_plugin_setting =
host_content_settings_map->GetDefaultContentSetting(
CONTENT_SETTINGS_TYPE_PLUGINS, NULL);
+ ContentSettings settings =
+ host_content_settings_map->GetContentSettings(host);
EXPECT_EQ(default_plugin_setting,
- host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_PLUGINS, ""));
+ settings.settings[CONTENT_SETTINGS_TYPE_PLUGINS]);
// If no resource-specific content settings are defined, the setting should be
// DEFAULT.
diff --git a/chrome/browser/content_settings/mock_settings_observer.cc b/chrome/browser/content_settings/mock_settings_observer.cc
index a281a1d..a0cc5b1 100644
--- a/chrome/browser/content_settings/mock_settings_observer.cc
+++ b/chrome/browser/content_settings/mock_settings_observer.cc
@@ -34,6 +34,5 @@ void MockSettingsObserver::Observe(
settings_details->update_all());
// This checks that calling a Get function from an observer doesn't
// deadlock.
- GURL url("http://random-hostname.com/");
- map->GetContentSetting(url, url, CONTENT_SETTINGS_TYPE_IMAGES, "");
+ map->GetContentSettings(GURL("http://random-hostname.com/"));
}
diff --git a/chrome/browser/content_settings/tab_specific_content_settings.cc b/chrome/browser/content_settings/tab_specific_content_settings.cc
index fda4042..91948d5 100644
--- a/chrome/browser/content_settings/tab_specific_content_settings.cc
+++ b/chrome/browser/content_settings/tab_specific_content_settings.cc
@@ -431,6 +431,15 @@ void TabSpecificContentSettings::DidNavigateMainFramePostCommit(
}
}
+void TabSpecificContentSettings::RenderViewCreated(
+ RenderViewHost* render_view_host) {
+ Profile* profile =
+ Profile::FromBrowserContext(tab_contents()->browser_context());
+ HostContentSettingsMap* map = profile->GetHostContentSettingsMap();
+ render_view_host->Send(new ChromeViewMsg_SetDefaultContentSettings(
+ map->GetDefaultContentSettings()));
+}
+
void TabSpecificContentSettings::DidStartProvisionalLoadForFrame(
int64 frame_id,
bool is_main_frame,
@@ -477,9 +486,13 @@ void TabSpecificContentSettings::Observe(
settings_details.ptr()->primary_pattern().Matches(entry_url)) {
Profile* profile =
Profile::FromBrowserContext(tab_contents()->browser_context());
+ HostContentSettingsMap* map = profile->GetHostContentSettingsMap();
+ Send(new ChromeViewMsg_SetDefaultContentSettings(
+ map->GetDefaultContentSettings()));
+ Send(new ChromeViewMsg_SetContentSettingsForCurrentURL(
+ entry_url, map->GetContentSettings(entry_url)));
RendererContentSettingRules rules;
- GetRendererContentSettingRules(profile->GetHostContentSettingsMap(),
- &rules);
+ GetRendererContentSettingRules(map, &rules);
Send(new ChromeViewMsg_SetContentSettingRules(rules));
}
}
diff --git a/chrome/browser/content_settings/tab_specific_content_settings.h b/chrome/browser/content_settings/tab_specific_content_settings.h
index cef428d..c240759 100644
--- a/chrome/browser/content_settings/tab_specific_content_settings.h
+++ b/chrome/browser/content_settings/tab_specific_content_settings.h
@@ -163,6 +163,7 @@ class TabSpecificContentSettings : public TabContentsObserver,
virtual void DidNavigateMainFramePostCommit(
const content::LoadCommittedDetails& details,
const ViewHostMsg_FrameNavigate_Params& params) OVERRIDE;
+ virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE;
virtual void DidStartProvisionalLoadForFrame(
int64 frame_id,
bool is_main_frame,