summaryrefslogtreecommitdiffstats
path: root/chrome/browser/content_settings
diff options
context:
space:
mode:
authordcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-09 06:41:12 +0000
committerdcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-09 06:41:12 +0000
commit69d7f89d6a93e0fbce451960287066195c6d4ea0 (patch)
tree51c8c1f971d39d652ec38ed76070539bb33e85c7 /chrome/browser/content_settings
parente3748a79b523a8d365d4a33ef986eebb4186fa78 (diff)
downloadchromium_src-69d7f89d6a93e0fbce451960287066195c6d4ea0.zip
chromium_src-69d7f89d6a93e0fbce451960287066195c6d4ea0.tar.gz
chromium_src-69d7f89d6a93e0fbce451960287066195c6d4ea0.tar.bz2
Revert "Rewrite std::string("") to std::string(), Linux edition."
This reverts commit e59558b78e8c6a1b0bd916a724724b638c3c91b6. Revert "Fix build after r193020." This reverts commit 558a35897f6b3ffbcaefde927c1f150b815d140a. Revert "Really fix build after r193020." This reverts commit e3748a79b523a8d365d4a33ef986eebb4186fa78. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@193030 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/content_settings')
-rw-r--r--chrome/browser/content_settings/content_settings_browsertest.cc24
-rw-r--r--chrome/browser/content_settings/content_settings_internal_extension_provider.cc6
-rw-r--r--chrome/browser/content_settings/content_settings_origin_identifier_value_map_unittest.cc125
-rw-r--r--chrome/browser/content_settings/content_settings_policy_provider.cc2
-rw-r--r--chrome/browser/content_settings/content_settings_policy_provider_unittest.cc99
-rw-r--r--chrome/browser/content_settings/content_settings_pref_provider.cc27
-rw-r--r--chrome/browser/content_settings/content_settings_pref_provider_unittest.cc142
-rw-r--r--chrome/browser/content_settings/content_settings_provider.h2
-rw-r--r--chrome/browser/content_settings/content_settings_provider_unittest.cc15
-rw-r--r--chrome/browser/content_settings/content_settings_utils.cc8
-rw-r--r--chrome/browser/content_settings/content_settings_utils_unittest.cc2
-rw-r--r--chrome/browser/content_settings/cookie_settings.cc27
-rw-r--r--chrome/browser/content_settings/host_content_settings_map.cc17
-rw-r--r--chrome/browser/content_settings/host_content_settings_map_unittest.cc238
-rw-r--r--chrome/browser/content_settings/mock_settings_observer.cc2
15 files changed, 327 insertions, 409 deletions
diff --git a/chrome/browser/content_settings/content_settings_browsertest.cc b/chrome/browser/content_settings/content_settings_browsertest.cc
index f4105ad..88c664c 100644
--- a/chrome/browser/content_settings/content_settings_browsertest.cc
+++ b/chrome/browser/content_settings/content_settings_browsertest.cc
@@ -338,12 +338,12 @@ IN_PROC_BROWSER_TEST_F(ClickToPlayPluginTest, AllowException) {
browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting(
CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_BLOCK);
- browser()->profile()->GetHostContentSettingsMap()
- ->SetContentSetting(ContentSettingsPattern::FromURL(url),
- ContentSettingsPattern::Wildcard(),
- CONTENT_SETTINGS_TYPE_PLUGINS,
- std::string(),
- CONTENT_SETTING_ALLOW);
+ browser()->profile()->GetHostContentSettingsMap()->SetContentSetting(
+ ContentSettingsPattern::FromURL(url),
+ ContentSettingsPattern::Wildcard(),
+ CONTENT_SETTINGS_TYPE_PLUGINS,
+ "",
+ CONTENT_SETTING_ALLOW);
string16 expected_title(ASCIIToUTF16("OK"));
content::TitleWatcher title_watcher(
@@ -357,12 +357,12 @@ IN_PROC_BROWSER_TEST_F(ClickToPlayPluginTest, BlockException) {
GURL url = ui_test_utils::GetTestUrl(
base::FilePath(), base::FilePath().AppendASCII("clicktoplay.html"));
- browser()->profile()->GetHostContentSettingsMap()
- ->SetContentSetting(ContentSettingsPattern::FromURL(url),
- ContentSettingsPattern::Wildcard(),
- CONTENT_SETTINGS_TYPE_PLUGINS,
- std::string(),
- CONTENT_SETTING_BLOCK);
+ browser()->profile()->GetHostContentSettingsMap()->SetContentSetting(
+ ContentSettingsPattern::FromURL(url),
+ ContentSettingsPattern::Wildcard(),
+ CONTENT_SETTINGS_TYPE_PLUGINS,
+ "",
+ CONTENT_SETTING_BLOCK);
string16 expected_title(ASCIIToUTF16("Click To Play"));
content::TitleWatcher title_watcher(
diff --git a/chrome/browser/content_settings/content_settings_internal_extension_provider.cc b/chrome/browser/content_settings/content_settings_internal_extension_provider.cc
index 56dd993..815d037 100644
--- a/chrome/browser/content_settings/content_settings_internal_extension_provider.cc
+++ b/chrome/browser/content_settings/content_settings_internal_extension_provider.cc
@@ -117,19 +117,19 @@ void InternalExtensionProvider::SetContentSettingForExtension(
value_map_.DeleteValue(primary_pattern,
secondary_pattern,
CONTENT_SETTINGS_TYPE_PLUGINS,
- ResourceIdentifier());
+ ResourceIdentifier(""));
} else {
value_map_.SetValue(primary_pattern,
secondary_pattern,
CONTENT_SETTINGS_TYPE_PLUGINS,
- ResourceIdentifier(),
+ ResourceIdentifier(""),
Value::CreateIntegerValue(setting));
}
}
NotifyObservers(primary_pattern,
secondary_pattern,
CONTENT_SETTINGS_TYPE_PLUGINS,
- ResourceIdentifier());
+ ResourceIdentifier(""));
}
} // namespace content_settings
diff --git a/chrome/browser/content_settings/content_settings_origin_identifier_value_map_unittest.cc b/chrome/browser/content_settings/content_settings_origin_identifier_value_map_unittest.cc
index b8612a5..21089fb 100644
--- a/chrome/browser/content_settings/content_settings_origin_identifier_value_map_unittest.cc
+++ b/chrome/browser/content_settings/content_settings_origin_identifier_value_map_unittest.cc
@@ -14,40 +14,38 @@
TEST(OriginIdentifierValueMapTest, SetGetValue) {
content_settings::OriginIdentifierValueMap map;
- EXPECT_EQ(NULL,
- map.GetValue(GURL("http://www.google.com"),
- GURL("http://www.google.com"),
- CONTENT_SETTINGS_TYPE_COOKIES,
- std::string()));
- map.SetValue(ContentSettingsPattern::FromString("[*.]google.com"),
- ContentSettingsPattern::FromString("[*.]google.com"),
- CONTENT_SETTINGS_TYPE_COOKIES,
- std::string(),
- Value::CreateIntegerValue(1));
+ EXPECT_EQ(NULL, map.GetValue(GURL("http://www.google.com"),
+ GURL("http://www.google.com"),
+ CONTENT_SETTINGS_TYPE_COOKIES,
+ ""));
+ map.SetValue(
+ ContentSettingsPattern::FromString("[*.]google.com"),
+ ContentSettingsPattern::FromString("[*.]google.com"),
+ CONTENT_SETTINGS_TYPE_COOKIES,
+ "",
+ Value::CreateIntegerValue(1));
scoped_ptr<Value> expected_value(Value::CreateIntegerValue(1));
- EXPECT_TRUE(expected_value->Equals(map.GetValue(GURL("http://www.google.com"),
- GURL("http://www.google.com"),
- CONTENT_SETTINGS_TYPE_COOKIES,
- std::string())));
-
- EXPECT_EQ(NULL,
- map.GetValue(GURL("http://www.google.com"),
- GURL("http://www.youtube.com"),
- CONTENT_SETTINGS_TYPE_COOKIES,
- std::string()));
-
- EXPECT_EQ(NULL,
- map.GetValue(GURL("http://www.youtube.com"),
- GURL("http://www.google.com"),
- CONTENT_SETTINGS_TYPE_COOKIES,
- std::string()));
-
- EXPECT_EQ(NULL,
- map.GetValue(GURL("http://www.google.com"),
- GURL("http://www.google.com"),
- CONTENT_SETTINGS_TYPE_POPUPS,
- std::string()));
+ EXPECT_TRUE(expected_value->Equals(
+ map.GetValue(GURL("http://www.google.com"),
+ GURL("http://www.google.com"),
+ CONTENT_SETTINGS_TYPE_COOKIES,
+ "")));
+
+ EXPECT_EQ(NULL, map.GetValue(GURL("http://www.google.com"),
+ GURL("http://www.youtube.com"),
+ CONTENT_SETTINGS_TYPE_COOKIES,
+ ""));
+
+ EXPECT_EQ(NULL, map.GetValue(GURL("http://www.youtube.com"),
+ GURL("http://www.google.com"),
+ CONTENT_SETTINGS_TYPE_COOKIES,
+ ""));
+
+ EXPECT_EQ(NULL, map.GetValue(GURL("http://www.google.com"),
+ GURL("http://www.google.com"),
+ CONTENT_SETTINGS_TYPE_POPUPS,
+ ""));
EXPECT_EQ(NULL, map.GetValue(GURL("http://www.google.com"),
GURL("http://www.google.com"),
@@ -121,11 +119,12 @@ TEST(OriginIdentifierValueMapTest, Clear) {
CONTENT_SETTINGS_TYPE_PLUGINS,
"java-plugin",
Value::CreateIntegerValue(1));
- map.SetValue(ContentSettingsPattern::FromString("[*.]google.com"),
- ContentSettingsPattern::FromString("[*.]google.com"),
- CONTENT_SETTINGS_TYPE_COOKIES,
- std::string(),
- Value::CreateIntegerValue(1));
+ map.SetValue(
+ ContentSettingsPattern::FromString("[*.]google.com"),
+ ContentSettingsPattern::FromString("[*.]google.com"),
+ CONTENT_SETTINGS_TYPE_COOKIES,
+ "",
+ Value::CreateIntegerValue(1));
EXPECT_FALSE(map.empty());
int actual_value;
EXPECT_TRUE(map.GetValue(GURL("http://www.google.com"),
@@ -146,36 +145,38 @@ TEST(OriginIdentifierValueMapTest, Clear) {
TEST(OriginIdentifierValueMapTest, ListEntryPrecedences) {
content_settings::OriginIdentifierValueMap map;
- map.SetValue(ContentSettingsPattern::FromString("[*.]google.com"),
- ContentSettingsPattern::FromString("[*.]google.com"),
- CONTENT_SETTINGS_TYPE_COOKIES,
- std::string(),
- Value::CreateIntegerValue(1));
+ map.SetValue(
+ ContentSettingsPattern::FromString("[*.]google.com"),
+ ContentSettingsPattern::FromString("[*.]google.com"),
+ CONTENT_SETTINGS_TYPE_COOKIES,
+ "",
+ Value::CreateIntegerValue(1));
- map.SetValue(ContentSettingsPattern::FromString("www.google.com"),
- ContentSettingsPattern::FromString("[*.]google.com"),
- CONTENT_SETTINGS_TYPE_COOKIES,
- std::string(),
- Value::CreateIntegerValue(2));
+ map.SetValue(
+ ContentSettingsPattern::FromString("www.google.com"),
+ ContentSettingsPattern::FromString("[*.]google.com"),
+ CONTENT_SETTINGS_TYPE_COOKIES,
+ "",
+ Value::CreateIntegerValue(2));
int actual_value;
EXPECT_TRUE(map.GetValue(GURL("http://mail.google.com"),
GURL("http://www.google.com"),
CONTENT_SETTINGS_TYPE_COOKIES,
- std::string())->GetAsInteger(&actual_value));
+ "")->GetAsInteger(&actual_value));
EXPECT_EQ(1, actual_value);
EXPECT_TRUE(map.GetValue(GURL("http://www.google.com"),
GURL("http://www.google.com"),
CONTENT_SETTINGS_TYPE_COOKIES,
- std::string())->GetAsInteger(&actual_value));
+ "")->GetAsInteger(&actual_value));
EXPECT_EQ(2, actual_value);
}
TEST(OriginIdentifierValueMapTest, IterateEmpty) {
content_settings::OriginIdentifierValueMap map;
scoped_ptr<content_settings::RuleIterator> rule_iterator(
- map.GetRuleIterator(CONTENT_SETTINGS_TYPE_COOKIES, std::string(), NULL));
+ map.GetRuleIterator(CONTENT_SETTINGS_TYPE_COOKIES, "", NULL));
EXPECT_FALSE(rule_iterator->HasNext());
}
@@ -186,19 +187,21 @@ TEST(OriginIdentifierValueMapTest, IterateNonempty) {
ContentSettingsPattern::FromString("[*.]google.com");
ContentSettingsPattern sub_pattern =
ContentSettingsPattern::FromString("sub.google.com");
- map.SetValue(pattern,
- ContentSettingsPattern::Wildcard(),
- CONTENT_SETTINGS_TYPE_COOKIES,
- std::string(),
- Value::CreateIntegerValue(1));
- map.SetValue(sub_pattern,
- ContentSettingsPattern::Wildcard(),
- CONTENT_SETTINGS_TYPE_COOKIES,
- std::string(),
- Value::CreateIntegerValue(2));
+ map.SetValue(
+ pattern,
+ ContentSettingsPattern::Wildcard(),
+ CONTENT_SETTINGS_TYPE_COOKIES,
+ "",
+ Value::CreateIntegerValue(1));
+ map.SetValue(
+ sub_pattern,
+ ContentSettingsPattern::Wildcard(),
+ CONTENT_SETTINGS_TYPE_COOKIES,
+ "",
+ Value::CreateIntegerValue(2));
scoped_ptr<content_settings::RuleIterator> rule_iterator(
- map.GetRuleIterator(CONTENT_SETTINGS_TYPE_COOKIES, std::string(), NULL));
+ map.GetRuleIterator(CONTENT_SETTINGS_TYPE_COOKIES, "", NULL));
ASSERT_TRUE(rule_iterator->HasNext());
content_settings::Rule rule = rule_iterator->Next();
EXPECT_EQ(sub_pattern, rule.primary_pattern);
diff --git a/chrome/browser/content_settings/content_settings_policy_provider.cc b/chrome/browser/content_settings/content_settings_policy_provider.cc
index f1e40fb..b112db0 100644
--- a/chrome/browser/content_settings/content_settings_policy_provider.cc
+++ b/chrome/browser/content_settings/content_settings_policy_provider.cc
@@ -276,7 +276,7 @@ void PolicyProvider::GetContentSettingsFromPreferences(
pattern_pair.first,
secondary_pattern,
content_type,
- NO_RESOURCE_IDENTIFIER,
+ ResourceIdentifier(NO_RESOURCE_IDENTIFIER),
base::Value::CreateIntegerValue(
kPrefsForManagedContentSettingsMap[i].setting));
}
diff --git a/chrome/browser/content_settings/content_settings_policy_provider_unittest.cc b/chrome/browser/content_settings/content_settings_policy_provider_unittest.cc
index 37b718c..23c43f8 100644
--- a/chrome/browser/content_settings/content_settings_policy_provider_unittest.cc
+++ b/chrome/browser/content_settings/content_settings_policy_provider_unittest.cc
@@ -150,34 +150,22 @@ TEST_F(PolicyProviderTest, GettingManagedContentSettings) {
GURL google_url("http://mail.google.com");
EXPECT_EQ(CONTENT_SETTING_DEFAULT,
- GetContentSetting(&provider,
- youtube_url,
- youtube_url,
- CONTENT_SETTINGS_TYPE_COOKIES,
- std::string(),
- false));
+ GetContentSetting(
+ &provider, youtube_url, youtube_url,
+ CONTENT_SETTINGS_TYPE_COOKIES, "", false));
EXPECT_EQ(NULL,
- GetContentSettingValue(&provider,
- youtube_url,
- youtube_url,
- CONTENT_SETTINGS_TYPE_COOKIES,
- std::string(),
- false));
+ GetContentSettingValue(
+ &provider, youtube_url, youtube_url,
+ CONTENT_SETTINGS_TYPE_COOKIES, "", false));
EXPECT_EQ(CONTENT_SETTING_BLOCK,
- GetContentSetting(&provider,
- google_url,
- google_url,
- CONTENT_SETTINGS_TYPE_IMAGES,
- std::string(),
- false));
+ GetContentSetting(
+ &provider, google_url, google_url,
+ CONTENT_SETTINGS_TYPE_IMAGES, "", false));
scoped_ptr<Value> value_ptr(
- GetContentSettingValue(&provider,
- google_url,
- google_url,
- CONTENT_SETTINGS_TYPE_IMAGES,
- std::string(),
- false));
+ GetContentSettingValue(
+ &provider, google_url, google_url,
+ CONTENT_SETTINGS_TYPE_IMAGES, "", false));
int int_value = -1;
value_ptr->GetAsInteger(&int_value);
@@ -188,19 +176,17 @@ TEST_F(PolicyProviderTest, GettingManagedContentSettings) {
// SetWebsiteSetting does nothing.
scoped_ptr<base::Value> value_block(
Value::CreateIntegerValue(CONTENT_SETTING_BLOCK));
- bool owned = provider.SetWebsiteSetting(yt_url_pattern,
- yt_url_pattern,
- CONTENT_SETTINGS_TYPE_COOKIES,
- std::string(),
- value_block.get());
+ bool owned = provider.SetWebsiteSetting(
+ yt_url_pattern,
+ yt_url_pattern,
+ CONTENT_SETTINGS_TYPE_COOKIES,
+ "",
+ value_block.get());
EXPECT_FALSE(owned);
EXPECT_EQ(CONTENT_SETTING_DEFAULT,
- GetContentSetting(&provider,
- youtube_url,
- youtube_url,
- CONTENT_SETTINGS_TYPE_COOKIES,
- std::string(),
- false));
+ GetContentSetting(
+ &provider, youtube_url, youtube_url,
+ CONTENT_SETTINGS_TYPE_COOKIES, "", false));
provider.ShutdownOnUIThread();
}
@@ -227,12 +213,9 @@ TEST_F(PolicyProviderTest, ResourceIdentifier) {
// There is currently no policy support for resource content settings.
// Resource identifiers are simply ignored by the PolicyProvider.
EXPECT_EQ(CONTENT_SETTING_ALLOW,
- GetContentSetting(&provider,
- google_url,
- google_url,
- CONTENT_SETTINGS_TYPE_PLUGINS,
- std::string(),
- false));
+ GetContentSetting(
+ &provider, google_url, google_url,
+ CONTENT_SETTINGS_TYPE_PLUGINS, "", false));
EXPECT_EQ(CONTENT_SETTING_DEFAULT,
GetContentSetting(
@@ -249,14 +232,10 @@ TEST_F(PolicyProviderTest, AutoSelectCertificateList) {
PolicyProvider provider(prefs);
GURL google_url("https://mail.google.com");
// Tests the default setting for auto selecting certificates
- EXPECT_EQ(
- NULL,
- GetContentSettingValue(&provider,
- google_url,
- google_url,
- CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE,
- std::string(),
- false));
+ EXPECT_EQ(NULL,
+ GetContentSettingValue(
+ &provider, google_url, google_url,
+ CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, "", false));
// Set the content settings pattern list for origins to auto select
// certificates.
@@ -268,21 +247,13 @@ TEST_F(PolicyProviderTest, AutoSelectCertificateList) {
prefs->SetManagedPref(prefs::kManagedAutoSelectCertificateForUrls,
value);
GURL youtube_url("https://www.youtube.com");
- EXPECT_EQ(
- NULL,
- GetContentSettingValue(&provider,
- youtube_url,
- youtube_url,
- CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE,
- std::string(),
- false));
- scoped_ptr<Value> cert_filter(
- GetContentSettingValue(&provider,
- google_url,
- google_url,
- CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE,
- std::string(),
- false));
+ EXPECT_EQ(NULL,
+ GetContentSettingValue(
+ &provider, youtube_url, youtube_url,
+ CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, "", false));
+ scoped_ptr<Value> cert_filter(GetContentSettingValue(
+ &provider, google_url, google_url,
+ CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, "", false));
ASSERT_EQ(Value::TYPE_DICTIONARY, cert_filter->GetType());
DictionaryValue* dict_value =
diff --git a/chrome/browser/content_settings/content_settings_pref_provider.cc b/chrome/browser/content_settings/content_settings_pref_provider.cc
index 4690f2f..a92315e 100644
--- a/chrome/browser/content_settings/content_settings_pref_provider.cc
+++ b/chrome/browser/content_settings/content_settings_pref_provider.cc
@@ -188,21 +188,22 @@ void PrefProvider::ClearAllContentSettingsRules(
{
base::AutoLock auto_lock(lock_);
scoped_ptr<RuleIterator> rule_iterator(
- map_to_modify->GetRuleIterator(content_type, std::string(), NULL));
+ map_to_modify->GetRuleIterator(content_type, "", NULL));
// Copy the rules; we cannot call |UpdatePref| while holding |lock_|.
while (rule_iterator->HasNext())
rules_to_delete.push_back(rule_iterator->Next());
- map_to_modify->DeleteValues(content_type, std::string());
+ map_to_modify->DeleteValues(content_type, "");
}
for (std::vector<Rule>::const_iterator it = rules_to_delete.begin();
it != rules_to_delete.end(); ++it) {
- UpdatePref(it->primary_pattern,
- it->secondary_pattern,
- content_type,
- std::string(),
- NULL);
+ UpdatePref(
+ it->primary_pattern,
+ it->secondary_pattern,
+ content_type,
+ "",
+ NULL);
}
NotifyObservers(ContentSettingsPattern(),
ContentSettingsPattern(),
@@ -306,8 +307,8 @@ void PrefProvider::UpdatePref(
void PrefProvider::MigrateObsoleteMediaContentSetting() {
std::vector<Rule> rules_to_delete;
{
- scoped_ptr<RuleIterator> rule_iterator(GetRuleIterator(
- CONTENT_SETTINGS_TYPE_MEDIASTREAM, std::string(), false));
+ scoped_ptr<RuleIterator> rule_iterator(
+ GetRuleIterator(CONTENT_SETTINGS_TYPE_MEDIASTREAM, "", false));
while (rule_iterator->HasNext()) {
// Skip default setting and rules without a value.
const content_settings::Rule& rule = rule_iterator->Next();
@@ -332,7 +333,7 @@ void PrefProvider::MigrateObsoleteMediaContentSetting() {
SetWebsiteSetting(it->primary_pattern,
it->secondary_pattern,
CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC,
- std::string(),
+ "",
Value::CreateIntegerValue(CONTENT_SETTING_ALLOW));
}
// Add the exception to the new camera content setting.
@@ -340,7 +341,7 @@ void PrefProvider::MigrateObsoleteMediaContentSetting() {
SetWebsiteSetting(it->primary_pattern,
it->secondary_pattern,
CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA,
- std::string(),
+ "",
Value::CreateIntegerValue(CONTENT_SETTING_ALLOW));
}
@@ -348,7 +349,7 @@ void PrefProvider::MigrateObsoleteMediaContentSetting() {
SetWebsiteSetting(it->primary_pattern,
it->secondary_pattern,
CONTENT_SETTINGS_TYPE_MEDIASTREAM,
- std::string(),
+ "",
NULL);
}
}
@@ -454,7 +455,7 @@ void PrefProvider::ReadContentSettingsFromPref(bool overwrite) {
value_map_.SetValue(pattern_pair.first,
pattern_pair.second,
content_type,
- ResourceIdentifier(),
+ ResourceIdentifier(""),
value);
if (content_type == CONTENT_SETTINGS_TYPE_COOKIES) {
ContentSetting s = ValueToContentSetting(value);
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 1ddc6d0..f951829 100644
--- a/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc
+++ b/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc
@@ -121,7 +121,7 @@ TEST_F(PrefProviderTest, Observer) {
pattern,
ContentSettingsPattern::Wildcard(),
CONTENT_SETTINGS_TYPE_IMAGES,
- std::string(),
+ "",
Value::CreateIntegerValue(CONTENT_SETTING_ALLOW));
pref_content_settings_provider.ShutdownOnUIThread();
@@ -166,26 +166,20 @@ TEST_F(PrefProviderTest, Incognito) {
pattern,
pattern,
CONTENT_SETTINGS_TYPE_IMAGES,
- std::string(),
+ "",
Value::CreateIntegerValue(CONTENT_SETTING_ALLOW));
GURL host("http://example.com/");
// The value should of course be visible in the regular PrefProvider.
EXPECT_EQ(CONTENT_SETTING_ALLOW,
- GetContentSetting(&pref_content_settings_provider,
- host,
- host,
- CONTENT_SETTINGS_TYPE_IMAGES,
- std::string(),
- false));
+ GetContentSetting(
+ &pref_content_settings_provider,
+ host, host, CONTENT_SETTINGS_TYPE_IMAGES, "", false));
// And also in the OTR version.
EXPECT_EQ(CONTENT_SETTING_ALLOW,
- GetContentSetting(&pref_content_settings_provider_incognito,
- host,
- host,
- CONTENT_SETTINGS_TYPE_IMAGES,
- std::string(),
- false));
+ GetContentSetting(
+ &pref_content_settings_provider_incognito,
+ host, host, CONTENT_SETTINGS_TYPE_IMAGES, "", false));
// But the value should not be overridden in the OTR user prefs accidentally.
EXPECT_FALSE(otr_user_prefs->IsSetInOverlay(
prefs::kContentSettingsPatternPairs));
@@ -203,40 +197,26 @@ TEST_F(PrefProviderTest, GetContentSettingsValue) {
ContentSettingsPattern::FromString("[*.]example.com");
EXPECT_EQ(CONTENT_SETTING_DEFAULT,
- GetContentSetting(&provider,
- primary_url,
- primary_url,
- CONTENT_SETTINGS_TYPE_IMAGES,
- std::string(),
- false));
+ GetContentSetting(&provider, primary_url, primary_url,
+ CONTENT_SETTINGS_TYPE_IMAGES, "", false));
EXPECT_EQ(NULL,
- GetContentSettingValue(&provider,
- primary_url,
- primary_url,
- CONTENT_SETTINGS_TYPE_IMAGES,
- std::string(),
- false));
+ GetContentSettingValue(
+ &provider, primary_url, primary_url,
+ CONTENT_SETTINGS_TYPE_IMAGES, "", false));
- provider.SetWebsiteSetting(primary_pattern,
- primary_pattern,
- CONTENT_SETTINGS_TYPE_IMAGES,
- std::string(),
- Value::CreateIntegerValue(CONTENT_SETTING_BLOCK));
+ provider.SetWebsiteSetting(
+ primary_pattern,
+ primary_pattern,
+ CONTENT_SETTINGS_TYPE_IMAGES,
+ "",
+ Value::CreateIntegerValue(CONTENT_SETTING_BLOCK));
EXPECT_EQ(CONTENT_SETTING_BLOCK,
- GetContentSetting(&provider,
- primary_url,
- primary_url,
- CONTENT_SETTINGS_TYPE_IMAGES,
- std::string(),
- false));
+ GetContentSetting(&provider, primary_url, primary_url,
+ CONTENT_SETTINGS_TYPE_IMAGES, "", false));
scoped_ptr<Value> value_ptr(
- GetContentSettingValue(&provider,
- primary_url,
- primary_url,
- CONTENT_SETTINGS_TYPE_IMAGES,
- std::string(),
- false));
+ GetContentSettingValue(&provider, primary_url, primary_url,
+ CONTENT_SETTINGS_TYPE_IMAGES, "", false));
int int_value = -1;
value_ptr->GetAsInteger(&int_value);
EXPECT_EQ(CONTENT_SETTING_BLOCK, IntToContentSetting(int_value));
@@ -244,15 +224,12 @@ TEST_F(PrefProviderTest, GetContentSettingsValue) {
provider.SetWebsiteSetting(primary_pattern,
primary_pattern,
CONTENT_SETTINGS_TYPE_IMAGES,
- std::string(),
+ "",
NULL);
EXPECT_EQ(NULL,
- GetContentSettingValue(&provider,
- primary_url,
- primary_url,
- CONTENT_SETTINGS_TYPE_IMAGES,
- std::string(),
- false));
+ GetContentSettingValue(
+ &provider, primary_url, primary_url,
+ CONTENT_SETTINGS_TYPE_IMAGES, "", false));
provider.ShutdownOnUIThread();
}
@@ -273,74 +250,53 @@ TEST_F(PrefProviderTest, Patterns) {
ContentSettingsPattern::FromString("file:///tmp/test.html");
EXPECT_EQ(CONTENT_SETTING_DEFAULT,
- GetContentSetting(&pref_content_settings_provider,
- host1,
- host1,
- CONTENT_SETTINGS_TYPE_IMAGES,
- std::string(),
- false));
+ GetContentSetting(
+ &pref_content_settings_provider,
+ host1, host1, CONTENT_SETTINGS_TYPE_IMAGES, "", false));
pref_content_settings_provider.SetWebsiteSetting(
pattern1,
pattern1,
CONTENT_SETTINGS_TYPE_IMAGES,
- std::string(),
+ "",
Value::CreateIntegerValue(CONTENT_SETTING_BLOCK));
EXPECT_EQ(CONTENT_SETTING_BLOCK,
- GetContentSetting(&pref_content_settings_provider,
- host1,
- host1,
- CONTENT_SETTINGS_TYPE_IMAGES,
- std::string(),
- false));
+ GetContentSetting(
+ &pref_content_settings_provider,
+ host1, host1, CONTENT_SETTINGS_TYPE_IMAGES, "", false));
EXPECT_EQ(CONTENT_SETTING_BLOCK,
- GetContentSetting(&pref_content_settings_provider,
- host2,
- host2,
- CONTENT_SETTINGS_TYPE_IMAGES,
- std::string(),
- false));
+ GetContentSetting(
+ &pref_content_settings_provider,
+ host2, host2, CONTENT_SETTINGS_TYPE_IMAGES, "", false));
EXPECT_EQ(CONTENT_SETTING_DEFAULT,
- GetContentSetting(&pref_content_settings_provider,
- host3,
- host3,
- CONTENT_SETTINGS_TYPE_IMAGES,
- std::string(),
- false));
+ GetContentSetting(
+ &pref_content_settings_provider,
+ host3, host3, CONTENT_SETTINGS_TYPE_IMAGES, "", false));
pref_content_settings_provider.SetWebsiteSetting(
pattern2,
pattern2,
CONTENT_SETTINGS_TYPE_IMAGES,
- std::string(),
+ "",
Value::CreateIntegerValue(CONTENT_SETTING_BLOCK));
EXPECT_EQ(CONTENT_SETTING_BLOCK,
- GetContentSetting(&pref_content_settings_provider,
- host3,
- host3,
- CONTENT_SETTINGS_TYPE_IMAGES,
- std::string(),
- false));
+ GetContentSetting(
+ &pref_content_settings_provider,
+ host3, host3, CONTENT_SETTINGS_TYPE_IMAGES, "", false));
EXPECT_EQ(CONTENT_SETTING_DEFAULT,
GetContentSetting(&pref_content_settings_provider,
- host4,
- host4,
- CONTENT_SETTINGS_TYPE_IMAGES,
- std::string(),
+ host4, host4, CONTENT_SETTINGS_TYPE_IMAGES, "",
false));
pref_content_settings_provider.SetWebsiteSetting(
pattern3,
pattern3,
CONTENT_SETTINGS_TYPE_IMAGES,
- std::string(),
+ "",
Value::CreateIntegerValue(CONTENT_SETTING_BLOCK));
EXPECT_EQ(CONTENT_SETTING_BLOCK,
- GetContentSetting(&pref_content_settings_provider,
- host4,
- host4,
- CONTENT_SETTINGS_TYPE_IMAGES,
- std::string(),
- false));
+ GetContentSetting(
+ &pref_content_settings_provider,
+ host4, host4, CONTENT_SETTINGS_TYPE_IMAGES, "", false));
pref_content_settings_provider.ShutdownOnUIThread();
}
diff --git a/chrome/browser/content_settings/content_settings_provider.h b/chrome/browser/content_settings/content_settings_provider.h
index 6bc64de..fefa226 100644
--- a/chrome/browser/content_settings/content_settings_provider.h
+++ b/chrome/browser/content_settings/content_settings_provider.h
@@ -7,7 +7,7 @@
#ifndef CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PROVIDER_H_
#define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PROVIDER_H_
-#define NO_RESOURCE_IDENTIFIER std::string()
+#define NO_RESOURCE_IDENTIFIER ""
#include <string>
#include <vector>
diff --git a/chrome/browser/content_settings/content_settings_provider_unittest.cc b/chrome/browser/content_settings/content_settings_provider_unittest.cc
index 0832a1c..e0857b3 100644
--- a/chrome/browser/content_settings/content_settings_provider_unittest.cc
+++ b/chrome/browser/content_settings/content_settings_provider_unittest.cc
@@ -46,18 +46,11 @@ TEST(ContentSettingsProviderTest, Mock) {
CONTENT_SETTINGS_TYPE_PLUGINS,
"flash_plugin", false));
EXPECT_EQ(CONTENT_SETTING_DEFAULT,
- GetContentSetting(&mock_provider,
- url,
- url,
- CONTENT_SETTINGS_TYPE_GEOLOCATION,
- std::string(),
- false));
+ GetContentSetting(&mock_provider, url, url,
+ CONTENT_SETTINGS_TYPE_GEOLOCATION, "", false));
EXPECT_EQ(NULL,
- GetContentSettingValue(&mock_provider,
- url,
- url,
- CONTENT_SETTINGS_TYPE_GEOLOCATION,
- std::string(),
+ GetContentSettingValue(&mock_provider, url, url,
+ CONTENT_SETTINGS_TYPE_GEOLOCATION, "",
false));
bool owned = mock_provider.SetWebsiteSetting(
diff --git a/chrome/browser/content_settings/content_settings_utils.cc b/chrome/browser/content_settings/content_settings_utils.cc
index 9754ba1..d3a2869 100644
--- a/chrome/browser/content_settings/content_settings_utils.cc
+++ b/chrome/browser/content_settings/content_settings_utils.cc
@@ -190,10 +190,10 @@ ContentSetting GetContentSetting(const ProviderInterface* provider,
void GetRendererContentSettingRules(const HostContentSettingsMap* map,
RendererContentSettingRules* rules) {
- map->GetSettingsForOneType(
- CONTENT_SETTINGS_TYPE_IMAGES, std::string(), &(rules->image_rules));
- map->GetSettingsForOneType(
- CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string(), &(rules->script_rules));
+ map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_IMAGES, "",
+ &(rules->image_rules));
+ map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_JAVASCRIPT, "",
+ &(rules->script_rules));
}
} // namespace content_settings
diff --git a/chrome/browser/content_settings/content_settings_utils_unittest.cc b/chrome/browser/content_settings/content_settings_utils_unittest.cc
index d5eeeca..69f88c1 100644
--- a/chrome/browser/content_settings/content_settings_utils_unittest.cc
+++ b/chrome/browser/content_settings/content_settings_utils_unittest.cc
@@ -11,7 +11,7 @@
TEST(ContentSettingsUtilsTest, ParsePatternString) {
content_settings::PatternPair pattern_pair;
- pattern_pair = content_settings::ParsePatternString(std::string());
+ pattern_pair = content_settings::ParsePatternString("");
EXPECT_FALSE(pattern_pair.first.IsValid());
EXPECT_FALSE(pattern_pair.second.IsValid());
diff --git a/chrome/browser/content_settings/cookie_settings.cc b/chrome/browser/content_settings/cookie_settings.cc
index e0b1ff6..e34a56e 100644
--- a/chrome/browser/content_settings/cookie_settings.cc
+++ b/chrome/browser/content_settings/cookie_settings.cc
@@ -130,7 +130,7 @@ bool CookieSettings::IsCookieSessionOnly(const GURL& origin) const {
void CookieSettings::GetCookieSettings(
ContentSettingsForOneType* settings) const {
return host_content_settings_map_->GetSettingsForOneType(
- CONTENT_SETTINGS_TYPE_COOKIES, std::string(), settings);
+ CONTENT_SETTINGS_TYPE_COOKIES, "", settings);
}
void CookieSettings::SetDefaultCookieSetting(ContentSetting setting) {
@@ -147,21 +147,17 @@ void CookieSettings::SetCookieSetting(
if (setting == CONTENT_SETTING_SESSION_ONLY) {
DCHECK(secondary_pattern == ContentSettingsPattern::Wildcard());
}
- host_content_settings_map_->SetContentSetting(primary_pattern,
- secondary_pattern,
- CONTENT_SETTINGS_TYPE_COOKIES,
- std::string(),
- setting);
+ host_content_settings_map_->SetContentSetting(
+ primary_pattern, secondary_pattern, CONTENT_SETTINGS_TYPE_COOKIES, "",
+ setting);
}
void CookieSettings::ResetCookieSetting(
const ContentSettingsPattern& primary_pattern,
const ContentSettingsPattern& secondary_pattern) {
- host_content_settings_map_->SetContentSetting(primary_pattern,
- secondary_pattern,
- CONTENT_SETTINGS_TYPE_COOKIES,
- std::string(),
- CONTENT_SETTING_DEFAULT);
+ host_content_settings_map_->SetContentSetting(
+ primary_pattern, secondary_pattern, CONTENT_SETTINGS_TYPE_COOKIES, "",
+ CONTENT_SETTING_DEFAULT);
}
void CookieSettings::ShutdownOnUIThread() {
@@ -180,12 +176,9 @@ ContentSetting CookieSettings::GetCookieSetting(
// First get any host-specific settings.
content_settings::SettingInfo info;
- scoped_ptr<base::Value> value(host_content_settings_map_->GetWebsiteSetting(
- url,
- first_party_url,
- CONTENT_SETTINGS_TYPE_COOKIES,
- std::string(),
- &info));
+ scoped_ptr<base::Value> value(
+ host_content_settings_map_->GetWebsiteSetting(
+ url, first_party_url, CONTENT_SETTINGS_TYPE_COOKIES, "", &info));
if (source)
*source = info.source;
diff --git a/chrome/browser/content_settings/host_content_settings_map.cc b/chrome/browser/content_settings/host_content_settings_map.cc
index 777203d..8749d6f 100644
--- a/chrome/browser/content_settings/host_content_settings_map.cc
+++ b/chrome/browser/content_settings/host_content_settings_map.cc
@@ -133,7 +133,7 @@ void HostContentSettingsMap::RegisterExtensionService(
OnContentSettingChanged(ContentSettingsPattern(),
ContentSettingsPattern(),
CONTENT_SETTINGS_TYPE_DEFAULT,
- std::string());
+ "");
}
#endif
@@ -159,7 +159,7 @@ ContentSetting HostContentSettingsMap::GetDefaultContentSettingFromProvider(
ContentSettingsType content_type,
content_settings::ProviderInterface* provider) const {
scoped_ptr<content_settings::RuleIterator> rule_iterator(
- provider->GetRuleIterator(content_type, std::string(), false));
+ provider->GetRuleIterator(content_type, "", false));
ContentSettingsPattern wildcard = ContentSettingsPattern::Wildcard();
while (rule_iterator->HasNext()) {
@@ -460,18 +460,19 @@ void HostContentSettingsMap::MigrateObsoleteClearOnExitPref() {
AddSettingsForOneType(content_settings_providers_[PREF_PROVIDER],
PREF_PROVIDER,
CONTENT_SETTINGS_TYPE_COOKIES,
- std::string(),
+ "",
&exceptions,
false);
for (ContentSettingsForOneType::iterator it = exceptions.begin();
it != exceptions.end(); ++it) {
if (it->setting != CONTENT_SETTING_ALLOW)
continue;
- SetWebsiteSetting(it->primary_pattern,
- it->secondary_pattern,
- CONTENT_SETTINGS_TYPE_COOKIES,
- std::string(),
- Value::CreateIntegerValue(CONTENT_SETTING_SESSION_ONLY));
+ SetWebsiteSetting(
+ it->primary_pattern,
+ it->secondary_pattern,
+ CONTENT_SETTINGS_TYPE_COOKIES,
+ "",
+ Value::CreateIntegerValue(CONTENT_SETTING_SESSION_ONLY));
}
prefs_->SetBoolean(prefs::kContentSettingsClearOnExitMigrated, true);
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 bba4336..57fd929 100644
--- a/chrome/browser/content_settings/host_content_settings_map_unittest.cc
+++ b/chrome/browser/content_settings/host_content_settings_map_unittest.cc
@@ -81,16 +81,16 @@ TEST_F(HostContentSettingsMapTest, IndividualSettings) {
ContentSettingsPattern::FromString("[*.]example.com");
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_IMAGES, ""));
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, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_IMAGES, ""));
host_content_settings_map->SetContentSetting(
pattern,
ContentSettingsPattern::Wildcard(),
@@ -99,10 +99,10 @@ TEST_F(HostContentSettingsMapTest, IndividualSettings) {
CONTENT_SETTING_BLOCK);
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_IMAGES, ""));
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_PLUGINS, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_PLUGINS, ""));
// Check returning all settings for a host.
host_content_settings_map->SetContentSetting(
@@ -113,7 +113,7 @@ TEST_F(HostContentSettingsMapTest, IndividualSettings) {
CONTENT_SETTING_DEFAULT);
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_IMAGES, ""));
host_content_settings_map->SetContentSetting(
pattern,
ContentSettingsPattern::Wildcard(),
@@ -122,7 +122,7 @@ TEST_F(HostContentSettingsMapTest, IndividualSettings) {
CONTENT_SETTING_BLOCK);
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, ""));
host_content_settings_map->SetContentSetting(
pattern,
ContentSettingsPattern::Wildcard(),
@@ -131,23 +131,22 @@ TEST_F(HostContentSettingsMapTest, IndividualSettings) {
CONTENT_SETTING_ALLOW);
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_PLUGINS, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_PLUGINS, ""));
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_POPUPS, std::string()));
+ 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_GEOLOCATION, std::string()));
- EXPECT_EQ(
- CONTENT_SETTING_ASK,
- host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, ""));
EXPECT_EQ(CONTENT_SETTING_ASK,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_FULLSCREEN, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_FULLSCREEN, ""));
EXPECT_EQ(CONTENT_SETTING_ASK,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_MOUSELOCK, ""));
// Check returning all hosts for a setting.
ContentSettingsPattern pattern2 =
@@ -165,16 +164,18 @@ TEST_F(HostContentSettingsMapTest, IndividualSettings) {
std::string(),
CONTENT_SETTING_BLOCK);
ContentSettingsForOneType host_settings;
- host_content_settings_map->GetSettingsForOneType(
- CONTENT_SETTINGS_TYPE_IMAGES, std::string(), &host_settings);
+ host_content_settings_map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_IMAGES,
+ "",
+ &host_settings);
// |host_settings| contains the default setting and an exception.
EXPECT_EQ(2U, host_settings.size());
host_content_settings_map->GetSettingsForOneType(
- CONTENT_SETTINGS_TYPE_PLUGINS, std::string(), &host_settings);
+ CONTENT_SETTINGS_TYPE_PLUGINS, "", &host_settings);
// |host_settings| contains the default setting and 2 exceptions.
EXPECT_EQ(3U, host_settings.size());
- host_content_settings_map->GetSettingsForOneType(
- CONTENT_SETTINGS_TYPE_POPUPS, std::string(), &host_settings);
+ host_content_settings_map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_POPUPS,
+ "",
+ &host_settings);
// |host_settings| contains only the default setting.
EXPECT_EQ(1U, host_settings.size());
}
@@ -216,12 +217,13 @@ TEST_F(HostContentSettingsMapTest, Clear) {
host_content_settings_map->ClearSettingsForOneType(
CONTENT_SETTINGS_TYPE_IMAGES);
ContentSettingsForOneType host_settings;
- host_content_settings_map->GetSettingsForOneType(
- CONTENT_SETTINGS_TYPE_IMAGES, std::string(), &host_settings);
+ host_content_settings_map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_IMAGES,
+ "",
+ &host_settings);
// |host_settings| contains only the default setting.
EXPECT_EQ(1U, host_settings.size());
host_content_settings_map->GetSettingsForOneType(
- CONTENT_SETTINGS_TYPE_PLUGINS, std::string(), &host_settings);
+ CONTENT_SETTINGS_TYPE_PLUGINS, "", &host_settings);
// |host_settings| contains the default setting and an exception.
EXPECT_EQ(2U, host_settings.size());
}
@@ -240,7 +242,7 @@ TEST_F(HostContentSettingsMapTest, Patterns) {
ContentSettingsPattern::FromString("example.org");
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetContentSetting(
- host1, host1, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host1, host1, CONTENT_SETTINGS_TYPE_IMAGES, ""));
host_content_settings_map->SetContentSetting(
pattern1,
ContentSettingsPattern::Wildcard(),
@@ -249,13 +251,13 @@ TEST_F(HostContentSettingsMapTest, Patterns) {
CONTENT_SETTING_BLOCK);
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
- host1, host1, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host1, host1, CONTENT_SETTINGS_TYPE_IMAGES, ""));
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
- host2, host2, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host2, host2, CONTENT_SETTINGS_TYPE_IMAGES, ""));
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetContentSetting(
- host3, host3, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host3, host3, CONTENT_SETTINGS_TYPE_IMAGES, ""));
host_content_settings_map->SetContentSetting(
pattern2,
ContentSettingsPattern::Wildcard(),
@@ -264,7 +266,7 @@ TEST_F(HostContentSettingsMapTest, Patterns) {
CONTENT_SETTING_BLOCK);
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
- host3, host3, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host3, host3, CONTENT_SETTINGS_TYPE_IMAGES, ""));
}
TEST_F(HostContentSettingsMapTest, Observer) {
@@ -325,7 +327,7 @@ TEST_F(HostContentSettingsMapTest, ObserveDefaultPref) {
CONTENT_SETTINGS_TYPE_IMAGES, CONTENT_SETTING_BLOCK);
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_IMAGES, ""));
// Make a copy of the pref's new value so we can reset it later.
scoped_ptr<Value> new_value(prefs->FindPreference(
@@ -335,13 +337,13 @@ TEST_F(HostContentSettingsMapTest, ObserveDefaultPref) {
prefs->Set(prefs::kDefaultContentSettings, *default_value);
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_IMAGES, ""));
// Reseting the pref to its previous value should update the cache.
prefs->Set(prefs::kDefaultContentSettings, *new_value);
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_IMAGES, ""));
}
TEST_F(HostContentSettingsMapTest, ObserveExceptionPref) {
@@ -361,7 +363,7 @@ TEST_F(HostContentSettingsMapTest, ObserveExceptionPref) {
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_IMAGES, ""));
host_content_settings_map->SetContentSetting(
pattern,
@@ -371,7 +373,7 @@ TEST_F(HostContentSettingsMapTest, ObserveExceptionPref) {
CONTENT_SETTING_BLOCK);
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_IMAGES, ""));
// Make a copy of the pref's new value so we can reset it later.
scoped_ptr<Value> new_value(prefs->FindPreference(
@@ -381,13 +383,13 @@ TEST_F(HostContentSettingsMapTest, ObserveExceptionPref) {
prefs->Set(prefs::kContentSettingsPatternPairs, *default_value);
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_IMAGES, ""));
// Reseting the pref to its previous value should update the cache.
prefs->Set(prefs::kContentSettingsPatternPairs, *new_value);
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_IMAGES, ""));
}
TEST_F(HostContentSettingsMapTest, HostTrimEndingDotCheck) {
@@ -411,26 +413,26 @@ TEST_F(HostContentSettingsMapTest, HostTrimEndingDotCheck) {
pattern,
ContentSettingsPattern::Wildcard(),
CONTENT_SETTINGS_TYPE_IMAGES,
- std::string(),
+ "",
CONTENT_SETTING_DEFAULT);
- EXPECT_EQ(
- CONTENT_SETTING_ALLOW,
- host_content_settings_map->GetContentSetting(host_ending_with_dot,
- host_ending_with_dot,
- CONTENT_SETTINGS_TYPE_IMAGES,
- std::string()));
+ EXPECT_EQ(CONTENT_SETTING_ALLOW,
+ host_content_settings_map->GetContentSetting(
+ host_ending_with_dot,
+ host_ending_with_dot,
+ CONTENT_SETTINGS_TYPE_IMAGES,
+ ""));
host_content_settings_map->SetContentSetting(
pattern,
ContentSettingsPattern::Wildcard(),
CONTENT_SETTINGS_TYPE_IMAGES,
- std::string(),
+ "",
CONTENT_SETTING_BLOCK);
- EXPECT_EQ(
- CONTENT_SETTING_BLOCK,
- host_content_settings_map->GetContentSetting(host_ending_with_dot,
- host_ending_with_dot,
- CONTENT_SETTINGS_TYPE_IMAGES,
- std::string()));
+ EXPECT_EQ(CONTENT_SETTING_BLOCK,
+ host_content_settings_map->GetContentSetting(
+ host_ending_with_dot,
+ host_ending_with_dot,
+ CONTENT_SETTINGS_TYPE_IMAGES,
+ ""));
EXPECT_TRUE(cookie_settings->IsSettingCookieAllowed(
host_ending_with_dot, host_ending_with_dot));
@@ -438,7 +440,7 @@ TEST_F(HostContentSettingsMapTest, HostTrimEndingDotCheck) {
pattern,
ContentSettingsPattern::Wildcard(),
CONTENT_SETTINGS_TYPE_COOKIES,
- std::string(),
+ "",
CONTENT_SETTING_DEFAULT);
EXPECT_TRUE(cookie_settings->IsSettingCookieAllowed(
host_ending_with_dot, host_ending_with_dot));
@@ -446,7 +448,7 @@ TEST_F(HostContentSettingsMapTest, HostTrimEndingDotCheck) {
pattern,
ContentSettingsPattern::Wildcard(),
CONTENT_SETTINGS_TYPE_COOKIES,
- std::string(),
+ "",
CONTENT_SETTING_BLOCK);
EXPECT_FALSE(cookie_settings->IsSettingCookieAllowed(
host_ending_with_dot, host_ending_with_dot));
@@ -456,93 +458,93 @@ TEST_F(HostContentSettingsMapTest, HostTrimEndingDotCheck) {
host_ending_with_dot,
host_ending_with_dot,
CONTENT_SETTINGS_TYPE_JAVASCRIPT,
- std::string()));
+ ""));
host_content_settings_map->SetContentSetting(
pattern,
ContentSettingsPattern::Wildcard(),
CONTENT_SETTINGS_TYPE_JAVASCRIPT,
- std::string(),
+ "",
CONTENT_SETTING_DEFAULT);
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetContentSetting(
host_ending_with_dot,
host_ending_with_dot,
CONTENT_SETTINGS_TYPE_JAVASCRIPT,
- std::string()));
+ ""));
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_ending_with_dot,
host_ending_with_dot,
CONTENT_SETTINGS_TYPE_JAVASCRIPT,
- std::string()));
+ ""));
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetContentSetting(
host_ending_with_dot,
host_ending_with_dot,
CONTENT_SETTINGS_TYPE_PLUGINS,
- std::string()));
+ ""));
host_content_settings_map->SetContentSetting(
pattern,
ContentSettingsPattern::Wildcard(),
CONTENT_SETTINGS_TYPE_PLUGINS,
- std::string(),
+ "",
CONTENT_SETTING_DEFAULT);
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetContentSetting(
host_ending_with_dot,
host_ending_with_dot,
CONTENT_SETTINGS_TYPE_PLUGINS,
- std::string()));
+ ""));
host_content_settings_map->SetContentSetting(
pattern,
ContentSettingsPattern::Wildcard(),
CONTENT_SETTINGS_TYPE_PLUGINS,
- std::string(),
+ "",
CONTENT_SETTING_BLOCK);
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
host_ending_with_dot,
host_ending_with_dot,
CONTENT_SETTINGS_TYPE_PLUGINS,
- std::string()));
+ ""));
- EXPECT_EQ(
- CONTENT_SETTING_BLOCK,
- host_content_settings_map->GetContentSetting(host_ending_with_dot,
- host_ending_with_dot,
- CONTENT_SETTINGS_TYPE_POPUPS,
- std::string()));
+ EXPECT_EQ(CONTENT_SETTING_BLOCK,
+ host_content_settings_map->GetContentSetting(
+ host_ending_with_dot,
+ host_ending_with_dot,
+ CONTENT_SETTINGS_TYPE_POPUPS,
+ ""));
host_content_settings_map->SetContentSetting(
pattern,
ContentSettingsPattern::Wildcard(),
CONTENT_SETTINGS_TYPE_POPUPS,
- std::string(),
+ "",
CONTENT_SETTING_DEFAULT);
- EXPECT_EQ(
- CONTENT_SETTING_BLOCK,
- host_content_settings_map->GetContentSetting(host_ending_with_dot,
- host_ending_with_dot,
- CONTENT_SETTINGS_TYPE_POPUPS,
- std::string()));
+ EXPECT_EQ(CONTENT_SETTING_BLOCK,
+ host_content_settings_map->GetContentSetting(
+ host_ending_with_dot,
+ host_ending_with_dot,
+ CONTENT_SETTINGS_TYPE_POPUPS,
+ ""));
host_content_settings_map->SetContentSetting(
pattern,
ContentSettingsPattern::Wildcard(),
CONTENT_SETTINGS_TYPE_POPUPS,
- std::string(),
+ "",
CONTENT_SETTING_ALLOW);
- EXPECT_EQ(
- CONTENT_SETTING_ALLOW,
- host_content_settings_map->GetContentSetting(host_ending_with_dot,
- host_ending_with_dot,
- CONTENT_SETTINGS_TYPE_POPUPS,
- std::string()));
+ EXPECT_EQ(CONTENT_SETTING_ALLOW,
+ host_content_settings_map->GetContentSetting(
+ host_ending_with_dot,
+ host_ending_with_dot,
+ CONTENT_SETTINGS_TYPE_POPUPS,
+ ""));
}
TEST_F(HostContentSettingsMapTest, NestedSettings) {
@@ -562,53 +564,52 @@ TEST_F(HostContentSettingsMapTest, NestedSettings) {
pattern1,
ContentSettingsPattern::Wildcard(),
CONTENT_SETTINGS_TYPE_IMAGES,
- std::string(),
+ "",
CONTENT_SETTING_BLOCK);
host_content_settings_map->SetContentSetting(
pattern2,
ContentSettingsPattern::Wildcard(),
CONTENT_SETTINGS_TYPE_COOKIES,
- std::string(),
+ "",
CONTENT_SETTING_BLOCK);
host_content_settings_map->SetContentSetting(
pattern3,
ContentSettingsPattern::Wildcard(),
CONTENT_SETTINGS_TYPE_PLUGINS,
- std::string(),
+ "",
CONTENT_SETTING_BLOCK);
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, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_COOKIES, ""));
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_IMAGES, ""));
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, ""));
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_PLUGINS, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_PLUGINS, ""));
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_POPUPS, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_POPUPS, ""));
EXPECT_EQ(CONTENT_SETTING_ASK,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string()));
- EXPECT_EQ(
- CONTENT_SETTING_ASK,
- host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_GEOLOCATION, ""));
EXPECT_EQ(CONTENT_SETTING_ASK,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_FULLSCREEN, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, ""));
EXPECT_EQ(CONTENT_SETTING_ASK,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_FULLSCREEN, ""));
+ EXPECT_EQ(CONTENT_SETTING_ASK,
+ host_content_settings_map->GetContentSetting(
+ host, host, CONTENT_SETTINGS_TYPE_MOUSELOCK, ""));
}
TEST_F(HostContentSettingsMapTest, OffTheRecord) {
@@ -625,10 +626,10 @@ TEST_F(HostContentSettingsMapTest, OffTheRecord) {
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_IMAGES, ""));
EXPECT_EQ(CONTENT_SETTING_ALLOW,
otr_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_IMAGES, ""));
// Changing content settings on the main map should also affect the
// incognito map.
@@ -636,28 +637,27 @@ TEST_F(HostContentSettingsMapTest, OffTheRecord) {
pattern,
ContentSettingsPattern::Wildcard(),
CONTENT_SETTINGS_TYPE_IMAGES,
- std::string(),
+ "",
CONTENT_SETTING_BLOCK);
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_IMAGES, ""));
EXPECT_EQ(CONTENT_SETTING_BLOCK,
otr_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_IMAGES, ""));
// Changing content settings on the incognito map should NOT affect the
// main map.
- otr_map->SetContentSetting(pattern,
- ContentSettingsPattern::Wildcard(),
- CONTENT_SETTINGS_TYPE_IMAGES,
- std::string(),
- CONTENT_SETTING_ALLOW);
+ otr_map->SetContentSetting(
+ pattern,
+ ContentSettingsPattern::Wildcard(),
+ CONTENT_SETTINGS_TYPE_IMAGES, "", CONTENT_SETTING_ALLOW);
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_IMAGES, ""));
EXPECT_EQ(CONTENT_SETTING_ALLOW,
otr_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_IMAGES, ""));
otr_map->ShutdownOnUIThread();
}
@@ -738,7 +738,7 @@ TEST_F(HostContentSettingsMapTest, ResourceIdentifier) {
CONTENT_SETTINGS_TYPE_PLUGINS, NULL);
EXPECT_EQ(default_plugin_setting,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_PLUGINS, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_PLUGINS, ""));
// If no resource-specific content settings are defined, the setting should be
// DEFAULT.
@@ -865,7 +865,7 @@ TEST_F(HostContentSettingsMapTest,
pattern,
ContentSettingsPattern::Wildcard(),
CONTENT_SETTINGS_TYPE_JAVASCRIPT,
- std::string(),
+ "",
CONTENT_SETTING_BLOCK);
EXPECT_EQ(CONTENT_SETTING_ALLOW,
@@ -875,14 +875,14 @@ TEST_F(HostContentSettingsMapTest,
GURL host("http://example.com/");
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, ""));
// Set managed-default-content-setting for content-settings-type JavaScript.
prefs->SetManagedPref(prefs::kManagedDefaultJavaScriptSetting,
Value::CreateIntegerValue(CONTENT_SETTING_ALLOW));
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, ""));
}
// Managed default content setting should have higher priority
@@ -906,7 +906,7 @@ TEST_F(HostContentSettingsMapTest,
pattern,
ContentSettingsPattern::Wildcard(),
CONTENT_SETTINGS_TYPE_JAVASCRIPT,
- std::string(),
+ "",
CONTENT_SETTING_ALLOW);
EXPECT_EQ(CONTENT_SETTING_BLOCK,
@@ -915,20 +915,20 @@ TEST_F(HostContentSettingsMapTest,
GURL host("http://example.com/");
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, ""));
// Set managed-default-content-settings-preferences.
prefs->SetManagedPref(prefs::kManagedDefaultJavaScriptSetting,
Value::CreateIntegerValue(CONTENT_SETTING_BLOCK));
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, ""));
// Remove managed-default-content-settings-preferences.
prefs->RemoveManagedPref(prefs::kManagedDefaultJavaScriptSetting);
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, ""));
}
// If a default-content-setting is set to managed setting, the user defined
@@ -1004,10 +1004,10 @@ TEST_F(HostContentSettingsMapTest, GetContentSetting) {
CONTENT_SETTING_BLOCK);
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_IMAGES, ""));
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetContentSetting(
- embedder, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ embedder, host, CONTENT_SETTINGS_TYPE_IMAGES, ""));
}
TEST_F(HostContentSettingsMapTest, ShouldAllowAllContent) {
diff --git a/chrome/browser/content_settings/mock_settings_observer.cc b/chrome/browser/content_settings/mock_settings_observer.cc
index c8de7fa..a281a1d 100644
--- a/chrome/browser/content_settings/mock_settings_observer.cc
+++ b/chrome/browser/content_settings/mock_settings_observer.cc
@@ -35,5 +35,5 @@ void MockSettingsObserver::Observe(
// 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, std::string());
+ map->GetContentSetting(url, url, CONTENT_SETTINGS_TYPE_IMAGES, "");
}