diff options
Diffstat (limited to 'chrome/browser')
274 files changed, 2441 insertions, 1840 deletions
diff --git a/chrome/browser/about_flags_unittest.cc b/chrome/browser/about_flags_unittest.cc index 4720ce6..1f6ef04 100644 --- a/chrome/browser/about_flags_unittest.cc +++ b/chrome/browser/about_flags_unittest.cc @@ -285,7 +285,7 @@ TEST_F(AboutFlagsTest, CheckValues) { // Convert the flags to switches. ConvertFlagsToSwitches(&prefs_, &command_line); EXPECT_TRUE(command_line.HasSwitch(kSwitch1)); - EXPECT_EQ(std::string(""), command_line.GetSwitchValueASCII(kSwitch1)); + EXPECT_EQ(std::string(), command_line.GetSwitchValueASCII(kSwitch1)); EXPECT_TRUE(command_line.HasSwitch(kSwitch2)); EXPECT_EQ(std::string(kValueForSwitch2), command_line.GetSwitchValueASCII(kSwitch2)); diff --git a/chrome/browser/accessibility/accessibility_events.cc b/chrome/browser/accessibility/accessibility_events.cc index 65cf111..9a46ef6 100644 --- a/chrome/browser/accessibility/accessibility_events.cc +++ b/chrome/browser/accessibility/accessibility_events.cc @@ -166,7 +166,6 @@ AccessibilityTextBoxInfo::AccessibilityTextBoxInfo(Profile* profile, const std::string& context, bool password) : AccessibilityControlInfo(profile, name), - value_(""), password_(password), selection_start_(0), selection_end_(0) { diff --git a/chrome/browser/autofill/autofill_browsertest.cc b/chrome/browser/autofill/autofill_browsertest.cc index af63f86..b3d6f54 100644 --- a/chrome/browser/autofill/autofill_browsertest.cc +++ b/chrome/browser/autofill/autofill_browsertest.cc @@ -505,14 +505,14 @@ class AutofillTest : public InProcessBrowserTest { // The previewed values should not be accessible to JavaScript. ExpectFieldValue("firstname", "M"); - ExpectFieldValue("lastname", ""); - ExpectFieldValue("address1", ""); - ExpectFieldValue("address2", ""); - ExpectFieldValue("city", ""); - ExpectFieldValue("state", ""); - ExpectFieldValue("zip", ""); - ExpectFieldValue("country", ""); - ExpectFieldValue("phone", ""); + ExpectFieldValue("lastname", std::string()); + ExpectFieldValue("address1", std::string()); + ExpectFieldValue("address2", std::string()); + ExpectFieldValue("city", std::string()); + ExpectFieldValue("state", std::string()); + ExpectFieldValue("zip", std::string()); + ExpectFieldValue("country", std::string()); + ExpectFieldValue("phone", std::string()); // TODO(isherman): It would be nice to test that the previewed values are // displayed: http://crbug.com/57220 @@ -742,7 +742,7 @@ IN_PROC_BROWSER_TEST_F(AutofillTest, DISABLED_AutofillFormWithRepeatedField) { // Invoke Autofill. TryBasicFormFill(); - ExpectFieldValue("state_freeform", ""); + ExpectFieldValue("state_freeform", std::string()); } // http://crbug.com/150084 @@ -1307,8 +1307,8 @@ IN_PROC_BROWSER_TEST_F(AutofillTest, MAYBE_ComparePhoneNumbers) { ExpectFieldValue("PHONE_HOME_NUMBER_3-2", "555"); ExpectFieldValue("PHONE_HOME_NUMBER_4-1", "4567"); ExpectFieldValue("PHONE_HOME_NUMBER_4-2", "4567"); - ExpectFieldValue("PHONE_HOME_EXT-1", ""); - ExpectFieldValue("PHONE_HOME_EXT-2", ""); + ExpectFieldValue("PHONE_HOME_EXT-1", std::string()); + ExpectFieldValue("PHONE_HOME_EXT-2", std::string()); ExpectFieldValue("PHONE_HOME_COUNTRY_CODE-1", "1"); } @@ -1447,7 +1447,7 @@ IN_PROC_BROWSER_TEST_F(AutofillTest, MAYBE_NoAutofillForReadOnlyFields) { ui_test_utils::NavigateToURL(browser(), url); PopulateForm("firstname"); - ExpectFieldValue("email", ""); + ExpectFieldValue("email", std::string()); ExpectFieldValue("address", addr_line1); } diff --git a/chrome/browser/automation/automation_misc_browsertest.cc b/chrome/browser/automation/automation_misc_browsertest.cc index 97efd95..11ce614 100644 --- a/chrome/browser/automation/automation_misc_browsertest.cc +++ b/chrome/browser/automation/automation_misc_browsertest.cc @@ -82,8 +82,8 @@ IN_PROC_BROWSER_TEST_F(AutomationMiscBrowserTest, ProcessMouseEvent) { " window.didClick = true;" "}, true);")); AutomationMouseEvent automation_event; - automation_event.location_script_chain.push_back( - ScriptEvaluationRequest("{'x': 5, 'y': 10}", "")); + automation_event.location_script_chain + .push_back(ScriptEvaluationRequest("{'x': 5, 'y': 10}", std::string())); WebKit::WebMouseEvent& mouse_event = automation_event.mouse_event; mouse_event.type = WebKit::WebInputEvent::MouseDown; mouse_event.button = WebKit::WebMouseEvent::ButtonLeft; diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index ae9f48c..e176eec 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -991,7 +991,7 @@ void TestingAutomationProvider::GetTabTitle(int handle, NavigationController* tab = tab_tracker_->GetResource(handle); NavigationEntry* entry = tab->GetActiveEntry(); if (entry != NULL) { - *title = UTF16ToWideHack(entry->GetTitleForDisplay("")); + *title = UTF16ToWideHack(entry->GetTitleForDisplay(std::string())); } else { *title = std::wstring(); } @@ -3414,7 +3414,7 @@ void TestingAutomationProvider::RemoveSavedPassword( // This observer will delete itself. PasswordStoreLoginsChangedObserver* observer = new PasswordStoreLoginsChangedObserver( - this, reply_message, PasswordStoreChange::REMOVE, ""); + this, reply_message, PasswordStoreChange::REMOVE, std::string()); observer->Init(); password_store->RemoveLogin(to_remove); @@ -5353,7 +5353,7 @@ void TestingAutomationProvider::GetTabInfo( return; } DictionaryValue dict; - dict.SetString("title", entry->GetTitleForDisplay("")); + dict.SetString("title", entry->GetTitleForDisplay(std::string())); dict.SetString("url", entry->GetVirtualURL().spec()); reply.SendSuccess(&dict); } else { diff --git a/chrome/browser/bookmarks/bookmark_utils_unittest.cc b/chrome/browser/bookmarks/bookmark_utils_unittest.cc index f71645e..a5f253d 100644 --- a/chrome/browser/bookmarks/bookmark_utils_unittest.cc +++ b/chrome/browser/bookmarks/bookmark_utils_unittest.cc @@ -166,22 +166,31 @@ TEST_F(BookmarkUtilsTest, ApplyEditsWithNoFolderChange) { { BookmarkEditor::EditDetails detail( BookmarkEditor::EditDetails::AddFolder(bookmarkbar, 1)); - ApplyEditsWithNoFolderChange(&model, bookmarkbar, detail, - ASCIIToUTF16("folder0"), GURL("")); + ApplyEditsWithNoFolderChange(&model, + bookmarkbar, + detail, + ASCIIToUTF16("folder0"), + GURL(std::string())); EXPECT_EQ(ASCIIToUTF16("folder0"), bookmarkbar->GetChild(1)->GetTitle()); } { BookmarkEditor::EditDetails detail( BookmarkEditor::EditDetails::AddFolder(bookmarkbar, -1)); - ApplyEditsWithNoFolderChange(&model, bookmarkbar, detail, - ASCIIToUTF16("folder1"), GURL("")); + ApplyEditsWithNoFolderChange(&model, + bookmarkbar, + detail, + ASCIIToUTF16("folder1"), + GURL(std::string())); EXPECT_EQ(ASCIIToUTF16("folder1"), bookmarkbar->GetChild(3)->GetTitle()); } { BookmarkEditor::EditDetails detail( BookmarkEditor::EditDetails::AddFolder(bookmarkbar, 10)); - ApplyEditsWithNoFolderChange(&model, bookmarkbar, detail, - ASCIIToUTF16("folder2"), GURL("")); + ApplyEditsWithNoFolderChange(&model, + bookmarkbar, + detail, + ASCIIToUTF16("folder2"), + GURL(std::string())); EXPECT_EQ(ASCIIToUTF16("folder2"), bookmarkbar->GetChild(4)->GetTitle()); } } diff --git a/chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc b/chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc index 94df56c..be0879b 100644 --- a/chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc +++ b/chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc @@ -277,8 +277,10 @@ TEST_F(BrowsingDataCookieHelperTest, CannedDomainCookie) { helper->AddChangedCookie(origin, origin, "A=1; Domain=.www.google.com", net::CookieOptions()); // Try adding invalid cookies that will be ignored. - helper->AddChangedCookie(origin, origin, "", net::CookieOptions()); - helper->AddChangedCookie(origin, origin, "C=bad guy; Domain=wrongdomain.com", + helper->AddChangedCookie(origin, origin, std::string(), net::CookieOptions()); + helper->AddChangedCookie(origin, + origin, + "C=bad guy; Domain=wrongdomain.com", net::CookieOptions()); helper->StartFetching( diff --git a/chrome/browser/browsing_data/browsing_data_database_helper_browsertest.cc b/chrome/browser/browsing_data/browsing_data_database_helper_browsertest.cc index 8c29d07..019a45b 100644 --- a/chrome/browser/browsing_data/browsing_data_database_helper_browsertest.cc +++ b/chrome/browser/browsing_data/browsing_data_database_helper_browsertest.cc @@ -104,9 +104,9 @@ IN_PROC_BROWSER_TEST_F(BrowsingDataDatabaseHelperTest, CannedAddDatabase) { scoped_refptr<CannedBrowsingDataDatabaseHelper> helper( new CannedBrowsingDataDatabaseHelper(browser()->profile())); - helper->AddDatabase(origin1, db1, ""); - helper->AddDatabase(origin1, db2, ""); - helper->AddDatabase(origin2, db3, ""); + helper->AddDatabase(origin1, db1, std::string()); + helper->AddDatabase(origin1, db2, std::string()); + helper->AddDatabase(origin2, db3, std::string()); TestCompletionCallback callback; helper->StartFetching( @@ -136,8 +136,8 @@ IN_PROC_BROWSER_TEST_F(BrowsingDataDatabaseHelperTest, CannedUnique) { scoped_refptr<CannedBrowsingDataDatabaseHelper> helper( new CannedBrowsingDataDatabaseHelper(browser()->profile())); - helper->AddDatabase(origin, db, ""); - helper->AddDatabase(origin, db, ""); + helper->AddDatabase(origin, db, std::string()); + helper->AddDatabase(origin, db, std::string()); TestCompletionCallback callback; helper->StartFetching( diff --git a/chrome/browser/browsing_data/browsing_data_database_helper_unittest.cc b/chrome/browser/browsing_data/browsing_data_database_helper_unittest.cc index 2a2b474..89c290d 100644 --- a/chrome/browser/browsing_data/browsing_data_database_helper_unittest.cc +++ b/chrome/browser/browsing_data/browsing_data_database_helper_unittest.cc @@ -35,7 +35,7 @@ TEST_F(CannedBrowsingDataDatabaseHelperTest, Empty) { new CannedBrowsingDataDatabaseHelper(&profile)); ASSERT_TRUE(helper->empty()); - helper->AddDatabase(origin, db, ""); + helper->AddDatabase(origin, db, std::string()); ASSERT_FALSE(helper->empty()); helper->Reset(); ASSERT_TRUE(helper->empty()); @@ -52,9 +52,9 @@ TEST_F(CannedBrowsingDataDatabaseHelperTest, IgnoreExtensionsAndDevTools) { new CannedBrowsingDataDatabaseHelper(&profile)); ASSERT_TRUE(helper->empty()); - helper->AddDatabase(origin1, db, ""); + helper->AddDatabase(origin1, db, std::string()); ASSERT_TRUE(helper->empty()); - helper->AddDatabase(origin2, db, ""); + helper->AddDatabase(origin2, db, std::string()); ASSERT_TRUE(helper->empty()); helper->Reset(); ASSERT_TRUE(helper->empty()); diff --git a/chrome/browser/browsing_data/cookies_tree_model_unittest.cc b/chrome/browser/browsing_data/cookies_tree_model_unittest.cc index 58b1dd5..9699414 100644 --- a/chrome/browser/browsing_data/cookies_tree_model_unittest.cc +++ b/chrome/browser/browsing_data/cookies_tree_model_unittest.cc @@ -416,7 +416,7 @@ TEST_F(CookiesTreeModelTest, RemoveAll) { SCOPED_TRACE("After removing"); EXPECT_EQ(1, cookies_model->GetRoot()->GetTotalNodeCount()); EXPECT_EQ(0, cookies_model->GetRoot()->child_count()); - EXPECT_EQ(std::string(""), GetDisplayedCookies(cookies_model.get())); + EXPECT_EQ(std::string(), GetDisplayedCookies(cookies_model.get())); EXPECT_TRUE(mock_browsing_data_cookie_helper_->AllDeleted()); EXPECT_TRUE(mock_browsing_data_database_helper_->AllDeleted()); EXPECT_TRUE(mock_browsing_data_local_storage_helper_->AllDeleted()); diff --git a/chrome/browser/certificate_manager_model.cc b/chrome/browser/certificate_manager_model.cc index f519a0d..aecd3a3 100644 --- a/chrome/browser/certificate_manager_model.cc +++ b/chrome/browser/certificate_manager_model.cc @@ -38,7 +38,7 @@ void CertificateManagerModel::Refresh() { chrome::UnlockSlotsIfNecessary( modules, chrome::kCryptoModulePasswordListCerts, - "", // unused. + std::string(), // unused. base::Bind(&CertificateManagerModel::RefreshSlotsUnlocked, base::Unretained(this))); } @@ -95,9 +95,8 @@ string16 CertificateManagerModel::GetColumnText( x509_certificate_model::GetTokenName(cert.os_cert_handle())); break; case COL_SERIAL_NUMBER: - rv = ASCIIToUTF16( - x509_certificate_model::GetSerialNumberHexified( - cert.os_cert_handle(), "")); + rv = ASCIIToUTF16(x509_certificate_model::GetSerialNumberHexified( + cert.os_cert_handle(), std::string())); break; case COL_EXPIRES_ON: if (!cert.valid_expiry().is_null()) diff --git a/chrome/browser/content_settings/content_settings_browsertest.cc b/chrome/browser/content_settings/content_settings_browsertest.cc index 88c664c..f4105ad 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, - "", - CONTENT_SETTING_ALLOW); + browser()->profile()->GetHostContentSettingsMap() + ->SetContentSetting(ContentSettingsPattern::FromURL(url), + ContentSettingsPattern::Wildcard(), + CONTENT_SETTINGS_TYPE_PLUGINS, + std::string(), + 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, - "", - CONTENT_SETTING_BLOCK); + browser()->profile()->GetHostContentSettingsMap() + ->SetContentSetting(ContentSettingsPattern::FromURL(url), + ContentSettingsPattern::Wildcard(), + CONTENT_SETTINGS_TYPE_PLUGINS, + std::string(), + 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 815d037..56dd993 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 21089fb..b8612a5 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,38 +14,40 @@ 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, - "")); - map.SetValue( - ContentSettingsPattern::FromString("[*.]google.com"), - ContentSettingsPattern::FromString("[*.]google.com"), - CONTENT_SETTINGS_TYPE_COOKIES, - "", - Value::CreateIntegerValue(1)); + 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)); 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, - ""))); - - 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_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_EQ(NULL, map.GetValue(GURL("http://www.google.com"), GURL("http://www.google.com"), @@ -119,12 +121,11 @@ 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, - "", - Value::CreateIntegerValue(1)); + map.SetValue(ContentSettingsPattern::FromString("[*.]google.com"), + ContentSettingsPattern::FromString("[*.]google.com"), + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + Value::CreateIntegerValue(1)); EXPECT_FALSE(map.empty()); int actual_value; EXPECT_TRUE(map.GetValue(GURL("http://www.google.com"), @@ -145,38 +146,36 @@ TEST(OriginIdentifierValueMapTest, Clear) { TEST(OriginIdentifierValueMapTest, ListEntryPrecedences) { content_settings::OriginIdentifierValueMap map; - map.SetValue( - ContentSettingsPattern::FromString("[*.]google.com"), - ContentSettingsPattern::FromString("[*.]google.com"), - CONTENT_SETTINGS_TYPE_COOKIES, - "", - 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("www.google.com"), - ContentSettingsPattern::FromString("[*.]google.com"), - CONTENT_SETTINGS_TYPE_COOKIES, - "", - Value::CreateIntegerValue(2)); + map.SetValue(ContentSettingsPattern::FromString("www.google.com"), + ContentSettingsPattern::FromString("[*.]google.com"), + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + Value::CreateIntegerValue(2)); int actual_value; EXPECT_TRUE(map.GetValue(GURL("http://mail.google.com"), GURL("http://www.google.com"), CONTENT_SETTINGS_TYPE_COOKIES, - "")->GetAsInteger(&actual_value)); + std::string())->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, - "")->GetAsInteger(&actual_value)); + std::string())->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, "", NULL)); + map.GetRuleIterator(CONTENT_SETTINGS_TYPE_COOKIES, std::string(), NULL)); EXPECT_FALSE(rule_iterator->HasNext()); } @@ -187,21 +186,19 @@ TEST(OriginIdentifierValueMapTest, IterateNonempty) { ContentSettingsPattern::FromString("[*.]google.com"); ContentSettingsPattern sub_pattern = ContentSettingsPattern::FromString("sub.google.com"); - 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)); + 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)); scoped_ptr<content_settings::RuleIterator> rule_iterator( - map.GetRuleIterator(CONTENT_SETTINGS_TYPE_COOKIES, "", NULL)); + map.GetRuleIterator(CONTENT_SETTINGS_TYPE_COOKIES, std::string(), 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 b112db0..f1e40fb 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, - ResourceIdentifier(NO_RESOURCE_IDENTIFIER), + 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 23c43f8..37b718c 100644 --- a/chrome/browser/content_settings/content_settings_policy_provider_unittest.cc +++ b/chrome/browser/content_settings/content_settings_policy_provider_unittest.cc @@ -150,22 +150,34 @@ 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, "", false)); + GetContentSetting(&provider, + youtube_url, + youtube_url, + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + false)); EXPECT_EQ(NULL, - GetContentSettingValue( - &provider, youtube_url, youtube_url, - CONTENT_SETTINGS_TYPE_COOKIES, "", false)); + GetContentSettingValue(&provider, + youtube_url, + youtube_url, + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + false)); EXPECT_EQ(CONTENT_SETTING_BLOCK, - GetContentSetting( - &provider, google_url, google_url, - CONTENT_SETTINGS_TYPE_IMAGES, "", false)); + GetContentSetting(&provider, + google_url, + google_url, + CONTENT_SETTINGS_TYPE_IMAGES, + std::string(), + false)); scoped_ptr<Value> value_ptr( - GetContentSettingValue( - &provider, google_url, google_url, - CONTENT_SETTINGS_TYPE_IMAGES, "", false)); + GetContentSettingValue(&provider, + google_url, + google_url, + CONTENT_SETTINGS_TYPE_IMAGES, + std::string(), + false)); int int_value = -1; value_ptr->GetAsInteger(&int_value); @@ -176,17 +188,19 @@ 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, - "", - value_block.get()); + bool owned = provider.SetWebsiteSetting(yt_url_pattern, + yt_url_pattern, + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + value_block.get()); EXPECT_FALSE(owned); EXPECT_EQ(CONTENT_SETTING_DEFAULT, - GetContentSetting( - &provider, youtube_url, youtube_url, - CONTENT_SETTINGS_TYPE_COOKIES, "", false)); + GetContentSetting(&provider, + youtube_url, + youtube_url, + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + false)); provider.ShutdownOnUIThread(); } @@ -213,9 +227,12 @@ 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, "", false)); + GetContentSetting(&provider, + google_url, + google_url, + CONTENT_SETTINGS_TYPE_PLUGINS, + std::string(), + false)); EXPECT_EQ(CONTENT_SETTING_DEFAULT, GetContentSetting( @@ -232,10 +249,14 @@ 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, "", false)); + EXPECT_EQ( + NULL, + GetContentSettingValue(&provider, + google_url, + google_url, + CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, + std::string(), + false)); // Set the content settings pattern list for origins to auto select // certificates. @@ -247,13 +268,21 @@ 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, "", false)); - scoped_ptr<Value> cert_filter(GetContentSettingValue( - &provider, google_url, google_url, - CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, "", false)); + 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)); 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 a92315e..4690f2f 100644 --- a/chrome/browser/content_settings/content_settings_pref_provider.cc +++ b/chrome/browser/content_settings/content_settings_pref_provider.cc @@ -188,22 +188,21 @@ void PrefProvider::ClearAllContentSettingsRules( { base::AutoLock auto_lock(lock_); scoped_ptr<RuleIterator> rule_iterator( - map_to_modify->GetRuleIterator(content_type, "", NULL)); + map_to_modify->GetRuleIterator(content_type, std::string(), 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, ""); + map_to_modify->DeleteValues(content_type, std::string()); } 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, - "", - NULL); + UpdatePref(it->primary_pattern, + it->secondary_pattern, + content_type, + std::string(), + NULL); } NotifyObservers(ContentSettingsPattern(), ContentSettingsPattern(), @@ -307,8 +306,8 @@ void PrefProvider::UpdatePref( void PrefProvider::MigrateObsoleteMediaContentSetting() { std::vector<Rule> rules_to_delete; { - scoped_ptr<RuleIterator> rule_iterator( - GetRuleIterator(CONTENT_SETTINGS_TYPE_MEDIASTREAM, "", false)); + scoped_ptr<RuleIterator> rule_iterator(GetRuleIterator( + CONTENT_SETTINGS_TYPE_MEDIASTREAM, std::string(), false)); while (rule_iterator->HasNext()) { // Skip default setting and rules without a value. const content_settings::Rule& rule = rule_iterator->Next(); @@ -333,7 +332,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. @@ -341,7 +340,7 @@ void PrefProvider::MigrateObsoleteMediaContentSetting() { SetWebsiteSetting(it->primary_pattern, it->secondary_pattern, CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, - "", + std::string(), Value::CreateIntegerValue(CONTENT_SETTING_ALLOW)); } @@ -349,7 +348,7 @@ void PrefProvider::MigrateObsoleteMediaContentSetting() { SetWebsiteSetting(it->primary_pattern, it->secondary_pattern, CONTENT_SETTINGS_TYPE_MEDIASTREAM, - "", + std::string(), NULL); } } @@ -455,7 +454,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 f951829..1ddc6d0 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,20 +166,26 @@ 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, "", false)); + GetContentSetting(&pref_content_settings_provider, + host, + host, + CONTENT_SETTINGS_TYPE_IMAGES, + std::string(), + false)); // And also in the OTR version. EXPECT_EQ(CONTENT_SETTING_ALLOW, - GetContentSetting( - &pref_content_settings_provider_incognito, - host, host, CONTENT_SETTINGS_TYPE_IMAGES, "", false)); + GetContentSetting(&pref_content_settings_provider_incognito, + host, + host, + CONTENT_SETTINGS_TYPE_IMAGES, + std::string(), + false)); // But the value should not be overridden in the OTR user prefs accidentally. EXPECT_FALSE(otr_user_prefs->IsSetInOverlay( prefs::kContentSettingsPatternPairs)); @@ -197,26 +203,40 @@ TEST_F(PrefProviderTest, GetContentSettingsValue) { ContentSettingsPattern::FromString("[*.]example.com"); EXPECT_EQ(CONTENT_SETTING_DEFAULT, - GetContentSetting(&provider, primary_url, primary_url, - CONTENT_SETTINGS_TYPE_IMAGES, "", false)); + GetContentSetting(&provider, + primary_url, + primary_url, + CONTENT_SETTINGS_TYPE_IMAGES, + std::string(), + false)); EXPECT_EQ(NULL, - GetContentSettingValue( - &provider, primary_url, primary_url, - CONTENT_SETTINGS_TYPE_IMAGES, "", false)); + GetContentSettingValue(&provider, + primary_url, + primary_url, + CONTENT_SETTINGS_TYPE_IMAGES, + std::string(), + false)); - provider.SetWebsiteSetting( - primary_pattern, - primary_pattern, - CONTENT_SETTINGS_TYPE_IMAGES, - "", - Value::CreateIntegerValue(CONTENT_SETTING_BLOCK)); + provider.SetWebsiteSetting(primary_pattern, + primary_pattern, + CONTENT_SETTINGS_TYPE_IMAGES, + std::string(), + Value::CreateIntegerValue(CONTENT_SETTING_BLOCK)); EXPECT_EQ(CONTENT_SETTING_BLOCK, - GetContentSetting(&provider, primary_url, primary_url, - CONTENT_SETTINGS_TYPE_IMAGES, "", false)); + GetContentSetting(&provider, + primary_url, + primary_url, + CONTENT_SETTINGS_TYPE_IMAGES, + std::string(), + false)); scoped_ptr<Value> value_ptr( - GetContentSettingValue(&provider, primary_url, primary_url, - CONTENT_SETTINGS_TYPE_IMAGES, "", false)); + GetContentSettingValue(&provider, + primary_url, + primary_url, + CONTENT_SETTINGS_TYPE_IMAGES, + std::string(), + false)); int int_value = -1; value_ptr->GetAsInteger(&int_value); EXPECT_EQ(CONTENT_SETTING_BLOCK, IntToContentSetting(int_value)); @@ -224,12 +244,15 @@ 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, "", false)); + GetContentSettingValue(&provider, + primary_url, + primary_url, + CONTENT_SETTINGS_TYPE_IMAGES, + std::string(), + false)); provider.ShutdownOnUIThread(); } @@ -250,53 +273,74 @@ 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, "", false)); + GetContentSetting(&pref_content_settings_provider, + host1, + host1, + CONTENT_SETTINGS_TYPE_IMAGES, + std::string(), + 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, "", false)); + GetContentSetting(&pref_content_settings_provider, + host1, + host1, + CONTENT_SETTINGS_TYPE_IMAGES, + std::string(), + false)); EXPECT_EQ(CONTENT_SETTING_BLOCK, - GetContentSetting( - &pref_content_settings_provider, - host2, host2, CONTENT_SETTINGS_TYPE_IMAGES, "", false)); + GetContentSetting(&pref_content_settings_provider, + host2, + host2, + CONTENT_SETTINGS_TYPE_IMAGES, + std::string(), + false)); EXPECT_EQ(CONTENT_SETTING_DEFAULT, - GetContentSetting( - &pref_content_settings_provider, - host3, host3, CONTENT_SETTINGS_TYPE_IMAGES, "", false)); + GetContentSetting(&pref_content_settings_provider, + host3, + host3, + CONTENT_SETTINGS_TYPE_IMAGES, + std::string(), + 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, "", false)); + GetContentSetting(&pref_content_settings_provider, + host3, + host3, + CONTENT_SETTINGS_TYPE_IMAGES, + std::string(), + false)); EXPECT_EQ(CONTENT_SETTING_DEFAULT, GetContentSetting(&pref_content_settings_provider, - host4, host4, CONTENT_SETTINGS_TYPE_IMAGES, "", + host4, + host4, + CONTENT_SETTINGS_TYPE_IMAGES, + std::string(), 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, "", false)); + GetContentSetting(&pref_content_settings_provider, + host4, + host4, + CONTENT_SETTINGS_TYPE_IMAGES, + std::string(), + 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 fefa226..6bc64de 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 "" +#define NO_RESOURCE_IDENTIFIER std::string() #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 e0857b3..0832a1c 100644 --- a/chrome/browser/content_settings/content_settings_provider_unittest.cc +++ b/chrome/browser/content_settings/content_settings_provider_unittest.cc @@ -46,11 +46,18 @@ TEST(ContentSettingsProviderTest, Mock) { CONTENT_SETTINGS_TYPE_PLUGINS, "flash_plugin", false)); EXPECT_EQ(CONTENT_SETTING_DEFAULT, - GetContentSetting(&mock_provider, url, url, - CONTENT_SETTINGS_TYPE_GEOLOCATION, "", false)); + GetContentSetting(&mock_provider, + url, + url, + CONTENT_SETTINGS_TYPE_GEOLOCATION, + std::string(), + false)); EXPECT_EQ(NULL, - GetContentSettingValue(&mock_provider, url, url, - CONTENT_SETTINGS_TYPE_GEOLOCATION, "", + GetContentSettingValue(&mock_provider, + url, + url, + CONTENT_SETTINGS_TYPE_GEOLOCATION, + std::string(), 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 d3a2869..9754ba1 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, "", - &(rules->image_rules)); - map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_JAVASCRIPT, "", - &(rules->script_rules)); + map->GetSettingsForOneType( + CONTENT_SETTINGS_TYPE_IMAGES, std::string(), &(rules->image_rules)); + map->GetSettingsForOneType( + CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string(), &(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 69f88c1..d5eeeca 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(""); + pattern_pair = content_settings::ParsePatternString(std::string()); 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 e34a56e..e0b1ff6 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, "", settings); + CONTENT_SETTINGS_TYPE_COOKIES, std::string(), settings); } void CookieSettings::SetDefaultCookieSetting(ContentSetting setting) { @@ -147,17 +147,21 @@ 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, "", - setting); + host_content_settings_map_->SetContentSetting(primary_pattern, + secondary_pattern, + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + 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, "", - CONTENT_SETTING_DEFAULT); + host_content_settings_map_->SetContentSetting(primary_pattern, + secondary_pattern, + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + CONTENT_SETTING_DEFAULT); } void CookieSettings::ShutdownOnUIThread() { @@ -176,9 +180,12 @@ 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, "", &info)); + scoped_ptr<base::Value> value(host_content_settings_map_->GetWebsiteSetting( + url, + first_party_url, + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + &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 8749d6f..777203d 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, "", false)); + provider->GetRuleIterator(content_type, std::string(), false)); ContentSettingsPattern wildcard = ContentSettingsPattern::Wildcard(); while (rule_iterator->HasNext()) { @@ -460,19 +460,18 @@ 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, - "", - Value::CreateIntegerValue(CONTENT_SETTING_SESSION_ONLY)); + SetWebsiteSetting(it->primary_pattern, + it->secondary_pattern, + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + 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 57fd929..bba4336 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, "")); + host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); 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, "")); + host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); 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, "")); + host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); EXPECT_EQ(CONTENT_SETTING_ALLOW, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_PLUGINS, "")); + host, host, CONTENT_SETTINGS_TYPE_PLUGINS, std::string())); // 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, "")); + host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); 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, "")); + host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string())); host_content_settings_map->SetContentSetting( pattern, ContentSettingsPattern::Wildcard(), @@ -131,22 +131,23 @@ TEST_F(HostContentSettingsMapTest, IndividualSettings) { CONTENT_SETTING_ALLOW); EXPECT_EQ(CONTENT_SETTING_ALLOW, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_PLUGINS, "")); + host, host, CONTENT_SETTINGS_TYPE_PLUGINS, std::string())); 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, "")); + host, host, CONTENT_SETTINGS_TYPE_POPUPS, std::string())); EXPECT_EQ(CONTENT_SETTING_ASK, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, "")); + 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())); EXPECT_EQ(CONTENT_SETTING_ASK, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_FULLSCREEN, "")); + host, host, CONTENT_SETTINGS_TYPE_FULLSCREEN, std::string())); EXPECT_EQ(CONTENT_SETTING_ASK, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_MOUSELOCK, "")); + host, host, CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string())); // Check returning all hosts for a setting. ContentSettingsPattern pattern2 = @@ -164,18 +165,16 @@ TEST_F(HostContentSettingsMapTest, IndividualSettings) { std::string(), CONTENT_SETTING_BLOCK); ContentSettingsForOneType host_settings; - host_content_settings_map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_IMAGES, - "", - &host_settings); + host_content_settings_map->GetSettingsForOneType( + CONTENT_SETTINGS_TYPE_IMAGES, std::string(), &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, "", &host_settings); + CONTENT_SETTINGS_TYPE_PLUGINS, std::string(), &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, - "", - &host_settings); + host_content_settings_map->GetSettingsForOneType( + CONTENT_SETTINGS_TYPE_POPUPS, std::string(), &host_settings); // |host_settings| contains only the default setting. EXPECT_EQ(1U, host_settings.size()); } @@ -217,13 +216,12 @@ 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, - "", - &host_settings); + host_content_settings_map->GetSettingsForOneType( + CONTENT_SETTINGS_TYPE_IMAGES, std::string(), &host_settings); // |host_settings| contains only the default setting. EXPECT_EQ(1U, host_settings.size()); host_content_settings_map->GetSettingsForOneType( - CONTENT_SETTINGS_TYPE_PLUGINS, "", &host_settings); + CONTENT_SETTINGS_TYPE_PLUGINS, std::string(), &host_settings); // |host_settings| contains the default setting and an exception. EXPECT_EQ(2U, host_settings.size()); } @@ -242,7 +240,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, "")); + host1, host1, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); host_content_settings_map->SetContentSetting( pattern1, ContentSettingsPattern::Wildcard(), @@ -251,13 +249,13 @@ TEST_F(HostContentSettingsMapTest, Patterns) { CONTENT_SETTING_BLOCK); EXPECT_EQ(CONTENT_SETTING_BLOCK, host_content_settings_map->GetContentSetting( - host1, host1, CONTENT_SETTINGS_TYPE_IMAGES, "")); + host1, host1, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); EXPECT_EQ(CONTENT_SETTING_BLOCK, host_content_settings_map->GetContentSetting( - host2, host2, CONTENT_SETTINGS_TYPE_IMAGES, "")); + host2, host2, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); EXPECT_EQ(CONTENT_SETTING_ALLOW, host_content_settings_map->GetContentSetting( - host3, host3, CONTENT_SETTINGS_TYPE_IMAGES, "")); + host3, host3, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); host_content_settings_map->SetContentSetting( pattern2, ContentSettingsPattern::Wildcard(), @@ -266,7 +264,7 @@ TEST_F(HostContentSettingsMapTest, Patterns) { CONTENT_SETTING_BLOCK); EXPECT_EQ(CONTENT_SETTING_BLOCK, host_content_settings_map->GetContentSetting( - host3, host3, CONTENT_SETTINGS_TYPE_IMAGES, "")); + host3, host3, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); } TEST_F(HostContentSettingsMapTest, Observer) { @@ -327,7 +325,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, "")); + host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); // Make a copy of the pref's new value so we can reset it later. scoped_ptr<Value> new_value(prefs->FindPreference( @@ -337,13 +335,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, "")); + host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); // 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, "")); + host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); } TEST_F(HostContentSettingsMapTest, ObserveExceptionPref) { @@ -363,7 +361,7 @@ TEST_F(HostContentSettingsMapTest, ObserveExceptionPref) { EXPECT_EQ(CONTENT_SETTING_ALLOW, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_IMAGES, "")); + host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); host_content_settings_map->SetContentSetting( pattern, @@ -373,7 +371,7 @@ TEST_F(HostContentSettingsMapTest, ObserveExceptionPref) { CONTENT_SETTING_BLOCK); EXPECT_EQ(CONTENT_SETTING_BLOCK, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_IMAGES, "")); + host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); // Make a copy of the pref's new value so we can reset it later. scoped_ptr<Value> new_value(prefs->FindPreference( @@ -383,13 +381,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, "")); + host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); // 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, "")); + host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); } TEST_F(HostContentSettingsMapTest, HostTrimEndingDotCheck) { @@ -413,26 +411,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, - "")); + EXPECT_EQ( + CONTENT_SETTING_ALLOW, + host_content_settings_map->GetContentSetting(host_ending_with_dot, + host_ending_with_dot, + CONTENT_SETTINGS_TYPE_IMAGES, + std::string())); 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, - "")); + 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_TRUE(cookie_settings->IsSettingCookieAllowed( host_ending_with_dot, host_ending_with_dot)); @@ -440,7 +438,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)); @@ -448,7 +446,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)); @@ -458,93 +456,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, - "")); + EXPECT_EQ( + CONTENT_SETTING_BLOCK, + host_content_settings_map->GetContentSetting(host_ending_with_dot, + host_ending_with_dot, + CONTENT_SETTINGS_TYPE_POPUPS, + std::string())); 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, - "")); + EXPECT_EQ( + CONTENT_SETTING_BLOCK, + host_content_settings_map->GetContentSetting(host_ending_with_dot, + host_ending_with_dot, + CONTENT_SETTINGS_TYPE_POPUPS, + std::string())); 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, - "")); + EXPECT_EQ( + CONTENT_SETTING_ALLOW, + host_content_settings_map->GetContentSetting(host_ending_with_dot, + host_ending_with_dot, + CONTENT_SETTINGS_TYPE_POPUPS, + std::string())); } TEST_F(HostContentSettingsMapTest, NestedSettings) { @@ -564,52 +562,53 @@ 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, "")); + host, host, CONTENT_SETTINGS_TYPE_COOKIES, std::string())); EXPECT_EQ(CONTENT_SETTING_BLOCK, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_IMAGES, "")); + host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); EXPECT_EQ(CONTENT_SETTING_BLOCK, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, "")); + host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string())); EXPECT_EQ(CONTENT_SETTING_BLOCK, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_PLUGINS, "")); + host, host, CONTENT_SETTINGS_TYPE_PLUGINS, std::string())); EXPECT_EQ(CONTENT_SETTING_BLOCK, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_POPUPS, "")); + host, host, CONTENT_SETTINGS_TYPE_POPUPS, std::string())); EXPECT_EQ(CONTENT_SETTING_ASK, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_GEOLOCATION, "")); + 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())); EXPECT_EQ(CONTENT_SETTING_ASK, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, "")); + host, host, CONTENT_SETTINGS_TYPE_FULLSCREEN, std::string())); 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, "")); + host, host, CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string())); } TEST_F(HostContentSettingsMapTest, OffTheRecord) { @@ -626,10 +625,10 @@ TEST_F(HostContentSettingsMapTest, OffTheRecord) { EXPECT_EQ(CONTENT_SETTING_ALLOW, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_IMAGES, "")); + host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); EXPECT_EQ(CONTENT_SETTING_ALLOW, otr_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_IMAGES, "")); + host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); // Changing content settings on the main map should also affect the // incognito map. @@ -637,27 +636,28 @@ 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, "")); + host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); EXPECT_EQ(CONTENT_SETTING_BLOCK, otr_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_IMAGES, "")); + host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); // Changing content settings on the incognito map should NOT affect the // main map. - otr_map->SetContentSetting( - pattern, - ContentSettingsPattern::Wildcard(), - CONTENT_SETTINGS_TYPE_IMAGES, "", CONTENT_SETTING_ALLOW); + otr_map->SetContentSetting(pattern, + ContentSettingsPattern::Wildcard(), + CONTENT_SETTINGS_TYPE_IMAGES, + std::string(), + CONTENT_SETTING_ALLOW); EXPECT_EQ(CONTENT_SETTING_BLOCK, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_IMAGES, "")); + host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); EXPECT_EQ(CONTENT_SETTING_ALLOW, otr_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_IMAGES, "")); + host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); 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, "")); + host, host, CONTENT_SETTINGS_TYPE_PLUGINS, std::string())); // 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, "")); + host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string())); // 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, "")); + host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string())); } // 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, "")); + host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string())); // 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, "")); + host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string())); // 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, "")); + host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string())); } // 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, "")); + host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); EXPECT_EQ(CONTENT_SETTING_ALLOW, host_content_settings_map->GetContentSetting( - embedder, host, CONTENT_SETTINGS_TYPE_IMAGES, "")); + embedder, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); } 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 a281a1d..c8de7fa 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, ""); + map->GetContentSetting(url, url, CONTENT_SETTINGS_TYPE_IMAGES, std::string()); } diff --git a/chrome/browser/devtools/browser_list_tabcontents_provider.cc b/chrome/browser/devtools/browser_list_tabcontents_provider.cc index aca4bac..2edc6bf 100644 --- a/chrome/browser/devtools/browser_list_tabcontents_provider.cc +++ b/chrome/browser/devtools/browser_list_tabcontents_provider.cc @@ -116,19 +116,19 @@ std::string BrowserListTabContentsProvider::GetViewDescription( content::WebContents* web_contents = content::WebContents::FromRenderViewHost(rvh); if (!web_contents) - return ""; + return std::string(); Profile* profile = Profile::FromBrowserContext(web_contents->GetBrowserContext()); if (!profile) - return ""; + return std::string(); extensions::ExtensionHost* extension_host = extensions::ExtensionSystem::Get(profile)->process_manager()-> GetBackgroundHostForExtension(web_contents->GetURL().host()); if (!extension_host || extension_host->host_contents() != web_contents) - return ""; + return std::string(); return extension_host->extension()->name(); } diff --git a/chrome/browser/devtools/devtools_file_helper.cc b/chrome/browser/devtools/devtools_file_helper.cc index d485a52..4aef091 100644 --- a/chrome/browser/devtools/devtools_file_helper.cc +++ b/chrome/browser/devtools/devtools_file_helper.cc @@ -77,7 +77,7 @@ class SelectFileDialog : public ui::SelectFileDialog::Listener, default_path, NULL, 0, - FILE_PATH_LITERAL(""), + FILE_PATH_LITERAL(std::string()), NULL, NULL); } @@ -346,7 +346,7 @@ void DevToolsFileHelper::AddValidatedFileSystem( file_system_id, registered_name, file_system_path); - callback.Run("", filesystem); + callback.Run(std::string(), filesystem); } void DevToolsFileHelper::RequestFileSystems( diff --git a/chrome/browser/devtools/devtools_sanity_browsertest.cc b/chrome/browser/devtools/devtools_sanity_browsertest.cc index 6a8b30c..4f832f7 100644 --- a/chrome/browser/devtools/devtools_sanity_browsertest.cc +++ b/chrome/browser/devtools/devtools_sanity_browsertest.cc @@ -441,7 +441,7 @@ IN_PROC_BROWSER_TEST_F( IN_PROC_BROWSER_TEST_F(DevToolsExtensionTest, TestDevToolsExtensionAPI) { LoadExtension("devtools_extension"); - RunTest("waitForTestResultsInConsole", ""); + RunTest("waitForTestResultsInConsole", std::string()); } // Tests that chrome.devtools extension can communicate with background page @@ -449,7 +449,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsExtensionTest, IN_PROC_BROWSER_TEST_F(DevToolsExtensionTest, TestDevToolsExtensionMessaging) { LoadExtension("devtools_messaging"); - RunTest("waitForTestResultsInConsole", ""); + RunTest("waitForTestResultsInConsole", std::string()); } // Tests that chrome.experimental.devtools extension is correctly exposed @@ -457,7 +457,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsExtensionTest, IN_PROC_BROWSER_TEST_F(DevToolsExperimentalExtensionTest, TestDevToolsExperimentalExtensionAPI) { LoadExtension("devtools_experimental"); - RunTest("waitForTestResultsInConsole", ""); + RunTest("waitForTestResultsInConsole", std::string()); } // Tests that a content script is in the scripts list. @@ -478,7 +478,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsExtensionTest, IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, MAYBE_TestRendererProcessNativeMemorySize) { - RunTest("testRendererProcessNativeMemorySize", ""); + RunTest("testRendererProcessNativeMemorySize", std::string()); } // Tests that scripts are not duplicated after Scripts Panel switch. diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc index 7c63cb7..5ec91a2 100644 --- a/chrome/browser/download/download_browsertest.cc +++ b/chrome/browser/download/download_browsertest.cc @@ -1655,7 +1655,12 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, NewWindow) { IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadHistoryCheck) { GURL download_url(URLRequestSlowDownloadJob::kKnownSizeUrl); - base::FilePath file(net::GenerateFileName(download_url, "", "", "", "", "")); + base::FilePath file(net::GenerateFileName(download_url, + std::string(), + std::string(), + std::string(), + std::string(), + std::string())); // We use the server so that we can get a redirect and test url_chain // persistence. @@ -2627,7 +2632,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, LoadURLExternallyReferrerPolicy) { // Check that the file contains the expected referrer. base::FilePath file(download_items[0]->GetFullPath()); - std::string expected_contents = test_server()->GetURL("").spec(); + std::string expected_contents = test_server()->GetURL(std::string()).spec(); ASSERT_TRUE(VerifyFile(file, expected_contents, expected_contents.length())); } diff --git a/chrome/browser/download/download_file_picker.cc b/chrome/browser/download/download_file_picker.cc index 29a1573..b18a0f0 100644 --- a/chrome/browser/download/download_file_picker.cc +++ b/chrome/browser/download/download_file_picker.cc @@ -86,15 +86,14 @@ void DownloadFilePicker::Init( platform_util::GetTopLevel(web_contents->GetView()->GetNativeView()) : NULL; - select_file_dialog_->SelectFile( - ui::SelectFileDialog::SELECT_SAVEAS_FILE, - string16(), - suggested_path_, - &file_type_info, - 0, - FILE_PATH_LITERAL(""), - owning_window, - NULL); + select_file_dialog_->SelectFile(ui::SelectFileDialog::SELECT_SAVEAS_FILE, + string16(), + suggested_path_, + &file_type_info, + 0, + FILE_PATH_LITERAL(std::string()), + owning_window, + NULL); } DownloadFilePicker::~DownloadFilePicker() { diff --git a/chrome/browser/download/download_prefs.cc b/chrome/browser/download/download_prefs.cc index 2bfb792..4aba528 100644 --- a/chrome/browser/download/download_prefs.cc +++ b/chrome/browser/download/download_prefs.cc @@ -86,7 +86,7 @@ void DownloadPrefs::RegisterUserPrefs(PrefRegistrySyncable* registry) { false, PrefRegistrySyncable::SYNCABLE_PREF); registry->RegisterStringPref(prefs::kDownloadExtensionsToOpen, - "", + std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); registry->RegisterBooleanPref(prefs::kDownloadDirUpgraded, false, diff --git a/chrome/browser/extensions/activity_log.cc b/chrome/browser/extensions/activity_log.cc index 34f820b..dcf8e8f 100644 --- a/chrome/browser/extensions/activity_log.cc +++ b/chrome/browser/extensions/activity_log.cc @@ -27,7 +27,7 @@ namespace { // Concatenate arguments. std::string MakeArgList(const ListValue* args) { - std::string call_signature = ""; + std::string call_signature; ListValue::const_iterator it = args->begin(); for (; it != args->end(); ++it) { std::string arg; @@ -395,9 +395,10 @@ void ActivityLog::OnScriptsExecuted( // of content scripts will be empty. We don't want to log it because // the call to tabs.executeScript will have already been logged anyway. if (!it->second.empty()) { - std::string ext_scripts_str = ""; + std::string ext_scripts_str; for (std::set<std::string>::const_iterator it2 = it->second.begin(); - it2 != it->second.end(); ++it2) { + it2 != it->second.end(); + ++it2) { ext_scripts_str += *it2; ext_scripts_str += " "; } @@ -406,9 +407,9 @@ void ActivityLog::OnScriptsExecuted( LogDOMActionInternal(extension, on_url, web_contents->GetTitle(), - "", // no api call here + std::string(), // no api call here script_names.get(), - "", // no extras either + std::string(), // no extras either DOMAction::INSERTED); } } diff --git a/chrome/browser/extensions/activity_log_unittest.cc b/chrome/browser/extensions/activity_log_unittest.cc index f678d7b..a5ecc95 100644 --- a/chrome/browser/extensions/activity_log_unittest.cc +++ b/chrome/browser/extensions/activity_log_unittest.cc @@ -93,10 +93,8 @@ TEST_F(ActivityLogTest, Construct) { extension_service_->AddExtension(extension); scoped_ptr<ListValue> args(new ListValue()); ASSERT_TRUE(ActivityLog::IsLogEnabled()); - activity_log->LogAPIAction(extension, - std::string("tabs.testMethod"), - args.get(), - ""); + activity_log->LogAPIAction( + extension, std::string("tabs.testMethod"), args.get(), std::string()); } TEST_F(ActivityLogTest, LogAndFetchActions) { @@ -113,10 +111,8 @@ TEST_F(ActivityLogTest, LogAndFetchActions) { ASSERT_TRUE(ActivityLog::IsLogEnabled()); // Write some API calls - activity_log->LogAPIAction(extension, - std::string("tabs.testMethod"), - args.get(), - ""); + activity_log->LogAPIAction( + extension, std::string("tabs.testMethod"), args.get(), std::string()); activity_log->LogDOMAction(extension, GURL("http://www.google.com"), string16(), @@ -144,14 +140,10 @@ TEST_F(ActivityLogTest, LogWithoutArguments) { scoped_ptr<ListValue> args(new ListValue()); args->Set(0, new base::StringValue("hello")); args->Set(1, new base::StringValue("world")); - activity_log->LogAPIAction(extension, - std::string("tabs.testMethod"), - args.get(), - ""); + activity_log->LogAPIAction( + extension, std::string("tabs.testMethod"), args.get(), std::string()); activity_log->GetActions( - extension->id(), - 0, - base::Bind(ActivityLogTest::Arguments_Missing)); + extension->id(), 0, base::Bind(ActivityLogTest::Arguments_Missing)); } TEST_F(ActivityLogTest, LogWithArguments) { @@ -169,14 +161,10 @@ TEST_F(ActivityLogTest, LogWithArguments) { scoped_ptr<ListValue> args(new ListValue()); args->Set(0, new base::StringValue("hello")); args->Set(1, new base::StringValue("world")); - activity_log->LogAPIAction(extension, - std::string("extension.connect"), - args.get(), - ""); + activity_log->LogAPIAction( + extension, std::string("extension.connect"), args.get(), std::string()); activity_log->GetActions( - extension->id(), - 0, - base::Bind(ActivityLogTest::Arguments_Present)); + extension->id(), 0, base::Bind(ActivityLogTest::Arguments_Present)); } } // namespace extensions diff --git a/chrome/browser/extensions/api/alarms/alarms_api_unittest.cc b/chrome/browser/extensions/api/alarms/alarms_api_unittest.cc index 60c367a..34b4187 100644 --- a/chrome/browser/extensions/api/alarms/alarms_api_unittest.cc +++ b/chrome/browser/extensions/api/alarms/alarms_api_unittest.cc @@ -151,7 +151,7 @@ TEST_F(ExtensionAlarmsTest, Create) { CreateAlarm("[null, {\"delayInMinutes\": 0}]"); const Alarm* alarm = - alarm_manager_->GetAlarm(extension_->id(), ""); + alarm_manager_->GetAlarm(extension_->id(), std::string()); ASSERT_TRUE(alarm); EXPECT_EQ("", alarm->js_alarm->name); EXPECT_DOUBLE_EQ(10000, alarm->js_alarm->scheduled_time); @@ -179,7 +179,7 @@ TEST_F(ExtensionAlarmsTest, CreateRepeating) { CreateAlarm("[null, {\"periodInMinutes\": 0.001}]"); const Alarm* alarm = - alarm_manager_->GetAlarm(extension_->id(), ""); + alarm_manager_->GetAlarm(extension_->id(), std::string()); ASSERT_TRUE(alarm); EXPECT_EQ("", alarm->js_alarm->name); EXPECT_DOUBLE_EQ(10060, alarm->js_alarm->scheduled_time); @@ -205,7 +205,7 @@ TEST_F(ExtensionAlarmsTest, CreateAbsolute) { CreateAlarm("[null, {\"when\": 10001}]"); const Alarm* alarm = - alarm_manager_->GetAlarm(extension_->id(), ""); + alarm_manager_->GetAlarm(extension_->id(), std::string()); ASSERT_TRUE(alarm); EXPECT_EQ("", alarm->js_alarm->name); EXPECT_DOUBLE_EQ(10001, alarm->js_alarm->scheduled_time); @@ -217,7 +217,7 @@ TEST_F(ExtensionAlarmsTest, CreateAbsolute) { // MessageLoop when that happens. MessageLoop::current()->Run(); - ASSERT_FALSE(alarm_manager_->GetAlarm(extension_->id(), "")); + ASSERT_FALSE(alarm_manager_->GetAlarm(extension_->id(), std::string())); ASSERT_EQ(1u, alarm_delegate_->alarms_seen.size()); EXPECT_EQ("", alarm_delegate_->alarms_seen[0]); @@ -228,7 +228,7 @@ TEST_F(ExtensionAlarmsTest, CreateRepeatingWithQuickFirstCall) { CreateAlarm("[null, {\"when\": 10001, \"periodInMinutes\": 0.001}]"); const Alarm* alarm = - alarm_manager_->GetAlarm(extension_->id(), ""); + alarm_manager_->GetAlarm(extension_->id(), std::string()); ASSERT_TRUE(alarm); EXPECT_EQ("", alarm->js_alarm->name); EXPECT_DOUBLE_EQ(10001, alarm->js_alarm->scheduled_time); @@ -240,13 +240,13 @@ TEST_F(ExtensionAlarmsTest, CreateRepeatingWithQuickFirstCall) { // MessageLoop when that happens. MessageLoop::current()->Run(); - ASSERT_TRUE(alarm_manager_->GetAlarm(extension_->id(), "")); + ASSERT_TRUE(alarm_manager_->GetAlarm(extension_->id(), std::string())); EXPECT_THAT(alarm_delegate_->alarms_seen, testing::ElementsAre("")); test_clock_.SetNow(base::Time::FromDoubleT(10.7)); MessageLoop::current()->Run(); - ASSERT_TRUE(alarm_manager_->GetAlarm(extension_->id(), "")); + ASSERT_TRUE(alarm_manager_->GetAlarm(extension_->id(), std::string())); EXPECT_THAT(alarm_delegate_->alarms_seen, testing::ElementsAre("", "")); } diff --git a/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc b/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc index 0470b78..af98260 100644 --- a/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc +++ b/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc @@ -946,7 +946,7 @@ void BookmarksIOFunction::ShowSelectFileDialog( default_path, &file_type_info, 0, - FILE_PATH_LITERAL(""), + FILE_PATH_LITERAL(std::string()), NULL, NULL); } diff --git a/chrome/browser/extensions/api/content_settings/content_settings_apitest.cc b/chrome/browser/extensions/api/content_settings/content_settings_apitest.cc index a424f83..dd20fba1 100644 --- a/chrome/browser/extensions/api/content_settings/content_settings_apitest.cc +++ b/chrome/browser/extensions/api/content_settings/content_settings_apitest.cc @@ -74,16 +74,16 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentSettings) { EXPECT_FALSE(cookie_settings->IsReadingCookieAllowed(url, url)); EXPECT_EQ(CONTENT_SETTING_ALLOW, map->GetContentSetting( - url, url, CONTENT_SETTINGS_TYPE_IMAGES, "")); + url, url, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); EXPECT_EQ(CONTENT_SETTING_BLOCK, map->GetContentSetting( - url, url, CONTENT_SETTINGS_TYPE_JAVASCRIPT, "")); + url, url, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string())); EXPECT_EQ(CONTENT_SETTING_BLOCK, map->GetContentSetting( - url, url, CONTENT_SETTINGS_TYPE_PLUGINS, "")); + url, url, CONTENT_SETTINGS_TYPE_PLUGINS, std::string())); EXPECT_EQ(CONTENT_SETTING_ALLOW, map->GetContentSetting( - url, url, CONTENT_SETTINGS_TYPE_POPUPS, "")); + url, url, CONTENT_SETTINGS_TYPE_POPUPS, std::string())); #if 0 EXPECT_EQ(CONTENT_SETTING_BLOCK, map->GetContentSetting( @@ -91,7 +91,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentSettings) { #endif EXPECT_EQ(CONTENT_SETTING_BLOCK, map->GetContentSetting( - url, url, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, "")); + url, url, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, std::string())); } // Flaky on the trybots. See http://crbug.com/96725. diff --git a/chrome/browser/extensions/api/content_settings/content_settings_helpers.cc b/chrome/browser/extensions/api/content_settings/content_settings_helpers.cc index 8ee0fbf..537d08f 100644 --- a/chrome/browser/extensions/api/content_settings/content_settings_helpers.cc +++ b/chrome/browser/extensions/api/content_settings/content_settings_helpers.cc @@ -48,7 +48,7 @@ std::string GetDefaultPort(const std::string& scheme) { if (scheme == chrome::kHttpsScheme) return "443"; NOTREACHED(); - return ""; + return std::string(); } } // namespace diff --git a/chrome/browser/extensions/api/content_settings/content_settings_store_unittest.cc b/chrome/browser/extensions/api/content_settings/content_settings_store_unittest.cc index 5e13633..bedd2ea 100644 --- a/chrome/browser/extensions/api/content_settings/content_settings_store_unittest.cc +++ b/chrome/browser/extensions/api/content_settings/content_settings_store_unittest.cc @@ -101,73 +101,76 @@ TEST_F(ContentSettingsStoreTest, RegisterUnregister) { GURL url("http://www.youtube.com"); EXPECT_EQ(CONTENT_SETTING_DEFAULT, - GetContentSettingFromStore( - store(), url, url, CONTENT_SETTINGS_TYPE_COOKIES, "", false)); + GetContentSettingFromStore(store(), + url, + url, + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + false)); // Register first extension std::string ext_id("my_extension"); RegisterExtension(ext_id); EXPECT_EQ(CONTENT_SETTING_DEFAULT, - GetContentSettingFromStore( - store(), url, url, CONTENT_SETTINGS_TYPE_COOKIES, "", false)); + GetContentSettingFromStore(store(), + url, + url, + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + false)); // Set setting ContentSettingsPattern pattern = ContentSettingsPattern::FromURL(GURL("http://www.youtube.com")); EXPECT_CALL(observer, OnContentSettingChanged(ext_id, false)); - store()->SetExtensionContentSetting( - ext_id, - pattern, - pattern, - CONTENT_SETTINGS_TYPE_COOKIES, - "", - CONTENT_SETTING_ALLOW, - kExtensionPrefsScopeRegular); + store()->SetExtensionContentSetting(ext_id, + pattern, + pattern, + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + CONTENT_SETTING_ALLOW, + kExtensionPrefsScopeRegular); Mock::VerifyAndClear(&observer); EXPECT_EQ(CONTENT_SETTING_ALLOW, - GetContentSettingFromStore( - store(), - url, - url, - CONTENT_SETTINGS_TYPE_COOKIES, - "", - false)); + GetContentSettingFromStore(store(), + url, + url, + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + false)); // Register second extension. std::string ext_id_2("my_second_extension"); RegisterExtension(ext_id_2); EXPECT_CALL(observer, OnContentSettingChanged(ext_id_2, false)); - store()->SetExtensionContentSetting( - ext_id_2, - pattern, - pattern, - CONTENT_SETTINGS_TYPE_COOKIES, - "", - CONTENT_SETTING_BLOCK, - kExtensionPrefsScopeRegular); + store()->SetExtensionContentSetting(ext_id_2, + pattern, + pattern, + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + CONTENT_SETTING_BLOCK, + kExtensionPrefsScopeRegular); EXPECT_EQ(CONTENT_SETTING_BLOCK, - GetContentSettingFromStore( - store(), - url, - url, - CONTENT_SETTINGS_TYPE_COOKIES, - "", - false)); + GetContentSettingFromStore(store(), + url, + url, + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + false)); // Unregister first extension. This shouldn't change the setting. EXPECT_CALL(observer, OnContentSettingChanged(ext_id, false)); store()->UnregisterExtension(ext_id); EXPECT_EQ(CONTENT_SETTING_BLOCK, - GetContentSettingFromStore( - store(), - url, - url, - CONTENT_SETTINGS_TYPE_COOKIES, - "", - false)); + GetContentSettingFromStore(store(), + url, + url, + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + false)); Mock::VerifyAndClear(&observer); // Unregister second extension. This should reset the setting to its default @@ -175,13 +178,12 @@ TEST_F(ContentSettingsStoreTest, RegisterUnregister) { EXPECT_CALL(observer, OnContentSettingChanged(ext_id_2, false)); store()->UnregisterExtension(ext_id_2); EXPECT_EQ(CONTENT_SETTING_DEFAULT, - GetContentSettingFromStore( - store(), - url, - url, - CONTENT_SETTINGS_TYPE_COOKIES, - "", - false)); + GetContentSettingFromStore(store(), + url, + url, + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + false)); store()->RemoveObserver(&observer); } @@ -190,7 +192,7 @@ TEST_F(ContentSettingsStoreTest, GetAllSettings) { bool incognito = false; std::vector<content_settings::Rule> rules; GetSettingsForOneTypeFromStore( - store(), CONTENT_SETTINGS_TYPE_COOKIES, "", incognito, &rules); + store(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(), incognito, &rules); ASSERT_EQ(0u, rules.size()); // Register first extension. @@ -198,17 +200,16 @@ TEST_F(ContentSettingsStoreTest, GetAllSettings) { RegisterExtension(ext_id); ContentSettingsPattern pattern = ContentSettingsPattern::FromURL(GURL("http://www.youtube.com")); - store()->SetExtensionContentSetting( - ext_id, - pattern, - pattern, - CONTENT_SETTINGS_TYPE_COOKIES, - "", - CONTENT_SETTING_ALLOW, - kExtensionPrefsScopeRegular); + store()->SetExtensionContentSetting(ext_id, + pattern, + pattern, + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + CONTENT_SETTING_ALLOW, + kExtensionPrefsScopeRegular); GetSettingsForOneTypeFromStore( - store(), CONTENT_SETTINGS_TYPE_COOKIES, "", incognito, &rules); + store(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(), incognito, &rules); ASSERT_EQ(1u, rules.size()); CheckRule(rules[0], pattern, pattern, CONTENT_SETTING_ALLOW); @@ -217,20 +218,16 @@ TEST_F(ContentSettingsStoreTest, GetAllSettings) { RegisterExtension(ext_id_2); ContentSettingsPattern pattern_2 = ContentSettingsPattern::FromURL(GURL("http://www.example.com")); - store()->SetExtensionContentSetting( - ext_id_2, - pattern_2, - pattern_2, - CONTENT_SETTINGS_TYPE_COOKIES, - "", - CONTENT_SETTING_BLOCK, - kExtensionPrefsScopeRegular); - - GetSettingsForOneTypeFromStore(store(), - CONTENT_SETTINGS_TYPE_COOKIES, - "", - incognito, - &rules); + store()->SetExtensionContentSetting(ext_id_2, + pattern_2, + pattern_2, + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + CONTENT_SETTING_BLOCK, + kExtensionPrefsScopeRegular); + + GetSettingsForOneTypeFromStore( + store(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(), incognito, &rules); ASSERT_EQ(2u, rules.size()); // Rules appear in the reverse installation order of the extensions. CheckRule(rules[0], pattern_2, pattern_2, CONTENT_SETTING_BLOCK); @@ -240,7 +237,7 @@ TEST_F(ContentSettingsStoreTest, GetAllSettings) { store()->SetExtensionState(ext_id, false); GetSettingsForOneTypeFromStore( - store(), CONTENT_SETTINGS_TYPE_COOKIES, "", incognito, &rules); + store(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(), incognito, &rules); ASSERT_EQ(1u, rules.size()); CheckRule(rules[0], pattern_2, pattern_2, CONTENT_SETTING_BLOCK); @@ -248,7 +245,7 @@ TEST_F(ContentSettingsStoreTest, GetAllSettings) { store()->UnregisterExtension(ext_id_2); GetSettingsForOneTypeFromStore( - store(), CONTENT_SETTINGS_TYPE_COOKIES, "", incognito, &rules); + store(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(), incognito, &rules); ASSERT_EQ(0u, rules.size()); } diff --git a/chrome/browser/extensions/api/cookies/cookies_api.cc b/chrome/browser/extensions/api/cookies/cookies_api.cc index f3a4a35..c35b830 100644 --- a/chrome/browser/extensions/api/cookies/cookies_api.cc +++ b/chrome/browser/extensions/api/cookies/cookies_api.cc @@ -203,8 +203,9 @@ bool CookiesGetFunction::RunImpl() { if (!ParseUrl(parsed_args_->details.url, &url_, true)) return false; - std::string store_id = parsed_args_->details.store_id.get() ? - *parsed_args_->details.store_id : ""; + std::string store_id = + parsed_args_->details.store_id.get() ? *parsed_args_->details.store_id + : std::string(); net::URLRequestContextGetter* store_context = NULL; if (!ParseStoreContext(&store_id, &store_context)) return false; @@ -276,8 +277,9 @@ bool CookiesGetAllFunction::RunImpl() { return false; } - std::string store_id = parsed_args_->details.store_id.get() ? - *parsed_args_->details.store_id : ""; + std::string store_id = + parsed_args_->details.store_id.get() ? *parsed_args_->details.store_id + : std::string(); net::URLRequestContextGetter* store_context = NULL; if (!ParseStoreContext(&store_id, &store_context)) return false; @@ -339,8 +341,9 @@ bool CookiesSetFunction::RunImpl() { if (!ParseUrl(parsed_args_->details.url, &url_, true)) return false; - std::string store_id = parsed_args_->details.store_id.get() ? - *parsed_args_->details.store_id : ""; + std::string store_id = + parsed_args_->details.store_id.get() ? *parsed_args_->details.store_id + : std::string(); net::URLRequestContextGetter* store_context = NULL; if (!ParseStoreContext(&store_id, &store_context)) return false; @@ -374,17 +377,19 @@ void CookiesSetFunction::SetCookieOnIOThread() { cookie_monster->SetCookieWithDetailsAsync( url_, - parsed_args_->details.name.get() ? *parsed_args_->details.name : "", - parsed_args_->details.value.get() ? *parsed_args_->details.value : "", - parsed_args_->details.domain.get() ? *parsed_args_->details.domain : "", - parsed_args_->details.path.get() ? *parsed_args_->details.path : "", + parsed_args_->details.name.get() ? *parsed_args_->details.name + : std::string(), + parsed_args_->details.value.get() ? *parsed_args_->details.value + : std::string(), + parsed_args_->details.domain.get() ? *parsed_args_->details.domain + : std::string(), + parsed_args_->details.path.get() ? *parsed_args_->details.path + : std::string(), expiration_time, - parsed_args_->details.secure.get() ? - *parsed_args_->details.secure.get() : - false, - parsed_args_->details.http_only.get() ? - *parsed_args_->details.http_only : - false, + parsed_args_->details.secure.get() ? *parsed_args_->details.secure.get() + : false, + parsed_args_->details.http_only.get() ? *parsed_args_->details.http_only + : false, base::Bind(&CookiesSetFunction::PullCookie, this)); } @@ -406,8 +411,9 @@ void CookiesSetFunction::PullCookieCallback( // Return the first matching cookie. Relies on the fact that the // CookieMonster returns them in canonical order (longest path, then // earliest creation time). - std::string name = parsed_args_->details.name.get() ? - *parsed_args_->details.name : ""; + std::string name = + parsed_args_->details.name.get() ? *parsed_args_->details.name + : std::string(); if (it->Name() == name) { scoped_ptr<Cookie> cookie( cookies_helpers::CreateCookie(*it, *parsed_args_->details.store_id)); @@ -425,10 +431,10 @@ void CookiesSetFunction::PullCookieCallback( void CookiesSetFunction::RespondOnUIThread() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (!success_) { - std::string name = parsed_args_->details.name.get() ? - *parsed_args_->details.name : ""; - error_ = ErrorUtils::FormatErrorMessage( - keys::kCookieSetFailedError, name); + std::string name = + parsed_args_->details.name.get() ? *parsed_args_->details.name + : std::string(); + error_ = ErrorUtils::FormatErrorMessage(keys::kCookieSetFailedError, name); } SendResponse(success_); } @@ -447,8 +453,9 @@ bool CookiesRemoveFunction::RunImpl() { if (!ParseUrl(parsed_args_->details.url, &url_, true)) return false; - std::string store_id = parsed_args_->details.store_id.get() ? - *parsed_args_->details.store_id : ""; + std::string store_id = + parsed_args_->details.store_id.get() ? *parsed_args_->details.store_id + : std::string(); net::URLRequestContextGetter* store_context = NULL; if (!ParseStoreContext(&store_id, &store_context)) return false; diff --git a/chrome/browser/extensions/api/cookies/cookies_helpers.cc b/chrome/browser/extensions/api/cookies/cookies_helpers.cc index d9866f2..c61e729 100644 --- a/chrome/browser/extensions/api/cookies/cookies_helpers.cc +++ b/chrome/browser/extensions/api/cookies/cookies_helpers.cc @@ -74,8 +74,8 @@ scoped_ptr<Cookie> CreateCookie( cookie->host_only = net::cookie_util::DomainIsHostOnly( canonical_cookie.Domain()); // A non-UTF8 path is invalid, so we just replace it with an empty string. - cookie->path = IsStringUTF8(canonical_cookie.Path()) ? - canonical_cookie.Path() : ""; + cookie->path = IsStringUTF8(canonical_cookie.Path()) ? canonical_cookie.Path() + : std::string(); cookie->secure = canonical_cookie.IsSecure(); cookie->http_only = canonical_cookie.IsHttpOnly(); cookie->session = !canonical_cookie.IsPersistent(); diff --git a/chrome/browser/extensions/api/cookies/cookies_unittest.cc b/chrome/browser/extensions/api/cookies/cookies_unittest.cc index f1bd93d..0844b83 100644 --- a/chrome/browser/extensions/api/cookies/cookies_unittest.cc +++ b/chrome/browser/extensions/api/cookies/cookies_unittest.cc @@ -195,22 +195,36 @@ TEST_F(ExtensionCookiesTest, DomainMatching) { scoped_ptr<GetAll::Params> params(GetAll::Params::Create(args)); cookies_helpers::MatchFilter filter(¶ms->details); - net::CanonicalCookie cookie(GURL(), "", "", tests[i].domain,"", - base::Time(), base::Time(), base::Time(), - false, false); + net::CanonicalCookie cookie(GURL(), + std::string(), + std::string(), + tests[i].domain, + std::string(), + base::Time(), + base::Time(), + base::Time(), + false, + false); EXPECT_EQ(tests[i].matches, filter.MatchesCookie(cookie)); } } TEST_F(ExtensionCookiesTest, DecodeUTF8WithErrorHandling) { - net::CanonicalCookie canonical_cookie( - GURL(), "", "011Q255bNX_1!yd\203e+", "test.com", "/path\203", - base::Time(), base::Time(), base::Time(), false, false); + net::CanonicalCookie canonical_cookie(GURL(), + std::string(), + "011Q255bNX_1!yd\203e+", + "test.com", + "/path\203", + base::Time(), + base::Time(), + base::Time(), + false, + false); scoped_ptr<Cookie> cookie( cookies_helpers::CreateCookie( canonical_cookie, "some cookie store")); EXPECT_EQ(std::string("011Q255bNX_1!yd\xEF\xBF\xBD" "e+"), cookie->value); - EXPECT_EQ(std::string(""), cookie->path); + EXPECT_EQ(std::string(), cookie->path); } } // namespace extensions diff --git a/chrome/browser/extensions/api/declarative/initializing_rules_registry.cc b/chrome/browser/extensions/api/declarative/initializing_rules_registry.cc index 0074233..d209bed 100644 --- a/chrome/browser/extensions/api/declarative/initializing_rules_registry.cc +++ b/chrome/browser/extensions/api/declarative/initializing_rules_registry.cc @@ -39,7 +39,7 @@ std::string InitializingRulesRegistry::RemoveRules( if (!error.empty()) return error; RemoveUsedRuleIdentifiers(extension_id, rule_identifiers); - return ""; + return std::string(); } std::string InitializingRulesRegistry::RemoveAllRules( @@ -48,7 +48,7 @@ std::string InitializingRulesRegistry::RemoveAllRules( if (!error.empty()) return error; RemoveAllUsedRuleIdentifiers(extension_id); - return ""; + return std::string(); } std::string InitializingRulesRegistry::GetRules( @@ -122,7 +122,7 @@ std::string InitializingRulesRegistry::CheckAndFillInOptionalRules( used_rule_identifiers_[extension_id].insert(*(rule->id)); } } - return ""; + return std::string(); } void InitializingRulesRegistry::FillInOptionalPriorities( diff --git a/chrome/browser/extensions/api/declarative/rules_registry_with_cache_unittest.cc b/chrome/browser/extensions/api/declarative/rules_registry_with_cache_unittest.cc index 4f49f36..1be1983 100644 --- a/chrome/browser/extensions/api/declarative/rules_registry_with_cache_unittest.cc +++ b/chrome/browser/extensions/api/declarative/rules_registry_with_cache_unittest.cc @@ -69,7 +69,7 @@ TEST_F(RulesRegistryWithCacheTest, AddRules) { registry_->SetResult("Error"); EXPECT_EQ("Error", AddRule(extension_id, rule_id)); EXPECT_EQ(0, GetNumberOfRules(extension_id)); - registry_->SetResult(""); + registry_->SetResult(std::string()); // Check that rules can be inserted. EXPECT_EQ("", AddRule(extension_id, rule_id)); @@ -97,7 +97,7 @@ TEST_F(RulesRegistryWithCacheTest, RemoveRules) { registry_->SetResult("Error"); EXPECT_EQ("Error", RemoveRule(extension_id, rule_id)); EXPECT_EQ(1, GetNumberOfRules(extension_id)); - registry_->SetResult(""); + registry_->SetResult(std::string()); // Check that nothing happens if a rule does not exist. EXPECT_EQ("", RemoveRule(extension_id, "unknown_rule")); @@ -122,7 +122,7 @@ TEST_F(RulesRegistryWithCacheTest, RemoveAllRules) { registry_->SetResult("Error"); EXPECT_EQ("Error", registry_->RemoveAllRules(extension_id)); EXPECT_EQ(2, GetNumberOfRules(extension_id)); - registry_->SetResult(""); + registry_->SetResult(std::string()); // Check that rules may be removed and only for the correct extension. EXPECT_EQ("", registry_->RemoveAllRules(extension_id)); diff --git a/chrome/browser/extensions/api/declarative_content/content_condition.cc b/chrome/browser/extensions/api/declarative_content/content_condition.cc index 4a88e17..6c00b80 100644 --- a/chrome/browser/extensions/api/declarative_content/content_condition.cc +++ b/chrome/browser/extensions/api/declarative_content/content_condition.cc @@ -129,7 +129,8 @@ scoped_ptr<ContentCondition> ContentCondition::Create( if (!url_matcher_condition_set) { URLMatcherConditionSet::Conditions url_matcher_conditions; url_matcher_conditions.insert( - url_matcher_condition_factory->CreateHostPrefixCondition("")); + url_matcher_condition_factory->CreateHostPrefixCondition( + std::string())); url_matcher_condition_set = new URLMatcherConditionSet(++g_next_id, url_matcher_conditions); } diff --git a/chrome/browser/extensions/api/declarative_content/content_rules_registry.cc b/chrome/browser/extensions/api/declarative_content/content_rules_registry.cc index c9ed31e..eb95b47 100644 --- a/chrome/browser/extensions/api/declarative_content/content_rules_registry.cc +++ b/chrome/browser/extensions/api/declarative_content/content_rules_registry.cc @@ -176,7 +176,7 @@ std::string ContentRulesRegistry::AddRulesImpl( UpdateConditionCache(); - return ""; + return std::string(); } std::string ContentRulesRegistry::RemoveRulesImpl( @@ -221,7 +221,7 @@ std::string ContentRulesRegistry::RemoveRulesImpl( UpdateConditionCache(); - return ""; + return std::string(); } std::string ContentRulesRegistry::RemoveAllRulesImpl( diff --git a/chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc b/chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc index 813b6b9..dc3bead 100644 --- a/chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc +++ b/chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc @@ -56,7 +56,7 @@ IN_PROC_BROWSER_TEST_F(DeclarativeContentApiTest, Overview) { tab, "document.body.innerHTML = '<input type=\"password\">';")); // Give the mutation observer a chance to run and send back the // matching-selector update. - ASSERT_TRUE(content::ExecuteScript(tab, "")); + ASSERT_TRUE(content::ExecuteScript(tab, std::string())); EXPECT_TRUE(page_action->GetIsVisible(tab_id)); // Remove it again to make sure that reverts the action. @@ -64,7 +64,7 @@ IN_PROC_BROWSER_TEST_F(DeclarativeContentApiTest, Overview) { tab, "document.body.innerHTML = 'Hello world';")); // Give the mutation observer a chance to run and send back the // matching-selector update. - ASSERT_TRUE(content::ExecuteScript(tab, "")); + ASSERT_TRUE(content::ExecuteScript(tab, std::string())); EXPECT_FALSE(page_action->GetIsVisible(tab_id)); } diff --git a/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry.cc b/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry.cc index c8cae51..695edac 100644 --- a/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry.cc +++ b/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry.cc @@ -184,7 +184,7 @@ std::string WebRequestRulesRegistry::AddRulesImpl( ClearCacheOnNavigation(); - return ""; + return std::string(); } std::string WebRequestRulesRegistry::RemoveRulesImpl( @@ -223,7 +223,7 @@ std::string WebRequestRulesRegistry::RemoveRulesImpl( ClearCacheOnNavigation(); - return ""; + return std::string(); } std::string WebRequestRulesRegistry::RemoveAllRulesImpl( diff --git a/chrome/browser/extensions/api/developer_private/entry_picker.cc b/chrome/browser/extensions/api/developer_private/entry_picker.cc index c2b3d78..d305f4f 100644 --- a/chrome/browser/extensions/api/developer_private/entry_picker.cc +++ b/chrome/browser/extensions/api/developer_private/entry_picker.cc @@ -64,8 +64,9 @@ EntryPicker::EntryPicker(EntryPickerClient* client, last_directory, &info, file_type_index, - FILE_PATH_LITERAL(""), - owning_window, NULL); + FILE_PATH_LITERAL(std::string()), + owning_window, + NULL); } EntryPicker::~EntryPicker() {} diff --git a/chrome/browser/extensions/api/dial/dial_device_data_unittest.cc b/chrome/browser/extensions/api/dial/dial_device_data_unittest.cc index 447efca..4ccc470 100644 --- a/chrome/browser/extensions/api/dial/dial_device_data_unittest.cc +++ b/chrome/browser/extensions/api/dial/dial_device_data_unittest.cc @@ -96,9 +96,9 @@ TEST(DialDeviceDataTest, TestIsDeviceDescriptionUrl) { GURL("https://192.168.1.1:1234/dd.xml"))); EXPECT_FALSE(DialDeviceData::IsDeviceDescriptionUrl(GURL())); - EXPECT_FALSE(DialDeviceData::IsDeviceDescriptionUrl(GURL(""))); - EXPECT_FALSE(DialDeviceData::IsDeviceDescriptionUrl( - GURL("file://path/to/file"))); + EXPECT_FALSE(DialDeviceData::IsDeviceDescriptionUrl(GURL(std::string()))); + EXPECT_FALSE( + DialDeviceData::IsDeviceDescriptionUrl(GURL("file://path/to/file"))); } } // namespace extensions diff --git a/chrome/browser/extensions/api/dial/dial_service_unittest.cc b/chrome/browser/extensions/api/dial/dial_service_unittest.cc index da1cc7b..b378589 100644 --- a/chrome/browser/extensions/api/dial/dial_service_unittest.cc +++ b/chrome/browser/extensions/api/dial/dial_service_unittest.cc @@ -116,9 +116,7 @@ TEST_F(DialServiceTest, TestResponseParsing) { DialDeviceData not_parsed; // Empty, garbage - EXPECT_FALSE(DialServiceImpl::ParseResponse( - "", - now, ¬_parsed)); + EXPECT_FALSE(DialServiceImpl::ParseResponse(std::string(), now, ¬_parsed)); EXPECT_FALSE(DialServiceImpl::ParseResponse( "\r\n\r\n", now, ¬_parsed)); diff --git a/chrome/browser/extensions/api/downloads/downloads_api.cc b/chrome/browser/extensions/api/downloads/downloads_api.cc index 44e7f29..6a126aa 100644 --- a/chrome/browser/extensions/api/downloads/downloads_api.cc +++ b/chrome/browser/extensions/api/downloads/downloads_api.cc @@ -218,9 +218,9 @@ scoped_ptr<base::DictionaryValue> DownloadItemToJSON( json->SetBoolean(kExistsKey, !download_item->GetFileExternallyRemoved()); json->SetInteger(kIdKey, download_item->GetId()); const GURL& url = download_item->GetOriginalUrl(); - json->SetString(kUrlKey, (url.is_valid() ? url.spec() : "")); - json->SetString( - kFilenameKey, download_item->GetFullPath().LossyDisplayName()); + json->SetString(kUrlKey, (url.is_valid() ? url.spec() : std::string())); + json->SetString(kFilenameKey, + download_item->GetFullPath().LossyDisplayName()); json->SetString(kDangerKey, DangerString(download_item->GetDangerType())); if (download_item->GetDangerType() != content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS) diff --git a/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc b/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc index 23a1131..e403cd5 100644 --- a/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc +++ b/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc @@ -737,7 +737,8 @@ class HTML5FileWriter { ~HTML5FileWriter() { CHECK(BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind( &HTML5FileWriter::TearDownURLRequestContext, base::Unretained(this)))); - events_listener_->WaitFor(profile_, kURLRequestContextToreDown, ""); + events_listener_->WaitFor( + profile_, kURLRequestContextToreDown, std::string()); } bool WriteFile() { @@ -1071,8 +1072,10 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, // Simulate an error during icon load by invoking the mock with an empty // result string. - std::string error = RunFunctionAndReturnError(MockedGetFileIconFunction( - download_item->GetTargetFilePath(), IconLoader::NORMAL, ""), + std::string error = RunFunctionAndReturnError( + MockedGetFileIconFunction(download_item->GetTargetFilePath(), + IconLoader::NORMAL, + std::string()), args32); EXPECT_STREQ(download_extension_errors::kIconNotFoundError, error.c_str()); diff --git a/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc b/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc index 0a5497f..07845e4 100644 --- a/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc +++ b/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc @@ -692,11 +692,9 @@ IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, TestTriggerBrowserAction) { "window.domAutomationController.send(document.body.style." "backgroundColor);"; std::string result; - const std::string frame_xpath = ""; - EXPECT_TRUE(content::ExecuteScriptInFrameAndExtractString(tab, - frame_xpath, - script, - &result)); + const std::string frame_xpath; + EXPECT_TRUE(content::ExecuteScriptInFrameAndExtractString( + tab, frame_xpath, script, &result)); EXPECT_EQ(result, "red"); } diff --git a/chrome/browser/extensions/api/extension_action/page_action_apitest.cc b/chrome/browser/extensions/api/extension_action/page_action_apitest.cc index 232280a..cad5250 100644 --- a/chrome/browser/extensions/api/extension_action/page_action_apitest.cc +++ b/chrome/browser/extensions/api/extension_action/page_action_apitest.cc @@ -63,7 +63,7 @@ IN_PROC_BROWSER_TEST_F(PageActionApiTest, Basic) { ExtensionService* service = extensions::ExtensionSystem::Get( browser()->profile())->extension_service(); service->browser_event_router()->PageActionExecuted( - browser()->profile(), *action, tab_id, "", 0); + browser()->profile(), *action, tab_id, std::string(), 0); EXPECT_TRUE(catcher.GetNextResult()); } @@ -108,7 +108,7 @@ IN_PROC_BROWSER_TEST_F(PageActionApiTest, AddPopup) { ExtensionService* service = extensions::ExtensionSystem::Get( browser()->profile())->extension_service(); service->browser_event_router()->PageActionExecuted( - browser()->profile(), *page_action, tab_id, "", 1); + browser()->profile(), *page_action, tab_id, std::string(), 1); ASSERT_TRUE(catcher.GetNextResult()); } @@ -188,7 +188,7 @@ IN_PROC_BROWSER_TEST_F(PageActionApiTest, OldPageActions) { browser()->profile())->extension_service(); ExtensionAction* page_action = GetPageAction(*extension); service->browser_event_router()->PageActionExecuted( - browser()->profile(), *page_action, tab_id, "", 1); + browser()->profile(), *page_action, tab_id, std::string(), 1); EXPECT_TRUE(catcher.GetNextResult()); } } @@ -260,7 +260,7 @@ IN_PROC_BROWSER_TEST_F(PageActionApiTest, TestTriggerPageAction) { ExtensionService* service = extensions::ExtensionSystem::Get( browser()->profile())->extension_service(); service->browser_event_router()->PageActionExecuted( - browser()->profile(), *page_action, tab_id, "", 0); + browser()->profile(), *page_action, tab_id, std::string(), 0); EXPECT_TRUE(catcher.GetNextResult()); } @@ -273,11 +273,9 @@ IN_PROC_BROWSER_TEST_F(PageActionApiTest, TestTriggerPageAction) { "window.domAutomationController.send(document.body.style." "backgroundColor);"; std::string result; - const std::string frame_xpath = ""; - EXPECT_TRUE(content::ExecuteScriptInFrameAndExtractString(tab, - frame_xpath, - script, - &result)); + const std::string frame_xpath; + EXPECT_TRUE(content::ExecuteScriptInFrameAndExtractString( + tab, frame_xpath, script, &result)); EXPECT_EQ(result, "red"); } diff --git a/chrome/browser/extensions/api/extension_action/script_badge_apitest.cc b/chrome/browser/extensions/api/extension_action/script_badge_apitest.cc index fd32e96..ff7fae7 100644 --- a/chrome/browser/extensions/api/extension_action/script_badge_apitest.cc +++ b/chrome/browser/extensions/api/extension_action/script_badge_apitest.cc @@ -88,7 +88,8 @@ IN_PROC_BROWSER_TEST_F(ScriptBadgeApiTest, Basics) { ResultCatcher catcher; // Visit a non-extension page so the extension can run a content script and // cause the script badge to be animated in. - ui_test_utils::NavigateToURL(browser(), test_server()->GetURL("")); + ui_test_utils::NavigateToURL(browser(), + test_server()->GetURL(std::string())); ASSERT_TRUE(catcher.GetNextResult()); } EXPECT_TRUE(script_badge->GetIsVisible(tab_id)); diff --git a/chrome/browser/extensions/api/file_system/file_system_api.cc b/chrome/browser/extensions/api/file_system/file_system_api.cc index 3bb588a..3b4e6f7 100644 --- a/chrome/browser/extensions/api/file_system/file_system_api.cc +++ b/chrome/browser/extensions/api/file_system/file_system_api.cc @@ -435,8 +435,11 @@ class FileSystemChooseEntryFunction::FilePicker select_file_dialog_->SelectFile(picker_type, string16(), suggested_name, - &file_type_info, 0, FILE_PATH_LITERAL(""), - owning_window, NULL); + &file_type_info, + 0, + FILE_PATH_LITERAL(std::string()), + owning_window, + NULL); } virtual ~FilePicker() {} diff --git a/chrome/browser/extensions/api/file_system/file_system_api_unittest.cc b/chrome/browser/extensions/api/file_system/file_system_api_unittest.cc index 96da293..570c0fb 100644 --- a/chrome/browser/extensions/api/file_system/file_system_api_unittest.cc +++ b/chrome/browser/extensions/api/file_system/file_system_api_unittest.cc @@ -70,8 +70,8 @@ TEST_F(FileSystemApiUnitTest, FileSystemChooseEntryFunctionFileTypeInfoTest) { // Test grouping of multiple types. file_type_info = ui::SelectFileDialog::FileTypeInfo(); std::vector<linked_ptr<AcceptOption> > options; - options.push_back(linked_ptr<AcceptOption>( - BuildAcceptOption("", "application/x-chrome-extension", "jso"))); + options.push_back(linked_ptr<AcceptOption>(BuildAcceptOption( + std::string(), "application/x-chrome-extension", "jso"))); acceptsAllTypes = false; FileSystemChooseEntryFunction::BuildFileTypeInfo(&file_type_info, base::FilePath::StringType(), &options, &acceptsAllTypes); @@ -90,7 +90,7 @@ TEST_F(FileSystemApiUnitTest, FileSystemChooseEntryFunctionFileTypeInfoTest) { file_type_info = ui::SelectFileDialog::FileTypeInfo(); options.clear(); options.push_back(linked_ptr<AcceptOption>( - BuildAcceptOption("", "", "unrelated"))); + BuildAcceptOption(std::string(), std::string(), "unrelated"))); acceptsAllTypes = false; FileSystemChooseEntryFunction::BuildFileTypeInfo(&file_type_info, ToStringType(".jso"), &options, &acceptsAllTypes); @@ -100,9 +100,9 @@ TEST_F(FileSystemApiUnitTest, FileSystemChooseEntryFunctionFileTypeInfoTest) { file_type_info = ui::SelectFileDialog::FileTypeInfo(); options.clear(); options.push_back(linked_ptr<AcceptOption>( - BuildAcceptOption("", "", "jso,js"))); + BuildAcceptOption(std::string(), std::string(), "jso,js"))); options.push_back(linked_ptr<AcceptOption>( - BuildAcceptOption("", "", "cpp,cc"))); + BuildAcceptOption(std::string(), std::string(), "cpp,cc"))); acceptsAllTypes = false; FileSystemChooseEntryFunction::BuildFileTypeInfo(&file_type_info, base::FilePath::StringType(), &options, &acceptsAllTypes); @@ -122,7 +122,7 @@ TEST_F(FileSystemApiUnitTest, FileSystemChooseEntryFunctionFileTypeInfoTest) { file_type_info = ui::SelectFileDialog::FileTypeInfo(); options.clear(); options.push_back(linked_ptr<AcceptOption>( - BuildAcceptOption("", "image/*", "html"))); + BuildAcceptOption(std::string(), "image/*", "html"))); acceptsAllTypes = false; FileSystemChooseEntryFunction::BuildFileTypeInfo(&file_type_info, base::FilePath::StringType(), &options, &acceptsAllTypes); @@ -134,8 +134,8 @@ TEST_F(FileSystemApiUnitTest, FileSystemChooseEntryFunctionFileTypeInfoTest) { // still present the default. file_type_info = ui::SelectFileDialog::FileTypeInfo(); options.clear(); - options.push_back(linked_ptr<AcceptOption>( - BuildAcceptOption("", "image/*,audio/*,video/*", ""))); + options.push_back(linked_ptr<AcceptOption>(BuildAcceptOption( + std::string(), "image/*,audio/*,video/*", std::string()))); acceptsAllTypes = false; FileSystemChooseEntryFunction::BuildFileTypeInfo(&file_type_info, base::FilePath::StringType(), &options, &acceptsAllTypes); @@ -146,7 +146,7 @@ TEST_F(FileSystemApiUnitTest, FileSystemChooseEntryFunctionFileTypeInfoTest) { file_type_info = ui::SelectFileDialog::FileTypeInfo(); options.clear(); options.push_back(linked_ptr<AcceptOption>( - BuildAcceptOption("File Types 101", "image/jpeg", ""))); + BuildAcceptOption("File Types 101", "image/jpeg", std::string()))); acceptsAllTypes = false; FileSystemChooseEntryFunction::BuildFileTypeInfo(&file_type_info, base::FilePath::StringType(), &options, &acceptsAllTypes); diff --git a/chrome/browser/extensions/api/identity/identity_apitest.cc b/chrome/browser/extensions/api/identity/identity_apitest.cc index b6fec79d..174f922 100644 --- a/chrome/browser/extensions/api/identity/identity_apitest.cc +++ b/chrome/browser/extensions/api/identity/identity_apitest.cc @@ -508,7 +508,7 @@ class LaunchWebAuthFlowFunctionTest : public ExtensionBrowserTest { }; IN_PROC_BROWSER_TEST_F(LaunchWebAuthFlowFunctionTest, Bounds) { - RunAndCheckBounds("", 0, 0, 0, 0); + RunAndCheckBounds(std::string(), 0, 0, 0, 0); RunAndCheckBounds("\"width\": 100, \"height\": 200", 0, 0, 100, 200); RunAndCheckBounds("\"left\": 100, \"top\": 200", 100, 200, 0, 0); RunAndCheckBounds( diff --git a/chrome/browser/extensions/api/management/management_api_browsertest.cc b/chrome/browser/extensions/api/management/management_api_browsertest.cc index f475e81..5b6b04d 100644 --- a/chrome/browser/extensions/api/management/management_api_browsertest.cc +++ b/chrome/browser/extensions/api/management/management_api_browsertest.cc @@ -257,15 +257,15 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementApiEscalationTest, // This should succeed when user accepts dialog. CommandLine::ForCurrentProcess()->AppendSwitchASCII( switches::kAppsGalleryInstallAutoConfirmForTests, "accept"); - SetEnabled(true, true, ""); + SetEnabled(true, true, std::string()); // Crash the extension. Mock a reload by disabling and then enabling. The // extension should be reloaded and enabled. ASSERT_TRUE(CrashEnabledExtension(kId)); - SetEnabled(false, true, ""); - SetEnabled(true, true, ""); - const Extension* extension = ExtensionSystem::Get(browser()->profile())-> - extension_service()->GetExtensionById(kId, false); + SetEnabled(false, true, std::string()); + SetEnabled(true, true, std::string()); + const Extension* extension = ExtensionSystem::Get(browser()->profile()) + ->extension_service()->GetExtensionById(kId, false); EXPECT_TRUE(extension); } diff --git a/chrome/browser/extensions/api/messaging/message_service.cc b/chrome/browser/extensions/api/messaging/message_service.cc index aae6a25..e3075f9 100644 --- a/chrome/browser/extensions/api/messaging/message_service.cc +++ b/chrome/browser/extensions/api/messaging/message_service.cc @@ -216,7 +216,7 @@ void MessageService::OpenChannelToNativeApp( } if (!has_permission) { - ExtensionMessagePort port(source, MSG_ROUTING_CONTROL, ""); + ExtensionMessagePort port(source, MSG_ROUTING_CONTROL, std::string()); port.DispatchOnDisconnect(GET_OPPOSITE_PORT_ID(receiver_port_id), kMissingPermissionError); return; @@ -247,7 +247,7 @@ void MessageService::OpenChannelToNativeApp( if (!native_process.get()) { LOG(ERROR) << "Failed to create native process."; // Treat it as a disconnect. - ExtensionMessagePort port(source, MSG_ROUTING_CONTROL, ""); + ExtensionMessagePort port(source, MSG_ROUTING_CONTROL, std::string()); port.DispatchOnDisconnect(GET_OPPOSITE_PORT_ID(receiver_port_id), kReceivingEndDoesntExistError); return; @@ -320,7 +320,8 @@ bool MessageService::OpenChannelImpl(scoped_ptr<OpenChannelParams> params) { if (!params->receiver.get() || !params->receiver->GetRenderProcessHost()) { // Treat it as a disconnect. - ExtensionMessagePort port(params->source, MSG_ROUTING_CONTROL, ""); + ExtensionMessagePort port( + params->source, MSG_ROUTING_CONTROL, std::string()); port.DispatchOnDisconnect(GET_OPPOSITE_PORT_ID(params->receiver_port_id), kReceivingEndDoesntExistError); return false; diff --git a/chrome/browser/extensions/api/proxy/proxy_api.cc b/chrome/browser/extensions/api/proxy/proxy_api.cc index ff945d3..5e811bd 100644 --- a/chrome/browser/extensions/api/proxy/proxy_api.cc +++ b/chrome/browser/extensions/api/proxy/proxy_api.cc @@ -41,7 +41,7 @@ void ProxyEventRouter::OnProxyError( DictionaryValue* dict = new DictionaryValue(); dict->SetBoolean(keys::kProxyEventFatal, true); dict->SetString(keys::kProxyEventError, net::ErrorToString(error_code)); - dict->SetString(keys::kProxyEventDetails, ""); + dict->SetString(keys::kProxyEventDetails, std::string()); args->Append(dict); if (profile) { diff --git a/chrome/browser/extensions/api/proxy/proxy_api_helpers_unittest.cc b/chrome/browser/extensions/api/proxy/proxy_api_helpers_unittest.cc index 116f85a..ff3cd32 100644 --- a/chrome/browser/extensions/api/proxy/proxy_api_helpers_unittest.cc +++ b/chrome/browser/extensions/api/proxy/proxy_api_helpers_unittest.cc @@ -222,41 +222,71 @@ TEST(ExtensionProxyApiHelpers, CreateProxyConfigDict) { std::string error; scoped_ptr<DictionaryValue> exp_direct(ProxyConfigDictionary::CreateDirect()); scoped_ptr<DictionaryValue> out_direct( - CreateProxyConfigDict(ProxyPrefs::MODE_DIRECT, false, "", "", "", "", + CreateProxyConfigDict(ProxyPrefs::MODE_DIRECT, + false, + std::string(), + std::string(), + std::string(), + std::string(), &error)); EXPECT_TRUE(Value::Equals(exp_direct.get(), out_direct.get())); scoped_ptr<DictionaryValue> exp_auto( ProxyConfigDictionary::CreateAutoDetect()); scoped_ptr<DictionaryValue> out_auto( - CreateProxyConfigDict(ProxyPrefs::MODE_AUTO_DETECT, false, "", "", "", "", + CreateProxyConfigDict(ProxyPrefs::MODE_AUTO_DETECT, + false, + std::string(), + std::string(), + std::string(), + std::string(), &error)); EXPECT_TRUE(Value::Equals(exp_auto.get(), out_auto.get())); scoped_ptr<DictionaryValue> exp_pac_url( ProxyConfigDictionary::CreatePacScript(kSamplePacScriptUrl, false)); scoped_ptr<DictionaryValue> out_pac_url( - CreateProxyConfigDict(ProxyPrefs::MODE_PAC_SCRIPT, false, - kSamplePacScriptUrl, "", "", "", &error)); + CreateProxyConfigDict(ProxyPrefs::MODE_PAC_SCRIPT, + false, + kSamplePacScriptUrl, + std::string(), + std::string(), + std::string(), + &error)); EXPECT_TRUE(Value::Equals(exp_pac_url.get(), out_pac_url.get())); scoped_ptr<DictionaryValue> exp_pac_data( ProxyConfigDictionary::CreatePacScript(kSamplePacScriptAsDataUrl, false)); scoped_ptr<DictionaryValue> out_pac_data( - CreateProxyConfigDict(ProxyPrefs::MODE_PAC_SCRIPT, false, "", - kSamplePacScript, "", "", &error)); + CreateProxyConfigDict(ProxyPrefs::MODE_PAC_SCRIPT, + false, + std::string(), + kSamplePacScript, + std::string(), + std::string(), + &error)); EXPECT_TRUE(Value::Equals(exp_pac_data.get(), out_pac_data.get())); scoped_ptr<DictionaryValue> exp_fixed( ProxyConfigDictionary::CreateFixedServers("foo:80", "localhost")); scoped_ptr<DictionaryValue> out_fixed( - CreateProxyConfigDict(ProxyPrefs::MODE_FIXED_SERVERS, false, "", "", - "foo:80", "localhost", &error)); + CreateProxyConfigDict(ProxyPrefs::MODE_FIXED_SERVERS, + false, + std::string(), + std::string(), + "foo:80", + "localhost", + &error)); EXPECT_TRUE(Value::Equals(exp_fixed.get(), out_fixed.get())); scoped_ptr<DictionaryValue> exp_system(ProxyConfigDictionary::CreateSystem()); scoped_ptr<DictionaryValue> out_system( - CreateProxyConfigDict(ProxyPrefs::MODE_SYSTEM, false, "", "", "", "", + CreateProxyConfigDict(ProxyPrefs::MODE_SYSTEM, + false, + std::string(), + std::string(), + std::string(), + std::string(), &error)); EXPECT_TRUE(Value::Equals(exp_system.get(), out_system.get())); diff --git a/chrome/browser/extensions/api/socket/udp_socket.cc b/chrome/browser/extensions/api/socket/udp_socket.cc index a2b5f97..b9a804c 100644 --- a/chrome/browser/extensions/api/socket/udp_socket.cc +++ b/chrome/browser/extensions/api/socket/udp_socket.cc @@ -108,7 +108,7 @@ void UDPSocket::RecvFrom(int count, DCHECK(!callback.is_null()); if (!recv_from_callback_.is_null()) { - callback.Run(net::ERR_IO_PENDING, NULL, "", 0); + callback.Run(net::ERR_IO_PENDING, NULL, std::string(), 0); return; } else { recv_from_callback_ = callback; diff --git a/chrome/browser/extensions/api/storage/settings_sync_unittest.cc b/chrome/browser/extensions/api/storage/settings_sync_unittest.cc index ec530e8..fcfcdc8 100644 --- a/chrome/browser/extensions/api/storage/settings_sync_unittest.cc +++ b/chrome/browser/extensions/api/storage/settings_sync_unittest.cc @@ -130,9 +130,10 @@ class MockSyncChangeProcessor : public syncer::SyncChangeProcessor { if (matching_changes.empty()) { ADD_FAILURE() << "No matching changes for " << extension_id << "/" << key << " (out of " << changes_.size() << ")"; - return SettingSyncData( - syncer::SyncChange::ACTION_INVALID, "", "", - scoped_ptr<Value>(new DictionaryValue())); + return SettingSyncData(syncer::SyncChange::ACTION_INVALID, + std::string(), + std::string(), + scoped_ptr<Value>(new DictionaryValue())); } if (matching_changes.size() != 1u) { ADD_FAILURE() << matching_changes.size() << " matching changes for " << diff --git a/chrome/browser/extensions/api/web_request/web_request_api.cc b/chrome/browser/extensions/api/web_request/web_request_api.cc index a17684e..56a8403 100644 --- a/chrome/browser/extensions/api/web_request/web_request_api.cc +++ b/chrome/browser/extensions/api/web_request/web_request_api.cc @@ -316,7 +316,7 @@ ListValue* GetRequestHeadersList(const net::HttpRequestHeaders& headers) { // Creates a StringValue with the status line of |headers|. If |headers| is // NULL, an empty string is returned. Ownership is passed to the caller. StringValue* GetStatusLine(net::HttpResponseHeaders* headers) { - return new StringValue(headers ? headers->GetStatusLine() : ""); + return new StringValue(headers ? headers->GetStatusLine() : std::string()); } void NotifyWebRequestAPIUsed(void* profile_id, const Extension* extension) { diff --git a/chrome/browser/extensions/api/web_request/web_request_api_helpers.cc b/chrome/browser/extensions/api/web_request/web_request_api_helpers.cc index a9f1319..0d2a3d6 100644 --- a/chrome/browser/extensions/api/web_request/web_request_api_helpers.cc +++ b/chrome/browser/extensions/api/web_request/web_request_api_helpers.cc @@ -621,7 +621,7 @@ static std::string FindSetRequestHeader( return (*delta)->extension_id; } } - return ""; + return std::string(); } // Returns the extension ID of the first extension in |deltas| that removes the @@ -639,7 +639,7 @@ static std::string FindRemoveRequestHeader( return (*delta)->extension_id; } } - return ""; + return std::string(); } void MergeOnBeforeSendHeadersResponses( @@ -816,22 +816,26 @@ static bool DoesResponseCookieMatchFilter(net::ParsedCookie* cookie, if (filter->name.get() && cookie->Name() != *filter->name) return false; if (filter->value.get() && cookie->Value() != *filter->value) return false; if (filter->expires.get()) { - std::string actual_value = cookie->HasExpires() ? cookie->Expires() : ""; + std::string actual_value = + cookie->HasExpires() ? cookie->Expires() : std::string(); if (actual_value != *filter->expires) return false; } if (filter->max_age.get()) { - std::string actual_value = cookie->HasMaxAge() ? cookie->MaxAge() : ""; + std::string actual_value = + cookie->HasMaxAge() ? cookie->MaxAge() : std::string(); if (actual_value != base::IntToString(*filter->max_age)) return false; } if (filter->domain.get()) { - std::string actual_value = cookie->HasDomain() ? cookie->Domain() : ""; + std::string actual_value = + cookie->HasDomain() ? cookie->Domain() : std::string(); if (actual_value != *filter->domain) return false; } if (filter->path.get()) { - std::string actual_value = cookie->HasPath() ? cookie->Path() : ""; + std::string actual_value = + cookie->HasPath() ? cookie->Path() : std::string(); if (actual_value != *filter->path) return false; } @@ -880,7 +884,8 @@ static bool MergeAddResponseCookieModifications( continue; // Cookie names are not unique in response cookies so we always append // and never override. - linked_ptr<net::ParsedCookie> cookie(new net::ParsedCookie("")); + linked_ptr<net::ParsedCookie> cookie( + new net::ParsedCookie(std::string())); ApplyResponseCookieModification((*mod)->modification.get(), cookie.get()); cookies->push_back(cookie); modified = true; @@ -1008,7 +1013,7 @@ static std::string FindRemoveResponseHeader( return (*delta)->extension_id; } } - return ""; + return std::string(); } void MergeOnHeadersReceivedResponses( diff --git a/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc b/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc index 91e3dd9..fc78860 100644 --- a/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc +++ b/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc @@ -574,9 +574,10 @@ TEST_F(ExtensionWebRequestTest, AccessRequestBodyData) { keys::kRequestBodyRawBytesKey, BinaryValue::CreateWithCopiedBuffer(kPlainBlock1, kPlainBlock1Length), &raw); - extensions::subtle::AppendKeyValuePair(keys::kRequestBodyRawFileKey, - Value::CreateStringValue(""), - &raw); + extensions::subtle::AppendKeyValuePair( + keys::kRequestBodyRawFileKey, + Value::CreateStringValue(std::string()), + &raw); extensions::subtle::AppendKeyValuePair( keys::kRequestBodyRawBytesKey, BinaryValue::CreateWithCopiedBuffer(kPlainBlock2, kPlainBlock2Length), @@ -962,7 +963,7 @@ void TestInitFromValue(const std::string& values, bool expected_return_code, } TEST_F(ExtensionWebRequestTest, InitFromValue) { - TestInitFromValue("", true, 0); + TestInitFromValue(std::string(), true, 0); // Single valid values. TestInitFromValue( diff --git a/chrome/browser/extensions/api/web_socket_proxy_private/web_socket_proxy_private_api.cc b/chrome/browser/extensions/api/web_socket_proxy_private/web_socket_proxy_private_api.cc index 237941c..91483c5 100644 --- a/chrome/browser/extensions/api/web_socket_proxy_private/web_socket_proxy_private_api.cc +++ b/chrome/browser/extensions/api/web_socket_proxy_private/web_socket_proxy_private_api.cc @@ -95,7 +95,7 @@ void WebSocketProxyPrivate::ResolveHostIOPart(IOThread* io_thread) { bool WebSocketProxyPrivate::RunImpl() { AddRef(); - SetResult(Value::CreateStringValue("")); + SetResult(Value::CreateStringValue(std::string())); #if defined(OS_CHROMEOS) bool delay_response = false; diff --git a/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc b/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc index 0264c36..8cb59aa 100644 --- a/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc +++ b/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc @@ -295,7 +295,7 @@ bool BeginInstallWithManifestFunction::RunImpl() { void BeginInstallWithManifestFunction::SetResultCode(ResultCode code) { switch (code) { case ERROR_NONE: - SetResult(Value::CreateStringValue("")); + SetResult(Value::CreateStringValue(std::string())); break; case UNKNOWN_ERROR: SetResult(Value::CreateStringValue("unknown_error")); @@ -338,7 +338,7 @@ void BeginInstallWithManifestFunction::OnWebstoreParseSuccess( Extension::FROM_WEBSTORE, id, localized_name_, - "", + std::string(), &error); if (!dummy_extension_) { diff --git a/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc b/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc index 81a63d1..1a39317 100644 --- a/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc +++ b/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc @@ -248,7 +248,7 @@ class ExtensionWebstoreGetWebGLStatusTest : public InProcessBrowserTest { function.get(), kEmptyArgs, browser())); ASSERT_TRUE(result); EXPECT_EQ(base::Value::TYPE_STRING, result->GetType()); - std::string webgl_status = ""; + std::string webgl_status; EXPECT_TRUE(result->GetAsString(&webgl_status)); EXPECT_STREQ(webgl_allowed ? kWebGLStatusAllowed : kWebGLStatusBlocked, webgl_status.c_str()); diff --git a/chrome/browser/extensions/bundle_installer.cc b/chrome/browser/extensions/bundle_installer.cc index 97005be..7cf66d3 100644 --- a/chrome/browser/extensions/bundle_installer.cc +++ b/chrome/browser/extensions/bundle_installer.cc @@ -215,7 +215,7 @@ void BundleInstaller::ParseManifests() { for (ItemMap::iterator i = items_.begin(); i != items_.end(); ++i) { scoped_refptr<WebstoreInstallHelper> helper = new WebstoreInstallHelper( - this, i->first, i->second.manifest, "", GURL(), NULL); + this, i->first, i->second.manifest, std::string(), GURL(), NULL); helper->Start(); } } diff --git a/chrome/browser/extensions/component_loader.cc b/chrome/browser/extensions/component_loader.cc index 58c53b7..82a6883 100644 --- a/chrome/browser/extensions/component_loader.cc +++ b/chrome/browser/extensions/component_loader.cc @@ -137,7 +137,7 @@ std::string ComponentLoader::Add(const std::string& manifest_contents, DictionaryValue* manifest = ParseManifest(manifest_contents); if (manifest) return Add(manifest, root_directory); - return ""; + return std::string(); } std::string ComponentLoader::Add(const DictionaryValue* parsed_manifest, diff --git a/chrome/browser/extensions/component_loader_unittest.cc b/chrome/browser/extensions/component_loader_unittest.cc index bedcfee..4b2b52a 100644 --- a/chrome/browser/extensions/component_loader_unittest.cc +++ b/chrome/browser/extensions/component_loader_unittest.cc @@ -141,7 +141,7 @@ TEST_F(ComponentLoaderTest, ParseManifest) { // Test manifests that are valid JSON, but don't have an object literal // at the root. ParseManifest() should always return NULL. - manifest.reset(component_loader_.ParseManifest("")); + manifest.reset(component_loader_.ParseManifest(std::string())); EXPECT_FALSE(manifest.get()); manifest.reset(component_loader_.ParseManifest("[{ \"foo\": 3 }]")); diff --git a/chrome/browser/extensions/event_router.cc b/chrome/browser/extensions/event_router.cc index 4a75636..72e0f52 100644 --- a/chrome/browser/extensions/event_router.cc +++ b/chrome/browser/extensions/event_router.cc @@ -119,7 +119,7 @@ void EventRouter::LogExtensionEventMessage(void* profile_id, LOG(WARNING) << "Extension " << extension_id << " not found!"; } else { extensions::ActivityLog::GetInstance(profile)->LogEventAction( - extension, event_name, event_args.get(), ""); + extension, event_name, event_args.get(), std::string()); } } } @@ -243,10 +243,8 @@ void EventRouter::OnListenerAdded(const EventListener* listener) { scoped_ptr<ListValue> args(new ListValue()); if (listener->filter) args->Append(listener->filter->DeepCopy()); - activity_log_->LogAPIAction(extension, - event_name + ".addListener", - args.get(), - ""); + activity_log_->LogAPIAction( + extension, event_name + ".addListener", args.get(), std::string()); } } @@ -271,10 +269,8 @@ void EventRouter::OnListenerRemoved(const EventListener* listener) { ExtensionService::INCLUDE_ENABLED); if (extension) { scoped_ptr<ListValue> args(new ListValue()); - activity_log_->LogAPIAction(extension, - event_name + ".removeListener", - args.get(), - ""); + activity_log_->LogAPIAction( + extension, event_name + ".removeListener", args.get(), std::string()); } } @@ -384,7 +380,7 @@ bool EventRouter::HasEventListenerImpl(const ListenerMap& listener_map, } void EventRouter::BroadcastEvent(scoped_ptr<Event> event) { - DispatchEventImpl("", linked_ptr<Event>(event.release())); + DispatchEventImpl(std::string(), linked_ptr<Event>(event.release())); } void EventRouter::DispatchEventToExtension(const std::string& extension_id, diff --git a/chrome/browser/extensions/event_router_forwarder.cc b/chrome/browser/extensions/event_router_forwarder.cc index 15b7e97..f094608 100644 --- a/chrome/browser/extensions/event_router_forwarder.cc +++ b/chrome/browser/extensions/event_router_forwarder.cc @@ -26,7 +26,7 @@ void EventRouterForwarder::BroadcastEventToRenderers( const std::string& event_name, scoped_ptr<base::ListValue> event_args, const GURL& event_url) { - HandleEvent("", event_name, event_args.Pass(), 0, true, event_url); + HandleEvent(std::string(), event_name, event_args.Pass(), 0, true, event_url); } void EventRouterForwarder::DispatchEventToRenderers( @@ -37,8 +37,12 @@ void EventRouterForwarder::DispatchEventToRenderers( const GURL& event_url) { if (!profile) return; - HandleEvent("", event_name, event_args.Pass(), profile, - use_profile_to_restrict_events, event_url); + HandleEvent(std::string(), + event_name, + event_args.Pass(), + profile, + use_profile_to_restrict_events, + event_url); } void EventRouterForwarder::BroadcastEventToExtension( diff --git a/chrome/browser/extensions/extension_action_unittest.cc b/chrome/browser/extensions/extension_action_unittest.cc index 9a5c3ff..6c2ca63 100644 --- a/chrome/browser/extensions/extension_action_unittest.cc +++ b/chrome/browser/extensions/extension_action_unittest.cc @@ -15,7 +15,7 @@ using extensions::ActionInfo; TEST(ExtensionActionTest, Title) { ActionInfo action_info; action_info.default_title = "Initial Title"; - ExtensionAction action("", ActionInfo::TYPE_PAGE, action_info); + ExtensionAction action(std::string(), ActionInfo::TYPE_PAGE, action_info); ASSERT_EQ("Initial Title", action.GetTitle(1)); action.SetTitle(ExtensionAction::kDefaultTabId, "foo"); @@ -31,8 +31,7 @@ TEST(ExtensionActionTest, Title) { } TEST(ExtensionActionTest, Visibility) { - ExtensionAction action("", ActionInfo::TYPE_PAGE, - ActionInfo()); + ExtensionAction action(std::string(), ActionInfo::TYPE_PAGE, ActionInfo()); ASSERT_FALSE(action.GetIsVisible(1)); action.SetAppearance(ExtensionAction::kDefaultTabId, ExtensionAction::ACTIVE); @@ -53,8 +52,8 @@ TEST(ExtensionActionTest, Visibility) { ASSERT_FALSE(action.GetIsVisible(1)); ASSERT_FALSE(action.GetIsVisible(100)); - ExtensionAction browser_action("", ActionInfo::TYPE_BROWSER, - ActionInfo()); + ExtensionAction browser_action( + std::string(), ActionInfo::TYPE_BROWSER, ActionInfo()); ASSERT_TRUE(browser_action.GetIsVisible(1)); } @@ -62,8 +61,8 @@ TEST(ExtensionActionTest, ScriptBadgeAnimation) { // Supports the icon animation. MessageLoop message_loop; - ExtensionAction script_badge("", ActionInfo::TYPE_SCRIPT_BADGE, - ActionInfo()); + ExtensionAction script_badge( + std::string(), ActionInfo::TYPE_SCRIPT_BADGE, ActionInfo()); EXPECT_FALSE(script_badge.GetIconAnimation(ExtensionAction::kDefaultTabId)); script_badge.SetAppearance(ExtensionAction::kDefaultTabId, ExtensionAction::ACTIVE); @@ -86,8 +85,8 @@ TEST(ExtensionActionTest, GetAttention) { // Supports the icon animation. scoped_ptr<MessageLoop> message_loop(new MessageLoop); - ExtensionAction script_badge("", ActionInfo::TYPE_SCRIPT_BADGE, - ActionInfo()); + ExtensionAction script_badge( + std::string(), ActionInfo::TYPE_SCRIPT_BADGE, ActionInfo()); EXPECT_FALSE(script_badge.GetIsVisible(1)); EXPECT_FALSE(script_badge.GetIconAnimation(1)); script_badge.SetAppearance(1, ExtensionAction::WANTS_ATTENTION); @@ -107,8 +106,8 @@ TEST(ExtensionActionTest, GetAttention) { TEST(ExtensionActionTest, Icon) { ActionInfo action_info; action_info.default_icon.Add(16, "icon16.png"); - ExtensionAction page_action("", ActionInfo::TYPE_PAGE, - action_info); + ExtensionAction page_action( + std::string(), ActionInfo::TYPE_PAGE, action_info); ASSERT_TRUE(page_action.default_icon()); EXPECT_EQ("icon16.png", page_action.default_icon()->Get( @@ -119,8 +118,7 @@ TEST(ExtensionActionTest, Icon) { } TEST(ExtensionActionTest, Badge) { - ExtensionAction action("", ActionInfo::TYPE_PAGE, - ActionInfo()); + ExtensionAction action(std::string(), ActionInfo::TYPE_PAGE, ActionInfo()); ASSERT_EQ("", action.GetBadgeText(1)); action.SetBadgeText(ExtensionAction::kDefaultTabId, "foo"); ASSERT_EQ("foo", action.GetBadgeText(1)); @@ -135,8 +133,7 @@ TEST(ExtensionActionTest, Badge) { } TEST(ExtensionActionTest, BadgeTextColor) { - ExtensionAction action("", ActionInfo::TYPE_PAGE, - ActionInfo()); + ExtensionAction action(std::string(), ActionInfo::TYPE_PAGE, ActionInfo()); ASSERT_EQ(0x00000000u, action.GetBadgeTextColor(1)); action.SetBadgeTextColor(ExtensionAction::kDefaultTabId, 0xFFFF0000u); ASSERT_EQ(0xFFFF0000u, action.GetBadgeTextColor(1)); @@ -151,8 +148,7 @@ TEST(ExtensionActionTest, BadgeTextColor) { } TEST(ExtensionActionTest, BadgeBackgroundColor) { - ExtensionAction action("", ActionInfo::TYPE_PAGE, - ActionInfo()); + ExtensionAction action(std::string(), ActionInfo::TYPE_PAGE, ActionInfo()); ASSERT_EQ(0x00000000u, action.GetBadgeBackgroundColor(1)); action.SetBadgeBackgroundColor(ExtensionAction::kDefaultTabId, 0xFFFF0000u); @@ -176,7 +172,7 @@ TEST(ExtensionActionTest, PopupUrl) { ActionInfo action_info; action_info.default_popup_url = url_foo; - ExtensionAction action("", ActionInfo::TYPE_PAGE, action_info); + ExtensionAction action(std::string(), ActionInfo::TYPE_PAGE, action_info); ASSERT_EQ(url_foo, action.GetPopupUrl(1)); ASSERT_EQ(url_foo, action.GetPopupUrl(100)); diff --git a/chrome/browser/extensions/extension_apitest.cc b/chrome/browser/extensions/extension_apitest.cc index e3534e4..8d072ae 100644 --- a/chrome/browser/extensions/extension_apitest.cc +++ b/chrome/browser/extensions/extension_apitest.cc @@ -80,7 +80,7 @@ void ExtensionApiTest::ResultCatcher::Observe( case chrome::NOTIFICATION_EXTENSION_TEST_PASSED: VLOG(1) << "Got EXTENSION_TEST_PASSED notification."; results_.push_back(true); - messages_.push_back(""); + messages_.push_back(std::string()); if (waiting_) MessageLoopForUI::current()->Quit(); break; @@ -114,41 +114,45 @@ void ExtensionApiTest::TearDownInProcessBrowserTestFixture() { } bool ExtensionApiTest::RunExtensionTest(const char* extension_name) { - return RunExtensionTestImpl(extension_name, "", kFlagEnableFileAccess); + return RunExtensionTestImpl( + extension_name, std::string(), kFlagEnableFileAccess); } bool ExtensionApiTest::RunExtensionTestIncognito(const char* extension_name) { - return RunExtensionTestImpl( - extension_name, "", kFlagEnableIncognito | kFlagEnableFileAccess); + return RunExtensionTestImpl(extension_name, + std::string(), + kFlagEnableIncognito | kFlagEnableFileAccess); } bool ExtensionApiTest::RunExtensionTestIgnoreManifestWarnings( const char* extension_name) { return RunExtensionTestImpl( - extension_name, "", kFlagIgnoreManifestWarnings); + extension_name, std::string(), kFlagIgnoreManifestWarnings); } bool ExtensionApiTest::RunExtensionTestAllowOldManifestVersion( const char* extension_name) { return RunExtensionTestImpl( extension_name, - "", + std::string(), kFlagEnableFileAccess | kFlagAllowOldManifestVersions); } bool ExtensionApiTest::RunComponentExtensionTest(const char* extension_name) { - return RunExtensionTestImpl( - extension_name, "", kFlagEnableFileAccess | kFlagLoadAsComponent); + return RunExtensionTestImpl(extension_name, + std::string(), + kFlagEnableFileAccess | kFlagLoadAsComponent); } bool ExtensionApiTest::RunExtensionTestNoFileAccess( const char* extension_name) { - return RunExtensionTestImpl(extension_name, "", kFlagNone); + return RunExtensionTestImpl(extension_name, std::string(), kFlagNone); } bool ExtensionApiTest::RunExtensionTestIncognitoNoFileAccess( const char* extension_name) { - return RunExtensionTestImpl(extension_name, "", kFlagEnableIncognito); + return RunExtensionTestImpl( + extension_name, std::string(), kFlagEnableIncognito); } bool ExtensionApiTest::RunExtensionSubtest(const char* extension_name, @@ -174,7 +178,8 @@ bool ExtensionApiTest::RunPageTest(const std::string& page_url, } bool ExtensionApiTest::RunPlatformAppTest(const char* extension_name) { - return RunExtensionTestImpl(extension_name, "", kFlagLaunchPlatformApp); + return RunExtensionTestImpl( + extension_name, std::string(), kFlagLaunchPlatformApp); } // Load |extension_name| extension and/or |page_url| and wait for diff --git a/chrome/browser/extensions/extension_browsertest.cc b/chrome/browser/extensions/extension_browsertest.cc index b051df9..cfad60e 100644 --- a/chrome/browser/extensions/extension_browsertest.cc +++ b/chrome/browser/extensions/extension_browsertest.cc @@ -337,9 +337,13 @@ class MockAutoConfirmExtensionInstallPrompt : public ExtensionInstallPrompt { const Extension* ExtensionBrowserTest::InstallExtensionFromWebstore( const base::FilePath& path, int expected_change) { - return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_NONE, - expected_change, Manifest::INTERNAL, - browser(), true); + return InstallOrUpdateExtension(std::string(), + path, + INSTALL_UI_TYPE_NONE, + expected_change, + Manifest::INTERNAL, + browser(), + true); } const Extension* ExtensionBrowserTest::InstallOrUpdateExtension( diff --git a/chrome/browser/extensions/extension_browsertest.h b/chrome/browser/extensions/extension_browsertest.h index 9d1203c..9d79f56 100644 --- a/chrome/browser/extensions/extension_browsertest.h +++ b/chrome/browser/extensions/extension_browsertest.h @@ -112,8 +112,8 @@ class ExtensionBrowserTest : virtual public InProcessBrowserTest, // you expect a failed upgrade. const extensions::Extension* InstallExtension(const base::FilePath& path, int expected_change) { - return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_NONE, - expected_change); + return InstallOrUpdateExtension( + std::string(), path, INSTALL_UI_TYPE_NONE, expected_change); } // Same as above, but an install source other than Manifest::INTERNAL can be @@ -122,8 +122,11 @@ class ExtensionBrowserTest : virtual public InProcessBrowserTest, const base::FilePath& path, int expected_change, extensions::Manifest::Location install_source) { - return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_NONE, - expected_change, install_source); + return InstallOrUpdateExtension(std::string(), + path, + INSTALL_UI_TYPE_NONE, + expected_change, + install_source); } // Installs extension as if it came from the Chrome Webstore. @@ -144,22 +147,27 @@ class ExtensionBrowserTest : virtual public InProcessBrowserTest, const extensions::Extension* InstallExtensionWithUI( const base::FilePath& path, int expected_change) { - return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_NORMAL, - expected_change); + return InstallOrUpdateExtension( + std::string(), path, INSTALL_UI_TYPE_NORMAL, expected_change); } const extensions::Extension* InstallExtensionWithUIAutoConfirm( const base::FilePath& path, int expected_change, Browser* browser) { - return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_AUTO_CONFIRM, - expected_change, browser, false); + return InstallOrUpdateExtension(std::string(), + path, + INSTALL_UI_TYPE_AUTO_CONFIRM, + expected_change, + browser, + false); } // Begins install process but simulates a user cancel. const extensions::Extension* StartInstallButCancel( const base::FilePath& path) { - return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_CANCEL, 0); + return InstallOrUpdateExtension( + std::string(), path, INSTALL_UI_TYPE_CANCEL, 0); } void ReloadExtension(const std::string& extension_id); diff --git a/chrome/browser/extensions/extension_function_dispatcher.cc b/chrome/browser/extensions/extension_function_dispatcher.cc index 00a1f39..c15ba6f 100644 --- a/chrome/browser/extensions/extension_function_dispatcher.cc +++ b/chrome/browser/extensions/extension_function_dispatcher.cc @@ -63,7 +63,7 @@ void LogSuccess(const Extension* extension, } else { extensions::ActivityLog* activity_log = extensions::ActivityLog::GetInstance(profile); - activity_log->LogAPIAction(extension, api_name, args.get(), ""); + activity_log->LogAPIAction(extension, api_name, args.get(), std::string()); } } @@ -86,11 +86,8 @@ void LogFailure(const Extension* extension, } else { extensions::ActivityLog* activity_log = extensions::ActivityLog::GetInstance(profile); - activity_log->LogBlockedAction(extension, - api_name, - args.get(), - reason, - ""); + activity_log->LogBlockedAction( + extension, api_name, args.get(), reason, std::string()); } } diff --git a/chrome/browser/extensions/extension_pref_value_map_unittest.cc b/chrome/browser/extensions/extension_pref_value_map_unittest.cc index bfa573f..7f1b2d5 100644 --- a/chrome/browser/extensions/extension_pref_value_map_unittest.cc +++ b/chrome/browser/extensions/extension_pref_value_map_unittest.cc @@ -45,7 +45,7 @@ class ExtensionPrefValueMapTestBase : public BASECLASS { // Returns an empty string if the key is not set. std::string GetValue(const char * key, bool incognito) const { const Value *value = epvm_.GetEffectivePrefValue(key, incognito, NULL); - std::string string_value = ""; + std::string string_value; if (value) value->GetAsString(&string_value); return string_value; diff --git a/chrome/browser/extensions/extension_prefs.cc b/chrome/browser/extensions/extension_prefs.cc index 0f1d743..b24e0e7 100644 --- a/chrome/browser/extensions/extension_prefs.cc +++ b/chrome/browser/extensions/extension_prefs.cc @@ -1670,7 +1670,8 @@ void ExtensionPrefs::SetDelayedInstallInfo( if (extension->RequiresSortOrdinal()) { extension_dict->SetString( kPrefSuggestedPageOrdinal, - page_ordinal.IsValid() ? page_ordinal.ToInternalValue() : ""); + page_ordinal.IsValid() ? page_ordinal.ToInternalValue() + : std::string()); } UpdateExtensionPref(extension->id(), kDelayedInstallInfo, extension_dict); diff --git a/chrome/browser/extensions/extension_process_manager.cc b/chrome/browser/extensions/extension_process_manager.cc index a4cb67f..09fc245 100644 --- a/chrome/browser/extensions/extension_process_manager.cc +++ b/chrome/browser/extensions/extension_process_manager.cc @@ -63,7 +63,7 @@ std::string GetExtensionID(RenderViewHost* render_view_host) { // This works for both apps and extensions because the site has been // normalized to the extension URL for apps. if (!render_view_host->GetSiteInstance()) - return ""; + return std::string(); return render_view_host->GetSiteInstance()->GetSiteURL().host(); } diff --git a/chrome/browser/extensions/extension_protocols.cc b/chrome/browser/extensions/extension_protocols.cc index 049d813..503b2ad 100644 --- a/chrome/browser/extensions/extension_protocols.cc +++ b/chrome/browser/extensions/extension_protocols.cc @@ -320,7 +320,8 @@ bool AllowExtensionResourceLoad(net::URLRequest* request, // some extensions want to be able to do things like create their own // launchers. std::string resource_root_relative_path = - request->url().path().empty() ? "" : request->url().path().substr(1); + request->url().path().empty() ? std::string() + : request->url().path().substr(1); if (extension->is_hosted_app() && !extensions::IconsInfo::GetIcons(extension) .ContainsPath(resource_root_relative_path)) { diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc index a6068b5..368d048 100644 --- a/chrome/browser/extensions/extension_service_unittest.cc +++ b/chrome/browser/extensions/extension_service_unittest.cc @@ -1192,7 +1192,7 @@ TEST_F(ExtensionServiceTest, LoadAllExtensionsFromDirectorySuccess) { EXPECT_EQ(std::string(good1), loaded_[1]->id()); EXPECT_EQ(std::string("My extension 2"), loaded_[1]->name()); - EXPECT_EQ(std::string(""), loaded_[1]->description()); + EXPECT_EQ(std::string(), loaded_[1]->description()); EXPECT_EQ(loaded_[1]->GetResourceURL("background.html"), extensions::BackgroundInfo::GetBackgroundURL(loaded_[1])); EXPECT_EQ( @@ -1220,7 +1220,7 @@ TEST_F(ExtensionServiceTest, LoadAllExtensionsFromDirectorySuccess) { int index = expected_num_extensions - 1; EXPECT_EQ(std::string(good2), loaded_[index]->id()); EXPECT_EQ(std::string("My extension 3"), loaded_[index]->name()); - EXPECT_EQ(std::string(""), loaded_[index]->description()); + EXPECT_EQ(std::string(), loaded_[index]->description()); EXPECT_EQ( 0u, extensions::ContentScriptsInfo::GetContentScripts(loaded_[index]).size()); @@ -3313,8 +3313,8 @@ TEST_F(ExtensionServiceTest, ManagementPolicyProhibitsLoadFromPrefs) { // UNPACKED is for extensions loaded from a directory. We use it here, even // though we're testing loading from prefs, so that we don't need to provide // an extension key. - extensions::ExtensionInfo extension_info(&manifest, "", path, - Manifest::UNPACKED); + extensions::ExtensionInfo extension_info( + &manifest, std::string(), path, Manifest::UNPACKED); // Ensure we can load it with no management policy in place. management_policy_->UnregisterAllProviders(); diff --git a/chrome/browser/extensions/extension_test_message_listener.cc b/chrome/browser/extensions/extension_test_message_listener.cc index 90aa01a..e892ba1 100644 --- a/chrome/browser/extensions/extension_test_message_listener.cc +++ b/chrome/browser/extensions/extension_test_message_listener.cc @@ -17,7 +17,6 @@ ExtensionTestMessageListener::ExtensionTestMessageListener( satisfied_(false), waiting_(false), will_reply_(will_reply), - failure_message_(""), failed_(false) { registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_TEST_MESSAGE, content::NotificationService::AllSources()); @@ -59,7 +58,7 @@ void ExtensionTestMessageListener::Observe( satisfied_ = true; registrar_.RemoveAll(); // Stop listening for more messages. if (!will_reply_) { - function_->Reply(""); + function_->Reply(std::string()); function_ = NULL; } if (waiting_) { diff --git a/chrome/browser/extensions/extensions_quota_service.cc b/chrome/browser/extensions/extensions_quota_service.cc index c01b9e3..6b267a5 100644 --- a/chrome/browser/extensions/extensions_quota_service.cc +++ b/chrome/browser/extensions/extensions_quota_service.cc @@ -42,7 +42,7 @@ std::string ExtensionsQuotaService::Assess( DCHECK(CalledOnValidThread()); if (function->ShouldSkipQuotaLimiting()) - return ""; + return std::string(); // Lookup function list for extension. FunctionHeuristicsMap& functions = function_heuristics_[extension_id]; @@ -53,7 +53,7 @@ std::string ExtensionsQuotaService::Assess( function->GetQuotaLimitHeuristics(&heuristics); if (heuristics.empty()) - return ""; // No heuristic implies no limit. + return std::string(); // No heuristic implies no limit. ViolationErrorMap::iterator violation_error = violation_errors_.find(extension_id); @@ -71,7 +71,7 @@ std::string ExtensionsQuotaService::Assess( } if (!failed_heuristic) - return ""; + return std::string(); std::string error = failed_heuristic->GetError(); DCHECK_GT(error.length(), 0u); diff --git a/chrome/browser/extensions/external_policy_loader_unittest.cc b/chrome/browser/extensions/external_policy_loader_unittest.cc index 5f8943c..75bd788 100644 --- a/chrome/browser/extensions/external_policy_loader_unittest.cc +++ b/chrome/browser/extensions/external_policy_loader_unittest.cc @@ -139,7 +139,8 @@ TEST_F(ExternalPolicyLoaderTest, InvalidEntriesIgnored) { // Add invalid entries. forced_extensions.SetString("invalid", "http://www.example.com/crx"); - forced_extensions.SetString("dddddddddddddddddddddddddddddddd", ""); + forced_extensions.SetString("dddddddddddddddddddddddddddddddd", + std::string()); forced_extensions.SetString("invalid", "bad"); MockExternalPolicyProviderVisitor mv; diff --git a/chrome/browser/extensions/isolated_app_browsertest.cc b/chrome/browser/extensions/isolated_app_browsertest.cc index b7717bb..ec55a4c 100644 --- a/chrome/browser/extensions/isolated_app_browsertest.cc +++ b/chrome/browser/extensions/isolated_app_browsertest.cc @@ -328,7 +328,7 @@ IN_PROC_BROWSER_TEST_F(IsolatedAppTest, MAYBE_SubresourceCookieIsolation) { // The app under test acts on URLs whose host is "localhost", // so the URLs we navigate to must have host "localhost". - GURL root_url = test_server()->GetURL(""); + GURL root_url = test_server()->GetURL(std::string()); GURL base_url = test_server()->GetURL("files/extensions/isolated_apps/"); GURL::Replacements replace_host; std::string host_str("localhost"); // Must stay in scope with replace_host. diff --git a/chrome/browser/extensions/menu_manager.cc b/chrome/browser/extensions/menu_manager.cc index 0335866..4256c61 100644 --- a/chrome/browser/extensions/menu_manager.cc +++ b/chrome/browser/extensions/menu_manager.cc @@ -833,14 +833,10 @@ void MenuManager::RemoveAllIncognitoContextItems() { RemoveContextMenuItem(*remove_iter); } -MenuItem::Id::Id() - : incognito(false), extension_id(""), uid(0), string_uid("") { -} +MenuItem::Id::Id() : incognito(false), uid(0) {} MenuItem::Id::Id(bool incognito, const std::string& extension_id) - : incognito(incognito), extension_id(extension_id), uid(0), - string_uid("") { -} + : incognito(incognito), extension_id(extension_id), uid(0) {} MenuItem::Id::~Id() { } diff --git a/chrome/browser/extensions/pending_extension_info.cc b/chrome/browser/extensions/pending_extension_info.cc index 6fc0adc..a1e93d8 100644 --- a/chrome/browser/extensions/pending_extension_info.cc +++ b/chrome/browser/extensions/pending_extension_info.cc @@ -25,8 +25,7 @@ PendingExtensionInfo::PendingExtensionInfo( install_source_(install_source) {} PendingExtensionInfo::PendingExtensionInfo() - : id_(""), - update_url_(), + : update_url_(), should_allow_install_(NULL), is_from_sync_(true), install_silently_(false), diff --git a/chrome/browser/extensions/platform_app_browsertest_util.cc b/chrome/browser/extensions/platform_app_browsertest_util.cc index 62f8545..58c2548 100644 --- a/chrome/browser/extensions/platform_app_browsertest_util.cc +++ b/chrome/browser/extensions/platform_app_browsertest_util.cc @@ -142,13 +142,13 @@ ShellWindow* PlatformAppBrowserTest::CreateShellWindow( const Extension* extension) { ShellWindow::CreateParams params; return ShellWindow::Create( - browser()->profile(), extension, GURL(""), params); + browser()->profile(), extension, GURL(std::string()), params); } ShellWindow* PlatformAppBrowserTest::CreateShellWindowFromParams( const Extension* extension, const ShellWindow::CreateParams& params) { return ShellWindow::Create( - browser()->profile(), extension, GURL(""), params); + browser()->profile(), extension, GURL(std::string()), params); } void PlatformAppBrowserTest::CloseShellWindow(ShellWindow* window) { diff --git a/chrome/browser/extensions/platform_app_launcher.cc b/chrome/browser/extensions/platform_app_launcher.cc index a883e66..46daa89 100644 --- a/chrome/browser/extensions/platform_app_launcher.cc +++ b/chrome/browser/extensions/platform_app_launcher.cc @@ -107,10 +107,7 @@ class PlatformAppPathLauncher PlatformAppPathLauncher(Profile* profile, const Extension* extension, const base::FilePath& file_path) - : profile_(profile), - extension_(extension), - file_path_(file_path), - handler_id_("") {} + : profile_(profile), extension_(extension), file_path_(file_path) {} void Launch() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); diff --git a/chrome/browser/extensions/script_badge_controller_unittest.cc b/chrome/browser/extensions/script_badge_controller_unittest.cc index d2cf6bc..cb773f8 100644 --- a/chrome/browser/extensions/script_badge_controller_unittest.cc +++ b/chrome/browser/extensions/script_badge_controller_unittest.cc @@ -138,7 +138,7 @@ TEST_F(ScriptBadgeControllerTest, ExecutionMakesBadgeVisible) { web_contents(), id_map, web_contents()->GetController().GetActiveEntry()->GetPageID(), - GURL("")); + GURL(std::string())); EXPECT_THAT(script_badge_controller_->GetCurrentActions(), testing::ElementsAre(GetScriptBadge(*extension))); EXPECT_THAT(location_bar_updated.events, testing::Gt(0)); @@ -167,7 +167,7 @@ TEST_F(ScriptBadgeControllerTest, FragmentNavigation) { web_contents(), id_map, web_contents()->GetController().GetActiveEntry()->GetPageID(), - GURL("")); + GURL(std::string())); EXPECT_THAT(script_badge_controller_->GetCurrentActions(), testing::ElementsAre(GetScriptBadge(*extension))); diff --git a/chrome/browser/extensions/script_executor.cc b/chrome/browser/extensions/script_executor.cc index c5ed09f..b35b776 100644 --- a/chrome/browser/extensions/script_executor.cc +++ b/chrome/browser/extensions/script_executor.cc @@ -66,7 +66,7 @@ class Handler : public content::WebContentsObserver { virtual void WebContentsDestroyed(content::WebContents* tab) OVERRIDE { base::ListValue val; - callback_.Run(kRendererDestroyed, -1, GURL(""), val); + callback_.Run(kRendererDestroyed, -1, GURL(std::string()), val); delete this; } diff --git a/chrome/browser/extensions/subscribe_page_action_browsertest.cc b/chrome/browser/extensions/subscribe_page_action_browsertest.cc index 471ad5c..02449a1 100644 --- a/chrome/browser/extensions/subscribe_page_action_browsertest.cc +++ b/chrome/browser/extensions/subscribe_page_action_browsertest.cc @@ -114,10 +114,8 @@ void NavigateToFeedAndValidate(net::TestServer* server, GetFeedUrl(server, url, true, extension_id)); WebContents* tab = browser->tab_strip_model()->GetActiveWebContents(); - ASSERT_TRUE(ValidatePageElement(tab, - "", - kScriptFeedTitle, - expected_feed_title)); + ASSERT_TRUE(ValidatePageElement( + tab, std::string(), kScriptFeedTitle, expected_feed_title)); ASSERT_TRUE(ValidatePageElement(tab, "//html/body/div/iframe[1]", kScriptAnchor, diff --git a/chrome/browser/extensions/tab_helper.cc b/chrome/browser/extensions/tab_helper.cc index cdcec02..cd420ad 100644 --- a/chrome/browser/extensions/tab_helper.cc +++ b/chrome/browser/extensions/tab_helper.cc @@ -413,7 +413,7 @@ void TabHelper::OnInlineInstallComplete(int install_id, const std::string& error) { if (success) { Send(new ExtensionMsg_InlineWebstoreInstallResponse( - return_route_id, install_id, true, "")); + return_route_id, install_id, true, std::string())); } else { Send(new ExtensionMsg_InlineWebstoreInstallResponse( return_route_id, install_id, false, error)); diff --git a/chrome/browser/extensions/updater/extension_downloader.cc b/chrome/browser/extensions/updater/extension_downloader.cc index 0c04a89..f165732 100644 --- a/chrome/browser/extensions/updater/extension_downloader.cc +++ b/chrome/browser/extensions/updater/extension_downloader.cc @@ -153,12 +153,7 @@ UpdateDetails::UpdateDetails(const std::string& id, const Version& version) UpdateDetails::~UpdateDetails() {} - -ExtensionDownloader::ExtensionFetch::ExtensionFetch() - : id(""), - url(), - package_hash(""), - version("") {} +ExtensionDownloader::ExtensionFetch::ExtensionFetch() : url() {} ExtensionDownloader::ExtensionFetch::ExtensionFetch( const std::string& id, @@ -220,7 +215,11 @@ bool ExtensionDownloader::AddPendingExtension(const std::string& id, Version version("0.0.0.0"); DCHECK(version.IsValid()); - return AddExtensionData(id, version, Manifest::TYPE_UNKNOWN, update_url, "", + return AddExtensionData(id, + version, + Manifest::TYPE_UNKNOWN, + update_url, + std::string(), request_id); } @@ -249,7 +248,10 @@ void ExtensionDownloader::StartBlacklistUpdate( new ManifestFetchData(extension_urls::GetWebstoreUpdateUrl(), request_id)); DCHECK(blacklist_fetch->base_url().SchemeIsSecure()); - blacklist_fetch->AddExtension(kBlacklistAppID, version, &ping_data, "", + blacklist_fetch->AddExtension(kBlacklistAppID, + version, + &ping_data, + std::string(), kDefaultInstallSource); StartUpdateCheck(blacklist_fetch.Pass()); } diff --git a/chrome/browser/extensions/updater/extension_updater.cc b/chrome/browser/extensions/updater/extension_updater.cc index feadf5a..130da8f 100644 --- a/chrome/browser/extensions/updater/extension_updater.cc +++ b/chrome/browser/extensions/updater/extension_updater.cc @@ -106,10 +106,7 @@ ExtensionUpdater::FetchedCRXFile::FetchedCRXFile( download_url(u), request_ids(request_ids) {} -ExtensionUpdater::FetchedCRXFile::FetchedCRXFile() - : extension_id(""), - path(), - download_url() {} +ExtensionUpdater::FetchedCRXFile::FetchedCRXFile() : path(), download_url() {} ExtensionUpdater::FetchedCRXFile::~FetchedCRXFile() {} diff --git a/chrome/browser/extensions/updater/extension_updater_unittest.cc b/chrome/browser/extensions/updater/extension_updater_unittest.cc index 4921d9e..3481c0c 100644 --- a/chrome/browser/extensions/updater/extension_updater_unittest.cc +++ b/chrome/browser/extensions/updater/extension_updater_unittest.cc @@ -432,7 +432,7 @@ static void ExtractParameters(const std::string& params, if (!key_val.empty()) { std::string key = key_val[0]; EXPECT_TRUE(result->find(key) == result->end()); - (*result)[key] = (key_val.size() == 2) ? key_val[1] : ""; + (*result)[key] = (key_val.size() == 2) ? key_val[1] : std::string(); } else { NOTREACHED(); } @@ -637,7 +637,8 @@ class ExtensionUpdaterTest : public testing::Test { // Make sure that an empty update URL data string does not cause a ap= // option to appear in the x= parameter. ManifestFetchData fetch_data(GURL("http://localhost/foo"), 0); - fetch_data.AddExtension(id, version, &kNeverPingedData, "", ""); + fetch_data.AddExtension( + id, version, &kNeverPingedData, std::string(), std::string()); std::map<std::string, std::string> params; VerifyQueryAndExtractParameters(fetch_data.full_url().query(), ¶ms); @@ -653,7 +654,8 @@ class ExtensionUpdaterTest : public testing::Test { // Make sure that an update URL data string causes an appropriate ap= // option to appear in the x= parameter. ManifestFetchData fetch_data(GURL("http://localhost/foo"), 0); - fetch_data.AddExtension(id, version, &kNeverPingedData, "bar", ""); + fetch_data.AddExtension( + id, version, &kNeverPingedData, "bar", std::string()); std::map<std::string, std::string> params; VerifyQueryAndExtractParameters(fetch_data.full_url().query(), ¶ms); EXPECT_EQ(id, params["id"]); @@ -668,7 +670,8 @@ class ExtensionUpdaterTest : public testing::Test { // Make sure that an update URL data string causes an appropriate ap= // option to appear in the x= parameter. ManifestFetchData fetch_data(GURL("http://localhost/foo"), 0); - fetch_data.AddExtension(id, version, &kNeverPingedData, "a=1&b=2&c", ""); + fetch_data.AddExtension( + id, version, &kNeverPingedData, "a=1&b=2&c", std::string()); std::map<std::string, std::string> params; VerifyQueryAndExtractParameters(fetch_data.full_url().query(), ¶ms); EXPECT_EQ(id, params["id"]); @@ -738,14 +741,12 @@ class ExtensionUpdaterTest : public testing::Test { // installed and available at v2.0). const std::string id1 = id_util::GenerateId("1"); const std::string id2 = id_util::GenerateId("2"); - fetch_data.AddExtension(id1, "1.0.0.0", - &kNeverPingedData, kEmptyUpdateUrlData, ""); - AddParseResult(id1, "1.1", - "http://localhost/e1_1.1.crx", &updates); - fetch_data.AddExtension(id2, "2.0.0.0", - &kNeverPingedData, kEmptyUpdateUrlData, ""); - AddParseResult(id2, "2.0.0.0", - "http://localhost/e2_2.0.crx", &updates); + fetch_data.AddExtension( + id1, "1.0.0.0", &kNeverPingedData, kEmptyUpdateUrlData, std::string()); + AddParseResult(id1, "1.1", "http://localhost/e1_1.1.crx", &updates); + fetch_data.AddExtension( + id2, "2.0.0.0", &kNeverPingedData, kEmptyUpdateUrlData, std::string()); + AddParseResult(id2, "2.0.0.0", "http://localhost/e2_2.0.crx", &updates); EXPECT_CALL(delegate, IsExtensionPending(_)).WillRepeatedly(Return(false)); EXPECT_CALL(delegate, GetExtensionExistingVersion(id1, _)) @@ -782,8 +783,11 @@ class ExtensionUpdaterTest : public testing::Test { std::list<std::string>::const_iterator it; for (it = ids_for_update_check.begin(); it != ids_for_update_check.end(); ++it) { - fetch_data.AddExtension(*it, "1.0.0.0", - &kNeverPingedData, kEmptyUpdateUrlData, ""); + fetch_data.AddExtension(*it, + "1.0.0.0", + &kNeverPingedData, + kEmptyUpdateUrlData, + std::string()); AddParseResult(*it, "1.1", "http://localhost/e1_1.1.crx", &updates); } @@ -816,10 +820,14 @@ class ExtensionUpdaterTest : public testing::Test { scoped_ptr<ManifestFetchData> fetch3(new ManifestFetchData(kUpdateUrl, 0)); scoped_ptr<ManifestFetchData> fetch4(new ManifestFetchData(kUpdateUrl, 0)); ManifestFetchData::PingData zeroDays(0, 0, true); - fetch1->AddExtension("1111", "1.0", &zeroDays, kEmptyUpdateUrlData, ""); - fetch2->AddExtension("2222", "2.0", &zeroDays, kEmptyUpdateUrlData, ""); - fetch3->AddExtension("3333", "3.0", &zeroDays, kEmptyUpdateUrlData, ""); - fetch4->AddExtension("4444", "4.0", &zeroDays, kEmptyUpdateUrlData, ""); + fetch1->AddExtension( + "1111", "1.0", &zeroDays, kEmptyUpdateUrlData, std::string()); + fetch2->AddExtension( + "2222", "2.0", &zeroDays, kEmptyUpdateUrlData, std::string()); + fetch3->AddExtension( + "3333", "3.0", &zeroDays, kEmptyUpdateUrlData, std::string()); + fetch4->AddExtension( + "4444", "4.0", &zeroDays, kEmptyUpdateUrlData, std::string()); // This will start the first fetcher and queue the others. The next in queue // is started as each fetcher receives its response. @@ -927,7 +935,8 @@ class ExtensionUpdaterTest : public testing::Test { scoped_ptr<ManifestFetchData> fetch(new ManifestFetchData(kUpdateUrl, 0)); ManifestFetchData::PingData zeroDays(0, 0, true); - fetch->AddExtension("1111", "1.0", &zeroDays, kEmptyUpdateUrlData, ""); + fetch->AddExtension( + "1111", "1.0", &zeroDays, kEmptyUpdateUrlData, std::string()); // This will start the first fetcher. downloader.StartUpdateCheck(fetch.Pass()); @@ -954,7 +963,8 @@ class ExtensionUpdaterTest : public testing::Test { // For response codes that are not in the 5xx range ExtensionDownloader // should not retry. fetch.reset(new ManifestFetchData(kUpdateUrl, 0)); - fetch->AddExtension("1111", "1.0", &zeroDays, kEmptyUpdateUrlData, ""); + fetch->AddExtension( + "1111", "1.0", &zeroDays, kEmptyUpdateUrlData, std::string()); // This will start the first fetcher. downloader.StartUpdateCheck(fetch.Pass()); @@ -1006,7 +1016,7 @@ class ExtensionUpdaterTest : public testing::Test { GURL test_url("http://localhost/extension.crx"); std::string id = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; - std::string hash = ""; + std::string hash; Version version("0.0.1"); std::set<int> requests; requests.insert(0); @@ -1142,8 +1152,8 @@ class ExtensionUpdaterTest : public testing::Test { std::string id1 = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; std::string id2 = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"; - std::string hash1 = ""; - std::string hash2 = ""; + std::string hash1; + std::string hash2; std::string version1 = "0.1"; std::string version2 = "0.1"; @@ -1357,7 +1367,7 @@ class ExtensionUpdaterTest : public testing::Test { fetcher->set_url(fetched_urls[0]); fetcher->set_status(net::URLRequestStatus()); fetcher->set_response_code(500); - fetcher->SetResponseString(""); + fetcher->SetResponseString(std::string()); fetcher->delegate()->OnURLFetchComplete(fetcher); fetcher = factory.GetFetcherByID(ExtensionDownloader::kManifestFetcherId); @@ -1442,8 +1452,11 @@ class ExtensionUpdaterTest : public testing::Test { ManifestFetchData fetch_data(update_url, 0); const Extension* extension = tmp[0]; - fetch_data.AddExtension(extension->id(), extension->VersionString(), - &kNeverPingedData, kEmptyUpdateUrlData, ""); + fetch_data.AddExtension(extension->id(), + extension->VersionString(), + &kNeverPingedData, + kEmptyUpdateUrlData, + std::string()); UpdateManifest::Results results; results.daystart_elapsed_seconds = 750; @@ -1647,7 +1660,7 @@ TEST_F(ExtensionUpdaterTest, TestManifestFetchesBuilderAddExtension) { EXPECT_EQ(1u, ManifestFetchersCount(downloader.get())); // Extensions with empty IDs should be rejected. - EXPECT_FALSE(downloader->AddPendingExtension("", GURL(), 0)); + EXPECT_FALSE(downloader->AddPendingExtension(std::string(), GURL(), 0)); downloader->StartAllPending(); EXPECT_EQ(1u, ManifestFetchersCount(downloader.get())); diff --git a/chrome/browser/extensions/webstore_installer.cc b/chrome/browser/extensions/webstore_installer.cc index 81db7ed..f5f4d68 100644 --- a/chrome/browser/extensions/webstore_installer.cc +++ b/chrome/browser/extensions/webstore_installer.cc @@ -125,7 +125,8 @@ void GetDownloadFilePath( base::FilePath file = directory.AppendASCII(id + "_" + random_number + ".crx"); - int uniquifier = file_util::GetUniquePathNumber(file, FILE_PATH_LITERAL("")); + int uniquifier = + file_util::GetUniquePathNumber(file, FILE_PATH_LITERAL(std::string())); if (uniquifier > 0) { file = file.InsertBeforeExtensionASCII( base::StringPrintf(" (%d)", uniquifier)); diff --git a/chrome/browser/extensions/webstore_standalone_installer.cc b/chrome/browser/extensions/webstore_standalone_installer.cc index cadce50..7df550f 100644 --- a/chrome/browser/extensions/webstore_standalone_installer.cc +++ b/chrome/browser/extensions/webstore_standalone_installer.cc @@ -80,7 +80,7 @@ void WebstoreStandaloneInstaller::OnWebstoreRequestFailure() { void WebstoreStandaloneInstaller::OnWebstoreResponseParseSuccess( DictionaryValue* webstore_data) { if (!CheckRequestorAlive()) { - CompleteInstall(""); + CompleteInstall(std::string()); return; } @@ -141,13 +141,13 @@ void WebstoreStandaloneInstaller::OnWebstoreResponseParseSuccess( // Assume ownership of webstore_data. webstore_data_.reset(webstore_data); - scoped_refptr<WebstoreInstallHelper> helper = new WebstoreInstallHelper( - this, - id_, - manifest, - "", // We don't have any icon data. - icon_url, - profile_->GetRequestContext()); + scoped_refptr<WebstoreInstallHelper> helper = + new WebstoreInstallHelper(this, + id_, + manifest, + std::string(), // We don't have any icon data. + icon_url, + profile_->GetRequestContext()); // The helper will call us back via OnWebstoreParseSucces or // OnWebstoreParseFailure. helper->Start(); @@ -165,7 +165,7 @@ void WebstoreStandaloneInstaller::OnWebstoreParseSuccess( CHECK_EQ(id_, id); if (!CheckRequestorAlive()) { - CompleteInstall(""); + CompleteInstall(std::string()); return; } @@ -190,7 +190,7 @@ void WebstoreStandaloneInstaller::OnWebstoreParseFailure( void WebstoreStandaloneInstaller::InstallUIProceed() { if (!CheckRequestorAlive()) { - CompleteInstall(""); + CompleteInstall(std::string()); return; } @@ -219,7 +219,7 @@ void WebstoreStandaloneInstaller::InstallUIAbort(bool user_initiated) { void WebstoreStandaloneInstaller::OnExtensionInstallSuccess( const std::string& id) { CHECK_EQ(id_, id); - CompleteInstall(""); + CompleteInstall(std::string()); } void WebstoreStandaloneInstaller::OnExtensionInstallFailure( diff --git a/chrome/browser/feedback/feedback_util.cc b/chrome/browser/feedback/feedback_util.cc index 7133c60..f892a87 100644 --- a/chrome/browser/feedback/feedback_util.cc +++ b/chrome/browser/feedback/feedback_util.cc @@ -283,7 +283,7 @@ void FeedbackUtil::SendReport(scoped_refptr<FeedbackData> data) { // CHROMEOS_RELEASE_VERSION from /etc/lsb-release #if !defined(OS_CHROMEOS) // Add OS version (eg, for WinXP SP2: "5.1.2600 Service Pack 2"). - std::string os_version = ""; + std::string os_version; SetOSVersion(&os_version); AddFeedbackData(&feedback_data, std::string(kOsVersionTag), os_version); #endif diff --git a/chrome/browser/file_select_helper.cc b/chrome/browser/file_select_helper.cc index 15e4a05..3d07ff2 100644 --- a/chrome/browser/file_select_helper.cc +++ b/chrome/browser/file_select_helper.cc @@ -423,9 +423,10 @@ void FileSelectHelper::RunFileChooserOnUIThread( params.title, default_file_name, select_file_types_.get(), - select_file_types_.get() && !select_file_types_->extensions.empty() ? - 1 : 0, // 1-based index of default extension to show. - FILE_PATH_LITERAL(""), + select_file_types_.get() && !select_file_types_->extensions.empty() + ? 1 + : 0, // 1-based index of default extension to show. + FILE_PATH_LITERAL(std::string()), owning_window, #if defined(OS_ANDROID) &accept_types); diff --git a/chrome/browser/google/google_util.cc b/chrome/browser/google/google_util.cc index d66a585..50900bd 100644 --- a/chrome/browser/google/google_util.cc +++ b/chrome/browser/google/google_util.cc @@ -32,7 +32,7 @@ #endif #ifndef LINKDOCTOR_SERVER_REQUEST_URL -#define LINKDOCTOR_SERVER_REQUEST_URL "" +#define LINKDOCTOR_SERVER_REQUEST_URL std::string() #endif namespace { diff --git a/chrome/browser/google/google_util_unittest.cc b/chrome/browser/google/google_util_unittest.cc index cf4c610..75b7067 100644 --- a/chrome/browser/google/google_util_unittest.cc +++ b/chrome/browser/google/google_util_unittest.cc @@ -53,7 +53,7 @@ TEST(GoogleUtilTest, GoodHomePagesSecure) { } TEST(GoogleUtilTest, BadHomePages) { - EXPECT_FALSE(IsGoogleHomePageUrl("")); + EXPECT_FALSE(IsGoogleHomePageUrl(std::string())); // If specified, only the "www" subdomain is OK. EXPECT_FALSE(IsGoogleHomePageUrl("http://maps.google.com")); @@ -237,7 +237,7 @@ TEST(GoogleUtilTest, BadSearches) { "http://www.google.com/search/nogood?q=something")); EXPECT_FALSE(IsGoogleSearchUrl( "http://www.google.com/webhp/nogood#q=something")); - EXPECT_FALSE(IsGoogleSearchUrl("")); + EXPECT_FALSE(IsGoogleSearchUrl(std::string())); // Case sensitive paths. EXPECT_FALSE(IsGoogleSearchUrl( diff --git a/chrome/browser/google_apis/base_operations.cc b/chrome/browser/google_apis/base_operations.cc index c6f425c..6692a8a 100644 --- a/chrome/browser/google_apis/base_operations.cc +++ b/chrome/browser/google_apis/base_operations.cc @@ -186,7 +186,7 @@ void UrlFetchOperationBase::Start(const std::string& access_token, request_type == URLFetcher::PATCH) { // Set empty upload content-type and upload content, so that // the request will have no "Content-type: " header and no content. - url_fetcher_->SetUploadData("", ""); + url_fetcher_->SetUploadData(std::string(), std::string()); } } diff --git a/chrome/browser/google_apis/base_operations_unittest.cc b/chrome/browser/google_apis/base_operations_unittest.cc index 2f7e01a..047e5c2 100644 --- a/chrome/browser/google_apis/base_operations_unittest.cc +++ b/chrome/browser/google_apis/base_operations_unittest.cc @@ -66,9 +66,9 @@ class BaseOperationsTest : public testing::Test { virtual void SetUp() OVERRIDE { profile_.reset(new TestingProfile); runner_.reset(new OperationRunner(profile_.get(), - NULL /* url_request_context_getter */, - std::vector<std::string>() /* scopes */, - "" /* custom user agent */)); + NULL /* url_request_context_getter */, + std::vector<std::string>() /* scopes */, + std::string() /* custom user agent */)); runner_->Initialize(); LOG(ERROR) << "Initialized."; } diff --git a/chrome/browser/google_apis/drive_api_operations.cc b/chrome/browser/google_apis/drive_api_operations.cc index 7bab455..1206743 100644 --- a/chrome/browser/google_apis/drive_api_operations.cc +++ b/chrome/browser/google_apis/drive_api_operations.cc @@ -200,7 +200,7 @@ GURL CreateDirectoryOperation::GetURL() const { if (parent_resource_id_.empty() || directory_name_.empty()) { return GURL(); } - return url_generator_.GetFilelistUrl(GURL(), ""); + return url_generator_.GetFilelistUrl(GURL(), std::string()); } net::URLFetcher::RequestType CreateDirectoryOperation::GetRequestType() const { diff --git a/chrome/browser/google_apis/drive_api_operations_unittest.cc b/chrome/browser/google_apis/drive_api_operations_unittest.cc index 36c2c89..b6a0f61 100644 --- a/chrome/browser/google_apis/drive_api_operations_unittest.cc +++ b/chrome/browser/google_apis/drive_api_operations_unittest.cc @@ -867,7 +867,7 @@ TEST_F(DriveApiOperationsTest, UploadExistingFileOperation) { kTestContentType, kTestContent.size(), "resource_id", // The resource id of the file to be overwritten. - "", // No etag. + std::string(), // No etag. CreateComposedCallback( base::Bind(&test_util::RunAndQuit), test_util::CreateCopyResultCallback(&error, &upload_url))); diff --git a/chrome/browser/google_apis/drive_api_url_generator_unittest.cc b/chrome/browser/google_apis/drive_api_url_generator_unittest.cc index 818fb2d..bcb6c6d 100644 --- a/chrome/browser/google_apis/drive_api_url_generator_unittest.cc +++ b/chrome/browser/google_apis/drive_api_url_generator_unittest.cc @@ -69,7 +69,7 @@ TEST_F(DriveApiUrlGeneratorTest, GetFilelistUrl) { // Use default URL, if |override_url| is empty. // Do not add q parameter if |search_string| is empty. EXPECT_EQ("https://www.googleapis.com/drive/v2/files", - url_generator_.GetFilelistUrl(GURL(), "").spec()); + url_generator_.GetFilelistUrl(GURL(), std::string()).spec()); // Set q parameter if non-empty |search_string| is given. EXPECT_EQ("https://www.googleapis.com/drive/v2/files?q=query", @@ -77,9 +77,10 @@ TEST_F(DriveApiUrlGeneratorTest, GetFilelistUrl) { // Use the |override_url| for the base URL if given. // The behavior for the |search_string| should be as same as above cases. - EXPECT_EQ("https://localhost/drive/v2/files", - url_generator_.GetFilelistUrl( - GURL("https://localhost/drive/v2/files"), "").spec()); + EXPECT_EQ( + "https://localhost/drive/v2/files", + url_generator_.GetFilelistUrl(GURL("https://localhost/drive/v2/files"), + std::string()).spec()); EXPECT_EQ("https://localhost/drive/v2/files?q=query", url_generator_.GetFilelistUrl( GURL("https://localhost/drive/v2/files"), "query").spec()); diff --git a/chrome/browser/google_apis/drive_uploader_unittest.cc b/chrome/browser/google_apis/drive_uploader_unittest.cc index 5f3bb62..f522a87 100644 --- a/chrome/browser/google_apis/drive_uploader_unittest.cc +++ b/chrome/browser/google_apis/drive_uploader_unittest.cc @@ -298,7 +298,7 @@ TEST_F(DriveUploaderTest, UploadExisting0KB) { base::FilePath::FromUTF8Unsafe(kTestDrivePath), local_path, kTestMimeType, - "", // etag + std::string(), // etag test_util::CreateCopyResultCallback( &error, &drive_path, &file_path, &resource_entry)); test_util::RunBlockingPoolTask(); @@ -330,7 +330,7 @@ TEST_F(DriveUploaderTest, UploadExisting512KB) { base::FilePath::FromUTF8Unsafe(kTestDrivePath), local_path, kTestMimeType, - "", // etag + std::string(), // etag test_util::CreateCopyResultCallback( &error, &drive_path, &file_path, &resource_entry)); test_util::RunBlockingPoolTask(); @@ -363,7 +363,7 @@ TEST_F(DriveUploaderTest, UploadExisting1234KB) { base::FilePath::FromUTF8Unsafe(kTestDrivePath), local_path, kTestMimeType, - "", // etag + std::string(), // etag test_util::CreateCopyResultCallback( &error, &drive_path, &file_path, &resource_entry)); test_util::RunBlockingPoolTask(); @@ -429,7 +429,7 @@ TEST_F(DriveUploaderTest, InitiateUploadFail) { base::FilePath::FromUTF8Unsafe(kTestDrivePath), local_path, kTestMimeType, - "", // etag + std::string(), // etag test_util::CreateCopyResultCallback( &error, &drive_path, &file_path, &resource_entry)); test_util::RunBlockingPoolTask(); @@ -508,7 +508,7 @@ TEST_F(DriveUploaderTest, ResumeUploadFail) { base::FilePath::FromUTF8Unsafe(kTestDrivePath), local_path, kTestMimeType, - "", // etag + std::string(), // etag test_util::CreateCopyResultCallback( &error, &drive_path, &file_path, &resource_entry)); test_util::RunBlockingPoolTask(); @@ -528,7 +528,7 @@ TEST_F(DriveUploaderTest, NonExistingSourceFile) { base::FilePath::FromUTF8Unsafe(kTestDrivePath), temp_dir_.path().AppendASCII("_this_path_should_not_exist_"), kTestMimeType, - "", // etag + std::string(), // etag test_util::CreateCopyResultCallback( &error, &drive_path, &file_path, &resource_entry)); test_util::RunBlockingPoolTask(); diff --git a/chrome/browser/google_apis/fake_drive_service.cc b/chrome/browser/google_apis/fake_drive_service.cc index d91aced..d5cb4ad 100644 --- a/chrome/browser/google_apis/fake_drive_service.cc +++ b/chrome/browser/google_apis/fake_drive_service.cc @@ -340,10 +340,10 @@ void FakeDriveService::GetAllResourceList( DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); - GetResourceList(GURL(), // no next feed - 0, // start changestamp - "", // empty search query - "", // no directory resource id, + GetResourceList(GURL(), // no next feed + 0, // start changestamp + std::string(), // empty search query + std::string(), // no directory resource id, callback); } @@ -354,9 +354,9 @@ void FakeDriveService::GetResourceListInDirectory( DCHECK(!directory_resource_id.empty()); DCHECK(!callback.is_null()); - GetResourceList(GURL(), // no next feed - 0, // start changestamp - "", // empty search query + GetResourceList(GURL(), // no next feed + 0, // start changestamp + std::string(), // empty search query directory_resource_id, callback); } @@ -367,10 +367,10 @@ void FakeDriveService::Search(const std::string& search_query, DCHECK(!search_query.empty()); DCHECK(!callback.is_null()); - GetResourceList(GURL(), // no next feed - 0, // start changestamp + GetResourceList(GURL(), // no next feed + 0, // start changestamp search_query, - "", // no directory resource id, + std::string(), // no directory resource id, callback); } @@ -395,10 +395,10 @@ void FakeDriveService::GetChangeList(int64 start_changestamp, DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); - GetResourceList(GURL(), // no next feed + GetResourceList(GURL(), // no next feed start_changestamp, - "", // empty search query - "", // no directory resource id, + std::string(), // empty search query + std::string(), // no directory resource id, callback); } diff --git a/chrome/browser/google_apis/fake_drive_service_unittest.cc b/chrome/browser/google_apis/fake_drive_service_unittest.cc index e89ed15..2f94ba5 100644 --- a/chrome/browser/google_apis/fake_drive_service_unittest.cc +++ b/chrome/browser/google_apis/fake_drive_service_unittest.cc @@ -96,9 +96,9 @@ TEST_F(FakeDriveServiceTest, GetResourceList_All) { scoped_ptr<ResourceList> resource_list; fake_service_.GetResourceList( GURL(), - 0, // start_changestamp - "", // search_query - "", // directory_resource_id + 0, // start_changestamp + std::string(), // search_query + std::string(), // directory_resource_id test_util::CreateCopyResultCallback(&error, &resource_list)); message_loop_.RunUntilIdle(); @@ -117,9 +117,9 @@ TEST_F(FakeDriveServiceTest, GetResourceList_WithStartIndex) { scoped_ptr<ResourceList> resource_list; fake_service_.GetResourceList( GURL("http://dummyurl/?start-offset=2"), - 0, // start_changestamp - "", // search_query - "", // directory_resource_id + 0, // start_changestamp + std::string(), // search_query + std::string(), // directory_resource_id test_util::CreateCopyResultCallback(&error, &resource_list)); message_loop_.RunUntilIdle(); @@ -139,9 +139,9 @@ TEST_F(FakeDriveServiceTest, GetResourceList_WithStartIndexAndMaxResults) { scoped_ptr<ResourceList> resource_list; fake_service_.GetResourceList( GURL("http://localhost/?start-offset=2&max-results=5"), - 0, // start_changestamp - "", // search_query - "", // directory_resource_id + 0, // start_changestamp + std::string(), // search_query + std::string(), // directory_resource_id test_util::CreateCopyResultCallback(&error, &resource_list)); message_loop_.RunUntilIdle(); @@ -168,9 +168,9 @@ TEST_F(FakeDriveServiceTest, GetResourceList_WithDefaultMaxResultsChanged) { scoped_ptr<ResourceList> resource_list; fake_service_.GetResourceList( GURL(), - 0, // start_changestamp - "", // search_query - "", // directory_resource_id + 0, // start_changestamp + std::string(), // search_query + std::string(), // directory_resource_id test_util::CreateCopyResultCallback(&error, &resource_list)); message_loop_.RunUntilIdle(); @@ -196,8 +196,8 @@ TEST_F(FakeDriveServiceTest, GetResourceList_InRootDirectory) { scoped_ptr<ResourceList> resource_list; fake_service_.GetResourceList( GURL(), - 0, // start_changestamp - "", // search_query + 0, // start_changestamp + std::string(), // search_query fake_service_.GetRootResourceId(), // directory_resource_id test_util::CreateCopyResultCallback(&error, &resource_list)); message_loop_.RunUntilIdle(); @@ -217,9 +217,9 @@ TEST_F(FakeDriveServiceTest, GetResourceList_Search) { scoped_ptr<ResourceList> resource_list; fake_service_.GetResourceList( GURL(), - 0, // start_changestamp - "File", // search_query - "", // directory_resource_id + 0, // start_changestamp + "File", // search_query + std::string(), // directory_resource_id test_util::CreateCopyResultCallback(&error, &resource_list)); message_loop_.RunUntilIdle(); @@ -239,9 +239,9 @@ TEST_F(FakeDriveServiceTest, GetResourceList_SearchWithAttribute) { scoped_ptr<ResourceList> resource_list; fake_service_.GetResourceList( GURL(), - 0, // start_changestamp + 0, // start_changestamp "title:1.txt", // search_query - "", // directory_resource_id + std::string(), // directory_resource_id test_util::CreateCopyResultCallback(&error, &resource_list)); message_loop_.RunUntilIdle(); @@ -261,9 +261,9 @@ TEST_F(FakeDriveServiceTest, GetResourceList_SearchMultipleQueries) { scoped_ptr<ResourceList> resource_list; fake_service_.GetResourceList( GURL(), - 0, // start_changestamp + 0, // start_changestamp "Directory 1", // search_query - "", // directory_resource_id + std::string(), // directory_resource_id test_util::CreateCopyResultCallback(&error, &resource_list)); message_loop_.RunUntilIdle(); @@ -274,9 +274,9 @@ TEST_F(FakeDriveServiceTest, GetResourceList_SearchMultipleQueries) { fake_service_.GetResourceList( GURL(), - 0, // start_changestamp + 0, // start_changestamp "\"Directory 1\"", // search_query - "", // directory_resource_id + std::string(), // directory_resource_id test_util::CreateCopyResultCallback(&error, &resource_list)); message_loop_.RunUntilIdle(); @@ -299,9 +299,9 @@ TEST_F(FakeDriveServiceTest, GetResourceList_NoNewEntries) { scoped_ptr<ResourceList> resource_list; fake_service_.GetResourceList( GURL(), - 654321 + 1, // start_changestamp - "", // search_query - "", // directory_resource_id + 654321 + 1, // start_changestamp + std::string(), // search_query + std::string(), // directory_resource_id test_util::CreateCopyResultCallback(&error, &resource_list)); message_loop_.RunUntilIdle(); @@ -331,9 +331,9 @@ TEST_F(FakeDriveServiceTest, GetResourceList_WithNewEntry) { scoped_ptr<ResourceList> resource_list; fake_service_.GetResourceList( GURL(), - 654321 + 1, // start_changestamp - "", // search_query - "", // directory_resource_id + 654321 + 1, // start_changestamp + std::string(), // search_query + std::string(), // directory_resource_id test_util::CreateCopyResultCallback(&error, &resource_list)); message_loop_.RunUntilIdle(); @@ -354,9 +354,9 @@ TEST_F(FakeDriveServiceTest, GetResourceList_Offline) { scoped_ptr<ResourceList> resource_list; fake_service_.GetResourceList( GURL(), - 0, // start_changestamp - "", // search_query - "", // directory_resource_id + 0, // start_changestamp + std::string(), // search_query + std::string(), // directory_resource_id test_util::CreateCopyResultCallback(&error, &resource_list)); message_loop_.RunUntilIdle(); @@ -845,7 +845,7 @@ TEST_F(FakeDriveServiceTest, DeleteResource_ExistingFile) { GDataErrorCode error = GDATA_OTHER_ERROR; fake_service_.DeleteResource("file:2_file_resource_id", - "", // etag + std::string(), // etag test_util::CreateCopyResultCallback(&error)); message_loop_.RunUntilIdle(); @@ -860,7 +860,7 @@ TEST_F(FakeDriveServiceTest, DeleteResource_NonexistingFile) { GDataErrorCode error = GDATA_OTHER_ERROR; fake_service_.DeleteResource("file:nonexisting_resource_id", - "", // etag + std::string(), // etag test_util::CreateCopyResultCallback(&error)); message_loop_.RunUntilIdle(); @@ -874,7 +874,7 @@ TEST_F(FakeDriveServiceTest, DeleteResource_Offline) { GDataErrorCode error = GDATA_OTHER_ERROR; fake_service_.DeleteResource("file:2_file_resource_id", - "", // etag + std::string(), // etag test_util::CreateCopyResultCallback(&error)); message_loop_.RunUntilIdle(); @@ -1506,7 +1506,7 @@ TEST_F(FakeDriveServiceTest, InitiateUploadExistingFile_Offline) { "test/foo", 13, "file:2_file_resource_id", - "", // etag + std::string(), // etag test_util::CreateCopyResultCallback(&error, &upload_location)); message_loop_.RunUntilIdle(); @@ -1525,7 +1525,7 @@ TEST_F(FakeDriveServiceTest, InitiateUploadExistingFile_NotFound) { "test/foo", 13, "non_existent", - "", // etag + std::string(), // etag test_util::CreateCopyResultCallback(&error, &upload_location)); message_loop_.RunUntilIdle(); diff --git a/chrome/browser/google_apis/gdata_wapi_operations_unittest.cc b/chrome/browser/google_apis/gdata_wapi_operations_unittest.cc index 1a15c62..7f2395d 100644 --- a/chrome/browser/google_apis/gdata_wapi_operations_unittest.cc +++ b/chrome/browser/google_apis/gdata_wapi_operations_unittest.cc @@ -325,10 +325,10 @@ TEST_F(GDataWapiOperationsTest, GetResourceListOperation_DefaultFeed) { &operation_registry_, request_context_getter_.get(), *url_generator_, - GURL(), // Pass an empty URL to use the default feed - 0, // start changestamp - "", // search string - "", // directory resource ID + GURL(), // Pass an empty URL to use the default feed + 0, // start changestamp + std::string(), // search string + std::string(), // directory resource ID CreateComposedCallback( base::Bind(&test_util::RunAndQuit), test_util::CreateCopyResultCallback(&result_code, &result_data))); @@ -360,9 +360,9 @@ TEST_F(GDataWapiOperationsTest, GetResourceListOperation_ValidFeed) { request_context_getter_.get(), *url_generator_, test_server_.GetURL("/files/chromeos/gdata/root_feed.json"), - 0, // start changestamp - "", // search string - "", // directory resource ID + 0, // start changestamp + std::string(), // search string + std::string(), // directory resource ID CreateComposedCallback( base::Bind(&test_util::RunAndQuit), test_util::CreateCopyResultCallback(&result_code, &result_data))); @@ -395,9 +395,9 @@ TEST_F(GDataWapiOperationsTest, GetResourceListOperation_InvalidFeed) { request_context_getter_.get(), *url_generator_, test_server_.GetURL("/files/chromeos/gdata/testfile.txt"), - 0, // start changestamp - "", // search string - "", // directory resource ID + 0, // start changestamp + std::string(), // search string + std::string(), // directory resource ID CreateComposedCallback( base::Bind(&test_util::RunAndQuit), test_util::CreateCopyResultCallback(&result_code, &result_data))); @@ -548,11 +548,10 @@ TEST_F(GDataWapiOperationsTest, DeleteResourceOperation) { &operation_registry_, request_context_getter_.get(), *url_generator_, - CreateComposedCallback( - base::Bind(&test_util::RunAndQuit), - test_util::CreateCopyResultCallback(&result_code)), + CreateComposedCallback(base::Bind(&test_util::RunAndQuit), + test_util::CreateCopyResultCallback(&result_code)), "file:2_file_resource_id", - ""); + std::string()); operation->Start(kTestGDataAuthToken, kTestUserAgent, base::Bind(&test_util::DoNothingForReAuthenticateCallback)); @@ -1135,7 +1134,7 @@ TEST_F(GDataWapiOperationsTest, UploadNewLargeFile) { // The test is almost identical to UploadNewFile. The only difference is the // expectation for the Content-Range header. TEST_F(GDataWapiOperationsTest, UploadNewEmptyFile) { - const std::string kUploadContent = ""; + const std::string kUploadContent; GDataErrorCode result_code = GDATA_OTHER_ERROR; GURL upload_url; @@ -1244,7 +1243,7 @@ TEST_F(GDataWapiOperationsTest, UploadExistingFile) { "text/plain", kUploadContent.size(), "file:foo", - "" /* etag */); + std::string() /* etag */); initiate_operation->Start( kTestGDataAuthToken, kTestUserAgent, diff --git a/chrome/browser/google_apis/gdata_wapi_parser_unittest.cc b/chrome/browser/google_apis/gdata_wapi_parser_unittest.cc index f85d325..d4fbba4 100644 --- a/chrome/browser/google_apis/gdata_wapi_parser_unittest.cc +++ b/chrome/browser/google_apis/gdata_wapi_parser_unittest.cc @@ -324,7 +324,7 @@ TEST(GDataWAPIParserTest, ResourceEntryHasDocumentExtension) { EXPECT_FALSE(ResourceEntry::HasHostedDocumentExtension( base::FilePath(FILE_PATH_LITERAL("Test")))); EXPECT_FALSE(ResourceEntry::HasHostedDocumentExtension( - base::FilePath(FILE_PATH_LITERAL("")))); + base::FilePath(FILE_PATH_LITERAL(std::string())))); } TEST(GDataWAPIParserTest, ResourceEntryClassifyEntryKind) { diff --git a/chrome/browser/google_apis/gdata_wapi_service.cc b/chrome/browser/google_apis/gdata_wapi_service.cc index 47edcf6..2649049 100644 --- a/chrome/browser/google_apis/gdata_wapi_service.cc +++ b/chrome/browser/google_apis/gdata_wapi_service.cc @@ -199,15 +199,14 @@ void GDataWapiService::GetAllResourceList( DCHECK(!callback.is_null()); runner_->StartOperationWithRetry( - new GetResourceListOperation( - operation_registry(), - url_request_context_getter_, - url_generator_, - GURL(), // No override url - 0, // start changestamp - "", // empty search query - "", // no directory resource id - callback)); + new GetResourceListOperation(operation_registry(), + url_request_context_getter_, + url_generator_, + GURL(), // No override url + 0, // start changestamp + std::string(), // empty search query + std::string(), // no directory resource id + callback)); } void GDataWapiService::GetResourceListInDirectory( @@ -218,15 +217,14 @@ void GDataWapiService::GetResourceListInDirectory( DCHECK(!callback.is_null()); runner_->StartOperationWithRetry( - new GetResourceListOperation( - operation_registry(), - url_request_context_getter_, - url_generator_, - GURL(), // No override url - 0, // start changestamp - "", // empty search query - directory_resource_id, - callback)); + new GetResourceListOperation(operation_registry(), + url_request_context_getter_, + url_generator_, + GURL(), // No override url + 0, // start changestamp + std::string(), // empty search query + directory_resource_id, + callback)); } void GDataWapiService::Search(const std::string& search_query, @@ -236,15 +234,14 @@ void GDataWapiService::Search(const std::string& search_query, DCHECK(!callback.is_null()); runner_->StartOperationWithRetry( - new GetResourceListOperation( - operation_registry(), - url_request_context_getter_, - url_generator_, - GURL(), // No override url - 0, // start changestamp - search_query, - "", // no directory resource id - callback)); + new GetResourceListOperation(operation_registry(), + url_request_context_getter_, + url_generator_, + GURL(), // No override url + 0, // start changestamp + search_query, + std::string(), // no directory resource id + callback)); } void GDataWapiService::SearchInDirectory( @@ -274,15 +271,14 @@ void GDataWapiService::GetChangeList(int64 start_changestamp, DCHECK(!callback.is_null()); runner_->StartOperationWithRetry( - new GetResourceListOperation( - operation_registry(), - url_request_context_getter_, - url_generator_, - GURL(), // No override url - start_changestamp, - "", // empty search query - "", // no directory resource id - callback)); + new GetResourceListOperation(operation_registry(), + url_request_context_getter_, + url_generator_, + GURL(), // No override url + start_changestamp, + std::string(), // empty search query + std::string(), // no directory resource id + callback)); } void GDataWapiService::ContinueGetResourceList( @@ -293,15 +289,14 @@ void GDataWapiService::ContinueGetResourceList( DCHECK(!callback.is_null()); runner_->StartOperationWithRetry( - new GetResourceListOperation( - operation_registry(), - url_request_context_getter_, - url_generator_, - override_url, - 0, // start changestamp - "", // empty search query - "", // no directory resource id - callback)); + new GetResourceListOperation(operation_registry(), + url_request_context_getter_, + url_generator_, + override_url, + 0, // start changestamp + std::string(), // empty search query + std::string(), // no directory resource id + callback)); } void GDataWapiService::GetResourceEntry( diff --git a/chrome/browser/google_apis/gdata_wapi_url_generator_unittest.cc b/chrome/browser/google_apis/gdata_wapi_url_generator_unittest.cc index 571a661..de80699 100644 --- a/chrome/browser/google_apis/gdata_wapi_url_generator_unittest.cc +++ b/chrome/browser/google_apis/gdata_wapi_url_generator_unittest.cc @@ -32,29 +32,29 @@ TEST_F(GDataWapiUrlGeneratorTest, AddInitiateUploadUrlParams) { } TEST_F(GDataWapiUrlGeneratorTest, AddFeedUrlParams) { - EXPECT_EQ("http://www.example.com/?v=3&alt=json&showroot=true&" - "showfolders=true" - "&include-shared=true" - "&max-results=100" - "&include-installed-apps=true", - GDataWapiUrlGenerator::AddFeedUrlParams( - GURL("http://www.example.com"), - 100, // num_items_to_fetch - 0, // changestamp - "" // search_string - ).spec()); - EXPECT_EQ("http://www.example.com/?v=3&alt=json&showroot=true&" - "showfolders=true" - "&include-shared=true" - "&max-results=100" - "&include-installed-apps=true" - "&start-index=123", - GDataWapiUrlGenerator::AddFeedUrlParams( - GURL("http://www.example.com"), - 100, // num_items_to_fetch - 123, // changestamp - "" // search_string - ).spec()); + EXPECT_EQ( + "http://www.example.com/?v=3&alt=json&showroot=true&" + "showfolders=true" + "&include-shared=true" + "&max-results=100" + "&include-installed-apps=true", + GDataWapiUrlGenerator::AddFeedUrlParams(GURL("http://www.example.com"), + 100, // num_items_to_fetch + 0, // changestamp + std::string() // search_string + ).spec()); + EXPECT_EQ( + "http://www.example.com/?v=3&alt=json&showroot=true&" + "showfolders=true" + "&include-shared=true" + "&max-results=100" + "&include-installed-apps=true" + "&start-index=123", + GDataWapiUrlGenerator::AddFeedUrlParams(GURL("http://www.example.com"), + 100, // num_items_to_fetch + 123, // changestamp + std::string() // search_string + ).spec()); EXPECT_EQ("http://www.example.com/?v=3&alt=json&showroot=true&" "showfolders=true" "&include-shared=true" @@ -72,53 +72,52 @@ TEST_F(GDataWapiUrlGeneratorTest, AddFeedUrlParams) { TEST_F(GDataWapiUrlGeneratorTest, GenerateResourceListUrl) { // This is the very basic URL for the GetResourceList operation. - EXPECT_EQ( - "https://docs.google.com/feeds/default/private/full" - "?v=3&alt=json&showroot=true&showfolders=true&include-shared=true" - "&max-results=500&include-installed-apps=true", - url_generator_.GenerateResourceListUrl(GURL(), // override_url, - 0, // start_changestamp, - "", // search_string, - "" // directory resource ID - ).spec()); + EXPECT_EQ("https://docs.google.com/feeds/default/private/full" + "?v=3&alt=json&showroot=true&showfolders=true&include-shared=true" + "&max-results=500&include-installed-apps=true", + url_generator_.GenerateResourceListUrl( + GURL(), // override_url, + 0, // start_changestamp, + std::string(), // search_string, + std::string() // directory resource ID + ).spec()); // With an override URL provided, the base URL is changed, but the default // parameters remain as-is. - EXPECT_EQ( - "http://localhost/" - "?v=3&alt=json&showroot=true&showfolders=true&include-shared=true" - "&max-results=500&include-installed-apps=true", - url_generator_.GenerateResourceListUrl( - GURL("http://localhost/"), // override_url, - 0, // start_changestamp, - "", // search_string, - "" // directory resource ID - ).spec()); + EXPECT_EQ("http://localhost/" + "?v=3&alt=json&showroot=true&showfolders=true&include-shared=true" + "&max-results=500&include-installed-apps=true", + url_generator_.GenerateResourceListUrl( + GURL("http://localhost/"), // override_url, + 0, // start_changestamp, + std::string(), // search_string, + std::string() // directory resource ID + ).spec()); // With a non-zero start_changestamp provided, the base URL is changed from // "full" to "changes", and "start-index" parameter is added. - EXPECT_EQ( - "https://docs.google.com/feeds/default/private/changes" - "?v=3&alt=json&showroot=true&showfolders=true&include-shared=true" - "&max-results=500&include-installed-apps=true" - "&start-index=100", - url_generator_.GenerateResourceListUrl(GURL(), // override_url, - 100, // start_changestamp, - "", // search_string, - "" // directory resource ID - ).spec()); + EXPECT_EQ("https://docs.google.com/feeds/default/private/changes" + "?v=3&alt=json&showroot=true&showfolders=true&include-shared=true" + "&max-results=500&include-installed-apps=true" + "&start-index=100", + url_generator_.GenerateResourceListUrl( + GURL(), // override_url, + 100, // start_changestamp, + std::string(), // search_string, + std::string() // directory resource ID + ).spec()); // With a non-empty search string provided, "max-results" value is changed, // and "q" parameter is added. - EXPECT_EQ( - "https://docs.google.com/feeds/default/private/full" - "?v=3&alt=json&showroot=true&showfolders=true&include-shared=true" - "&max-results=50&include-installed-apps=true&q=foo", - url_generator_.GenerateResourceListUrl(GURL(), // override_url, - 0, // start_changestamp, - "foo", // search_string, - "" // directory resource ID - ).spec()); + EXPECT_EQ("https://docs.google.com/feeds/default/private/full" + "?v=3&alt=json&showroot=true&showfolders=true&include-shared=true" + "&max-results=50&include-installed-apps=true&q=foo", + url_generator_.GenerateResourceListUrl( + GURL(), // override_url, + 0, // start_changestamp, + "foo", // search_string, + std::string() // directory resource ID + ).spec()); // With a non-empty directory resource ID provided, the base URL is // changed, but the default parameters remain. @@ -127,24 +126,23 @@ TEST_F(GDataWapiUrlGeneratorTest, GenerateResourceListUrl) { "?v=3&alt=json&showroot=true&showfolders=true&include-shared=true" "&max-results=500&include-installed-apps=true", url_generator_.GenerateResourceListUrl(GURL(), // override_url, - 0, // start_changestamp, - "", // search_string, + 0, // start_changestamp, + std::string(), // search_string, "XXX" // directory resource ID ).spec()); // With a non-empty override_url provided, the base URL is changed, but // the default parameters remain. Note that start-index should not be // overridden. - EXPECT_EQ( - "http://example.com/" - "?start-index=123&v=3&alt=json&showroot=true&showfolders=true" - "&include-shared=true&max-results=500&include-installed-apps=true", - url_generator_.GenerateResourceListUrl( - GURL("http://example.com/?start-index=123"), // override_url, - 100, // start_changestamp, - "", // search_string, - "XXX" // directory resource ID - ).spec()); + EXPECT_EQ("http://example.com/" + "?start-index=123&v=3&alt=json&showroot=true&showfolders=true" + "&include-shared=true&max-results=500&include-installed-apps=true", + url_generator_.GenerateResourceListUrl( + GURL("http://example.com/?start-index=123"), // override_url, + 100, // start_changestamp, + std::string(), // search_string, + "XXX" // directory resource ID + ).spec()); } TEST_F(GDataWapiUrlGeneratorTest, GenerateEditUrl) { diff --git a/chrome/browser/google_apis/operation_util_unittest.cc b/chrome/browser/google_apis/operation_util_unittest.cc index 8a8ffe4..14e4c5dd 100644 --- a/chrome/browser/google_apis/operation_util_unittest.cc +++ b/chrome/browser/google_apis/operation_util_unittest.cc @@ -11,7 +11,7 @@ namespace util { TEST(GenerateIfMatchHeaderTest, GenerateIfMatchHeader) { // The header matched to all etag should be returned for empty etag. - EXPECT_EQ("If-Match: *", GenerateIfMatchHeader("")); + EXPECT_EQ("If-Match: *", GenerateIfMatchHeader(std::string())); // Otherwise, the returned header should be matched to the given etag. EXPECT_EQ("If-Match: abcde", GenerateIfMatchHeader("abcde")); diff --git a/chrome/browser/google_apis/test_server/http_server_unittest.cc b/chrome/browser/google_apis/test_server/http_server_unittest.cc index e242098..d837baf 100644 --- a/chrome/browser/google_apis/test_server/http_server_unittest.cc +++ b/chrome/browser/google_apis/test_server/http_server_unittest.cc @@ -38,7 +38,7 @@ std::string GetContentTypeFromFetcher(const net::URLFetcher& fetcher) { if (headers->GetMimeType(&content_type)) return content_type; } - return ""; + return std::string(); } } // namespace diff --git a/chrome/browser/history/history_querying_unittest.cc b/chrome/browser/history/history_querying_unittest.cc index c1355dd..ed138e8 100644 --- a/chrome/browser/history/history_querying_unittest.cc +++ b/chrome/browser/history/history_querying_unittest.cc @@ -468,7 +468,7 @@ TEST_F(HistoryQueryTest, Paging) { // Since results are fetched 1 and 2 at a time, entry #0 and #6 will not // be de-duplicated. int expected_results[] = { 4, 2, 3, 1, 7, 6, 5, 0 }; - TestPaging("", expected_results, arraysize(expected_results)); + TestPaging(std::string(), expected_results, arraysize(expected_results)); } TEST_F(HistoryQueryTest, FTSPaging) { diff --git a/chrome/browser/history/history_tab_helper.cc b/chrome/browser/history/history_tab_helper.cc index a984557..5438b97 100644 --- a/chrome/browser/history/history_tab_helper.cc +++ b/chrome/browser/history/history_tab_helper.cc @@ -53,7 +53,8 @@ void HistoryTabHelper::UpdateHistoryForNavigation( void HistoryTabHelper::UpdateHistoryPageTitle(const NavigationEntry& entry) { HistoryService* hs = GetHistoryService(); if (hs) - hs->SetPageTitle(entry.GetVirtualURL(), entry.GetTitleForDisplay("")); + hs->SetPageTitle(entry.GetVirtualURL(), + entry.GetTitleForDisplay(std::string())); } history::HistoryAddPageArgs diff --git a/chrome/browser/history/history_unittest.cc b/chrome/browser/history/history_unittest.cc index e465a80..c988e55 100644 --- a/chrome/browser/history/history_unittest.cc +++ b/chrome/browser/history/history_unittest.cc @@ -164,20 +164,19 @@ class HistoryBackendDBTest : public HistoryUnitTestBase { std::vector<GURL> url_chain; url_chain.push_back(GURL("foo-url")); - DownloadRow download( - base::FilePath(FILE_PATH_LITERAL("foo-path")), - base::FilePath(FILE_PATH_LITERAL("foo-path")), - url_chain, - GURL(""), - time, - time, - 0, - 512, - state, - content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, - content::DOWNLOAD_INTERRUPT_REASON_NONE, - 0, - 0); + DownloadRow download(base::FilePath(FILE_PATH_LITERAL("foo-path")), + base::FilePath(FILE_PATH_LITERAL("foo-path")), + url_chain, + GURL(std::string()), + time, + time, + 0, + 512, + state, + content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, + content::DOWNLOAD_INTERRUPT_REASON_NONE, + 0, + 0); return db_->CreateDownload(download); } @@ -317,7 +316,7 @@ TEST_F(HistoryBackendDBTest, MigrateDownloadsReasonPathsAndDangerType) { int64 db_handle = 0; // Null path. s.BindInt64(0, ++db_handle); - s.BindString(1, ""); + s.BindString(1, std::string()); s.BindString(2, "http://whatever.com/index.html"); s.BindInt64(3, now.ToTimeT()); s.BindInt64(4, 100); @@ -464,20 +463,19 @@ TEST_F(HistoryBackendDBTest, DownloadNukeRecordsMissingURLs) { CreateBackendAndDatabase(); base::Time now(base::Time::Now()); std::vector<GURL> url_chain; - DownloadRow download( - base::FilePath(FILE_PATH_LITERAL("foo-path")), - base::FilePath(FILE_PATH_LITERAL("foo-path")), - url_chain, - GURL(""), - now, - now, - 0, - 512, - DownloadItem::COMPLETE, - content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, - content::DOWNLOAD_INTERRUPT_REASON_NONE, - 0, - 0); + DownloadRow download(base::FilePath(FILE_PATH_LITERAL("foo-path")), + base::FilePath(FILE_PATH_LITERAL("foo-path")), + url_chain, + GURL(std::string()), + now, + now, + 0, + 512, + DownloadItem::COMPLETE, + content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, + content::DOWNLOAD_INTERRUPT_REASON_NONE, + 0, + 0); // Creating records without any urls should fail. EXPECT_EQ(DownloadDatabase::kUninitializedHandle, diff --git a/chrome/browser/history/thumbnail_database_unittest.cc b/chrome/browser/history/thumbnail_database_unittest.cc index fc92feb..de3bd33 100644 --- a/chrome/browser/history/thumbnail_database_unittest.cc +++ b/chrome/browser/history/thumbnail_database_unittest.cc @@ -414,7 +414,7 @@ TEST_F(ThumbnailDatabaseTest, UpgradeToVersion6) { EXPECT_EQ(url, GURL(statement.ColumnString(1))); EXPECT_EQ(TOUCH_ICON, statement.ColumnInt(2)); // Any previous data in sizes should be cleared. - EXPECT_EQ(std::string(""), statement.ColumnString(3)); + EXPECT_EQ(std::string(), statement.ColumnString(3)); statement.Assign(db.db_.GetCachedStatement(SQL_FROM_HERE, "SELECT icon_id, last_updated, image_data, width, height " @@ -854,7 +854,7 @@ TEST_F(ThumbnailDatabaseTest, FaviconSizesToAndFromString) { // Valid input. FaviconSizes sizes_empty; - ThumbnailDatabase::DatabaseStringToFaviconSizes("", &sizes_empty); + ThumbnailDatabase::DatabaseStringToFaviconSizes(std::string(), &sizes_empty); EXPECT_EQ(0u, sizes_empty.size()); FaviconSizes sizes_valid; diff --git a/chrome/browser/importer/firefox_importer_utils.cc b/chrome/browser/importer/firefox_importer_utils.cc index 0535cf6..8ffe8f2 100644 --- a/chrome/browser/importer/firefox_importer_utils.cc +++ b/chrome/browser/importer/firefox_importer_utils.cc @@ -255,12 +255,12 @@ std::string ReadBrowserConfigProp(const base::FilePath& app_path, const std::string& pref_key) { std::string content; if (!ReadPrefFile(app_path.AppendASCII("browserconfig.properties"), &content)) - return ""; + return std::string(); // This file has the syntax: key=value. size_t prop_index = content.find(pref_key + "="); if (prop_index == std::string::npos) - return ""; + return std::string(); size_t start = prop_index + pref_key.length(); size_t stop = std::string::npos; @@ -270,7 +270,7 @@ std::string ReadBrowserConfigProp(const base::FilePath& app_path, if (start == std::string::npos || stop == std::string::npos || (start == stop)) { LOG(WARNING) << "Firefox property " << pref_key << " could not be parsed."; - return ""; + return std::string(); } return content.substr(start + 1, stop - start - 1); @@ -280,7 +280,7 @@ std::string ReadPrefsJsValue(const base::FilePath& profile_path, const std::string& pref_key) { std::string content; if (!ReadPrefFile(profile_path.AppendASCII("prefs.js"), &content)) - return ""; + return std::string(); return GetPrefsJsValue(content, pref_key); } @@ -411,7 +411,7 @@ std::string GetPrefsJsValue(const std::string& content, if (start == std::string::npos || stop == std::string::npos || stop < start) { LOG(WARNING) << "Firefox property " << pref_key << " could not be parsed."; - return ""; + return std::string(); } // String values have double quotes we don't need to return to the caller. diff --git a/chrome/browser/internal_auth_unittest.cc b/chrome/browser/internal_auth_unittest.cc index 42080cd..da8954e 100644 --- a/chrome/browser/internal_auth_unittest.cc +++ b/chrome/browser/internal_auth_unittest.cc @@ -69,9 +69,10 @@ TEST_F(InternalAuthTest, BadGeneration) { token, long_string_, map)); // Trying empty domain. - token = InternalAuthGeneration::GeneratePassport("", map); + token = InternalAuthGeneration::GeneratePassport(std::string(), map); ASSERT_TRUE(token.empty()); - ASSERT_FALSE(InternalAuthVerification::VerifyPassport(token, "", map)); + ASSERT_FALSE( + InternalAuthVerification::VerifyPassport(token, std::string(), map)); std::string dummy("abcdefghij"); for (size_t i = 1000; i--;) { @@ -87,7 +88,7 @@ TEST_F(InternalAuthTest, BadGeneration) { ASSERT_FALSE(InternalAuthVerification::VerifyPassport(token, "zapata", map)); map.clear(); - map[""] = "value"; + map[std::string()] = "value"; // Trying empty key. token = InternalAuthGeneration::GeneratePassport("zapata", map); ASSERT_TRUE(token.empty()); diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc index 76d5df7..b0c5010 100644 --- a/chrome/browser/io_thread.cc +++ b/chrome/browser/io_thread.cc @@ -691,8 +691,10 @@ void IOThread::EnableSpdy(const std::string& mode) { const std::string& element = *it; std::vector<std::string> name_value; base::SplitString(element, '=', &name_value); - const std::string& option = name_value.size() > 0 ? name_value[0] : ""; - const std::string value = name_value.size() > 1 ? name_value[1] : ""; + const std::string& option = + name_value.size() > 0 ? name_value[0] : std::string(); + const std::string value = + name_value.size() > 1 ? name_value[1] : std::string(); if (option == kOff) { net::HttpStreamFactory::set_spdy_enabled(false); @@ -739,10 +741,11 @@ void IOThread::RegisterPrefs(PrefRegistrySimple* registry) { "spdyproxy"); registry->RegisterBooleanPref(prefs::kDisableAuthNegotiateCnameLookup, false); registry->RegisterBooleanPref(prefs::kEnableAuthNegotiatePort, false); - registry->RegisterStringPref(prefs::kAuthServerWhitelist, ""); - registry->RegisterStringPref(prefs::kAuthNegotiateDelegateWhitelist, ""); - registry->RegisterStringPref(prefs::kGSSAPILibraryName, ""); - registry->RegisterStringPref(prefs::kSpdyProxyAuthOrigin, ""); + registry->RegisterStringPref(prefs::kAuthServerWhitelist, std::string()); + registry->RegisterStringPref(prefs::kAuthNegotiateDelegateWhitelist, + std::string()); + registry->RegisterStringPref(prefs::kGSSAPILibraryName, std::string()); + registry->RegisterStringPref(prefs::kSpdyProxyAuthOrigin, std::string()); registry->RegisterBooleanPref(prefs::kEnableReferrers, true); registry->RegisterInt64Pref(prefs::kHttpReceivedContentLength, 0); registry->RegisterInt64Pref(prefs::kHttpOriginalContentLength, 0); diff --git a/chrome/browser/language_usage_metrics_unittest.cc b/chrome/browser/language_usage_metrics_unittest.cc index db6e987..e007e70 100644 --- a/chrome/browser/language_usage_metrics_unittest.cc +++ b/chrome/browser/language_usage_metrics_unittest.cc @@ -16,7 +16,7 @@ TEST(LanguageUsageMetricsTest, ParseAcceptLanguages) { EXPECT_EQ(JAPANESE, *language_set.begin()); // Empty language. - LanguageUsageMetrics::ParseAcceptLanguages("", &language_set); + LanguageUsageMetrics::ParseAcceptLanguages(std::string(), &language_set); EXPECT_EQ(0U, language_set.size()); // Country code is ignored. @@ -86,6 +86,6 @@ TEST(LanguageUsageMetricsTest, ToLanguage) { EXPECT_EQ(JAPANESE, LanguageUsageMetrics::ToLanguage("ja-JP")); // Invalid locales are considered as unknown language. - EXPECT_EQ(UNKNOWN_LANGUAGE, LanguageUsageMetrics::ToLanguage("")); + EXPECT_EQ(UNKNOWN_LANGUAGE, LanguageUsageMetrics::ToLanguage(std::string())); EXPECT_EQ(UNKNOWN_LANGUAGE, LanguageUsageMetrics::ToLanguage("xx")); } diff --git a/chrome/browser/logging_chrome_browsertest.cc b/chrome/browser/logging_chrome_browsertest.cc index 9728fd3..df32456 100644 --- a/chrome/browser/logging_chrome_browsertest.cc +++ b/chrome/browser/logging_chrome_browsertest.cc @@ -44,7 +44,7 @@ class ChromeLoggingTest : public testing::Test { // Tests the log file name getter without an environment variable. TEST_F(ChromeLoggingTest, LogFileName) { - SaveEnvironmentVariable(""); + SaveEnvironmentVariable(std::string()); base::FilePath filename = logging::GetLogFileName(); ASSERT_NE(base::FilePath::StringType::npos, diff --git a/chrome/browser/managed_mode/managed_user_service.cc b/chrome/browser/managed_mode/managed_user_service.cc index 0cc29f5..80b2bc8 100644 --- a/chrome/browser/managed_mode/managed_user_service.cc +++ b/chrome/browser/managed_mode/managed_user_service.cc @@ -154,10 +154,10 @@ void ManagedUserService::RegisterUserPrefs(PrefRegistrySyncable* registry) { ManagedModeURLFilter::BLOCK, PrefRegistrySyncable::UNSYNCABLE_PREF); registry->RegisterStringPref(prefs::kManagedModeLocalPassphrase, - "", + std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); registry->RegisterStringPref(prefs::kManagedModeLocalSalt, - "", + std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); } @@ -203,7 +203,7 @@ bool ManagedUserService::UserMayLoad(const extensions::Extension* extension, string16* error) const { string16 tmp_error; // |extension| can be NULL in unit tests. - if (ExtensionManagementPolicyImpl(extension ? extension->id() : "", + if (ExtensionManagementPolicyImpl(extension ? extension->id() : std::string(), &tmp_error)) return true; @@ -244,7 +244,8 @@ bool ManagedUserService::UserMayModifySettings( const extensions::Extension* extension, string16* error) const { // |extension| can be NULL in unit tests. - return ExtensionManagementPolicyImpl(extension ? extension->id() : "", error); + return ExtensionManagementPolicyImpl( + extension ? extension->id() : std::string(), error); } void ManagedUserService::Observe(int type, diff --git a/chrome/browser/media/media_stream_devices_controller.cc b/chrome/browser/media/media_stream_devices_controller.cc index c83e74d..2d844a4 100644 --- a/chrome/browser/media/media_stream_devices_controller.cc +++ b/chrome/browser/media/media_stream_devices_controller.cc @@ -279,11 +279,11 @@ void MediaStreamDevicesController::HandleTabMediaRequest() { if (request_.audio_type == content::MEDIA_TAB_AUDIO_CAPTURE) { devices.push_back(content::MediaStreamDevice( - content::MEDIA_TAB_AUDIO_CAPTURE, "", "")); + content::MEDIA_TAB_AUDIO_CAPTURE, std::string(), std::string())); } if (request_.video_type == content::MEDIA_TAB_VIDEO_CAPTURE) { devices.push_back(content::MediaStreamDevice( - content::MEDIA_TAB_VIDEO_CAPTURE, "", "")); + content::MEDIA_TAB_VIDEO_CAPTURE, std::string(), std::string())); } callback_.Run(devices); diff --git a/chrome/browser/media_galleries/media_galleries_dialog_controller.cc b/chrome/browser/media_galleries/media_galleries_dialog_controller.cc index 98ba8da..27b8765 100644 --- a/chrome/browser/media_galleries/media_galleries_dialog_controller.cc +++ b/chrome/browser/media_galleries/media_galleries_dialog_controller.cc @@ -147,7 +147,7 @@ string16 MediaGalleriesDialogController::GetHeader() const { } string16 MediaGalleriesDialogController::GetSubtext() const { - std::string extension_name(extension_ ? extension_->name() : ""); + std::string extension_name(extension_ ? extension_->name() : std::string()); return l10n_util::GetStringFUTF16(IDS_MEDIA_GALLERIES_DIALOG_SUBTEXT, UTF8ToUTF16(extension_name)); } @@ -184,7 +184,9 @@ void MediaGalleriesDialogController::OnAddFolderClicked() { ui::SelectFileDialog::SELECT_FOLDER, l10n_util::GetStringUTF16(IDS_MEDIA_GALLERIES_DIALOG_ADD_GALLERY_TITLE), user_data_dir, - NULL, 0, FILE_PATH_LITERAL(""), + NULL, + 0, + FILE_PATH_LITERAL(std::string()), web_contents_->GetView()->GetTopLevelNativeWindow(), NULL); } diff --git a/chrome/browser/media_galleries/media_galleries_preferences.cc b/chrome/browser/media_galleries/media_galleries_preferences.cc index 78316ef..48689ee 100644 --- a/chrome/browser/media_galleries/media_galleries_preferences.cc +++ b/chrome/browser/media_galleries/media_galleries_preferences.cc @@ -258,7 +258,7 @@ void MediaGalleriesPreferences::InitFromPrefs(bool notify_observers) { } } if (notify_observers) - NotifyChangeObservers(""); + NotifyChangeObservers(std::string()); } void MediaGalleriesPreferences::NotifyChangeObservers( diff --git a/chrome/browser/metrics/metrics_log.cc b/chrome/browser/metrics/metrics_log.cc index 72fff96..ec39326 100644 --- a/chrome/browser/metrics/metrics_log.cc +++ b/chrome/browser/metrics/metrics_log.cc @@ -969,7 +969,7 @@ void MetricsLog::RecordOmniboxOpenedURL(const AutocompleteLog& log) { // Write the XML version. OPEN_ELEMENT_FOR_SCOPE("uielement"); WriteAttribute("action", "autocomplete"); - WriteAttribute("targetidhash", ""); + WriteAttribute("targetidhash", std::string()); // TODO(kochi): Properly track windows. WriteIntAttribute("window", 0); if (log.tab_id != -1) { diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc index e68d7bf..c25c8e6 100644 --- a/chrome/browser/metrics/metrics_service.cc +++ b/chrome/browser/metrics/metrics_service.cc @@ -391,13 +391,13 @@ class MetricsMemoryDetails : public MemoryDetails { // static void MetricsService::RegisterPrefs(PrefRegistrySimple* registry) { DCHECK(IsSingleThreaded()); - registry->RegisterStringPref(prefs::kMetricsClientID, ""); + registry->RegisterStringPref(prefs::kMetricsClientID, std::string()); registry->RegisterIntegerPref(prefs::kMetricsLowEntropySource, kLowEntropySourceNotSet); registry->RegisterInt64Pref(prefs::kMetricsClientIDTimestamp, 0); registry->RegisterInt64Pref(prefs::kStabilityLaunchTimeSec, 0); registry->RegisterInt64Pref(prefs::kStabilityLastTimestampSec, 0); - registry->RegisterStringPref(prefs::kStabilityStatsVersion, ""); + registry->RegisterStringPref(prefs::kStabilityStatsVersion, std::string()); registry->RegisterInt64Pref(prefs::kStabilityStatsBuildTime, 0); registry->RegisterBooleanPref(prefs::kStabilityExitedCleanly, true); registry->RegisterBooleanPref(prefs::kStabilitySessionEndCompleted, true); diff --git a/chrome/browser/nacl_host/pnacl_file_host_unittest.cc b/chrome/browser/nacl_host/pnacl_file_host_unittest.cc index eb2a74a..6e30c29 100644 --- a/chrome/browser/nacl_host/pnacl_file_host_unittest.cc +++ b/chrome/browser/nacl_host/pnacl_file_host_unittest.cc @@ -57,7 +57,7 @@ TEST(PnaclFileHostTest, TestFilenamesWithPnaclPath) { &out_path)); // Other bad files. - EXPECT_FALSE(PnaclCanOpenFile("", &out_path)); + EXPECT_FALSE(PnaclCanOpenFile(std::string(), &out_path)); EXPECT_FALSE(PnaclCanOpenFile(".", &out_path)); EXPECT_FALSE(PnaclCanOpenFile("..", &out_path)); #if defined(OS_WIN) diff --git a/chrome/browser/net/chrome_fraudulent_certificate_reporter_unittest.cc b/chrome/browser/net/chrome_fraudulent_certificate_reporter_unittest.cc index 4326fb9..f1d1714 100644 --- a/chrome/browser/net/chrome_fraudulent_certificate_reporter_unittest.cc +++ b/chrome/browser/net/chrome_fraudulent_certificate_reporter_unittest.cc @@ -123,8 +123,7 @@ class NotSendingTestReporter : public TestReporter { class MockURLRequest : public net::URLRequest { public: explicit MockURLRequest(net::URLRequestContext* context) - : net::URLRequest(GURL(""), NULL, context) { - } + : net::URLRequest(GURL(std::string()), NULL, context) {} private: }; diff --git a/chrome/browser/net/chrome_network_delegate_unittest.cc b/chrome/browser/net/chrome_network_delegate_unittest.cc index f822195..b5c8151 100644 --- a/chrome/browser/net/chrome_network_delegate_unittest.cc +++ b/chrome/browser/net/chrome_network_delegate_unittest.cc @@ -234,7 +234,7 @@ TEST_F(ChromeNetworkDelegateSafeSearchTest, SafeSearchOn) { "q=goog&" + kBothParameters); // Test that another website is not affected, without parameters. - CheckAddedParameters("http://google.com/finance", ""); + CheckAddedParameters("http://google.com/finance", std::string()); // Test that another website is not affected, with parameters. CheckAddedParameters("http://google.com/finance?q=goog", "q=goog"); @@ -255,10 +255,10 @@ TEST_F(ChromeNetworkDelegateSafeSearchTest, SafeSearchOff) { SetDelegate(delegate.get()); // Test the home page. - CheckAddedParameters("http://google.com/", ""); + CheckAddedParameters("http://google.com/", std::string()); // Test the search home page. - CheckAddedParameters("http://google.com/webhp", ""); + CheckAddedParameters("http://google.com/webhp", std::string()); // Test the home page with parameters. CheckAddedParameters("http://google.com/search?q=google", diff --git a/chrome/browser/net/dns_probe_job_unittest.cc b/chrome/browser/net/dns_probe_job_unittest.cc index 06d6965..1fe8766 100644 --- a/chrome/browser/net/dns_probe_job_unittest.cc +++ b/chrome/browser/net/dns_probe_job_unittest.cc @@ -54,7 +54,7 @@ void DnsProbeJobTest::RunProbe(MockDnsClientRule::Result good_result, const uint16 kTypeA = net::dns_protocol::kTypeA; MockDnsClientRuleList rules; rules.push_back(MockDnsClientRule("google.com", kTypeA, good_result)); - rules.push_back(MockDnsClientRule("", kTypeA, bad_result)); + rules.push_back(MockDnsClientRule(std::string(), kTypeA, bad_result)); scoped_ptr<DnsClient> dns_client = CreateMockDnsClient(config, rules); dns_client->SetConfig(config); diff --git a/chrome/browser/net/http_pipelining_compatibility_client_unittest.cc b/chrome/browser/net/http_pipelining_compatibility_client_unittest.cc index 7f33790..f582d1b 100644 --- a/chrome/browser/net/http_pipelining_compatibility_client_unittest.cc +++ b/chrome/browser/net/http_pipelining_compatibility_client_unittest.cc @@ -118,8 +118,10 @@ class HttpPipeliningCompatibilityClientTest : public testing::Test { HttpPipeliningCompatibilityClient::Options options) { HttpPipeliningCompatibilityClient client(NULL); net::TestCompletionCallback callback; - client.Start(test_server_.GetURL("").spec(), - requests, options, callback.callback(), + client.Start(test_server_.GetURL(std::string()).spec(), + requests, + options, + callback.callback(), context_->GetURLRequestContext()); callback.WaitForResult(); } diff --git a/chrome/browser/net/pref_proxy_config_tracker_impl_unittest.cc b/chrome/browser/net/pref_proxy_config_tracker_impl_unittest.cc index 3ab5d69..c69fc93 100644 --- a/chrome/browser/net/pref_proxy_config_tracker_impl_unittest.cc +++ b/chrome/browser/net/pref_proxy_config_tracker_impl_unittest.cc @@ -135,9 +135,9 @@ TEST_F(PrefProxyConfigTrackerImplTest, BaseConfiguration) { } TEST_F(PrefProxyConfigTrackerImplTest, DynamicPrefOverrides) { - pref_service_->SetManagedPref( - prefs::kProxy, - ProxyConfigDictionary::CreateFixedServers("http://example.com:3128", "")); + pref_service_->SetManagedPref(prefs::kProxy, + ProxyConfigDictionary::CreateFixedServers( + "http://example.com:3128", std::string())); loop_.RunUntilIdle(); net::ProxyConfig actual_config; diff --git a/chrome/browser/net/url_info.cc b/chrome/browser/net/url_info.cc index ddba658..1046827 100644 --- a/chrome/browser/net/url_info.cc +++ b/chrome/browser/net/url_info.cc @@ -361,7 +361,7 @@ std::string UrlInfo::GetAsciiMotivation() const { return RemoveJs(referring_url_.spec()); default: - return ""; + return std::string(); } } diff --git a/chrome/browser/page_cycler/page_cycler.cc b/chrome/browser/page_cycler/page_cycler.cc index 04086d2..b78e1fe 100644 --- a/chrome/browser/page_cycler/page_cycler.cc +++ b/chrome/browser/page_cycler/page_cycler.cc @@ -192,10 +192,12 @@ void PageCycler::PrepareResultsOnBackgroundThread() { base::ProcessId pid = base::GetCurrentProcId(); #endif // OS_WIN ChromeProcessList chrome_processes(GetRunningChromeProcesses(pid)); - output += perf_test::MemoryUsageInfoToString("", chrome_processes, pid); - output += perf_test::IOPerfInfoToString("", chrome_processes, pid); - output += perf_test::SystemCommitChargeToString("", - base::GetSystemCommitCharge(), false); + output += perf_test::MemoryUsageInfoToString( + std::string(), chrome_processes, pid); + output += + perf_test::IOPerfInfoToString(std::string(), chrome_processes, pid); + output += perf_test::SystemCommitChargeToString( + std::string(), base::GetSystemCommitCharge(), false); output.append("Pages: [" + urls_string_ + "]\n"); output.append("*RESULT times: t_ref= [" + timings_string_ + "] ms\n"); } diff --git a/chrome/browser/password_manager/native_backend_kwallet_x.cc b/chrome/browser/password_manager/native_backend_kwallet_x.cc index 74d6bb9..9c6003d 100644 --- a/chrome/browser/password_manager/native_backend_kwallet_x.cc +++ b/chrome/browser/password_manager/native_backend_kwallet_x.cc @@ -186,7 +186,7 @@ bool NativeBackendKWallet::StartKWalletd() { builder.AppendString("kwalletd"); // serviceName builder.AppendArrayOfStrings(empty); // urls builder.AppendArrayOfStrings(empty); // envs - builder.AppendString(""); // startup_id + builder.AppendString(std::string()); // startup_id builder.AppendBool(false); // blind scoped_ptr<dbus::Response> response( klauncher->CallMethodAndBlock( diff --git a/chrome/browser/password_manager/native_backend_kwallet_x_unittest.cc b/chrome/browser/password_manager/native_backend_kwallet_x_unittest.cc index ad00e11..11af55a 100644 --- a/chrome/browser/password_manager/native_backend_kwallet_x_unittest.cc +++ b/chrome/browser/password_manager/native_backend_kwallet_x_unittest.cc @@ -315,7 +315,7 @@ dbus::Response* NativeBackendKWalletTest::KLauncherMethodCall( scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty()); dbus::MessageWriter writer(response.get()); writer.AppendInt32(klauncher_ret_); - writer.AppendString(""); // dbus_name + writer.AppendString(std::string()); // dbus_name writer.AppendString(klauncher_error_); writer.AppendInt32(1234); // pid return response.release(); diff --git a/chrome/browser/plugins/plugin_finder.cc b/chrome/browser/plugins/plugin_finder.cc index 32ad157..0070387 100644 --- a/chrome/browser/plugins/plugin_finder.cc +++ b/chrome/browser/plugins/plugin_finder.cc @@ -292,9 +292,11 @@ scoped_ptr<PluginMetadata> PluginFinder::GetPluginMetadata( std::string identifier = GetIdentifier(plugin); PluginMetadata* metadata = new PluginMetadata(identifier, GetGroupName(plugin), - false, GURL(), GURL(), + false, + GURL(), + GURL(), plugin.name, - ""); + std::string()); for (size_t i = 0; i < plugin.mime_types.size(); ++i) metadata->AddMatchingMimeType(plugin.mime_types[i].mime_type); diff --git a/chrome/browser/plugins/plugin_metadata_unittest.cc b/chrome/browser/plugins/plugin_metadata_unittest.cc index 3e3bf99..b542b1b 100644 --- a/chrome/browser/plugins/plugin_metadata_unittest.cc +++ b/chrome/browser/plugins/plugin_metadata_unittest.cc @@ -34,9 +34,11 @@ TEST(PluginMetadataTest, SecurityStatus) { PluginMetadata plugin_metadata("claybrick-writer", ASCIIToUTF16("ClayBrick Writer"), - true, GURL(), GURL(), + true, + GURL(), + GURL(), ASCIIToUTF16("ClayBrick"), - ""); + std::string()); #if defined(OS_LINUX) EXPECT_EQ(kRequiresAuthorization, GetSecurityStatus(&plugin_metadata, "1.2.3")); diff --git a/chrome/browser/policy/cloud/cloud_policy_refresh_scheduler_unittest.cc b/chrome/browser/policy/cloud/cloud_policy_refresh_scheduler_unittest.cc index 269ca75..9f3c403 100644 --- a/chrome/browser/policy/cloud/cloud_policy_refresh_scheduler_unittest.cc +++ b/chrome/browser/policy/cloud/cloud_policy_refresh_scheduler_unittest.cc @@ -127,7 +127,7 @@ TEST_F(CloudPolicyRefreshSchedulerTest, InitialRefreshManagedAlreadyFetched) { } TEST_F(CloudPolicyRefreshSchedulerTest, Unregistered) { - client_.SetDMToken(""); + client_.SetDMToken(std::string()); scoped_ptr<CloudPolicyRefreshScheduler> scheduler(CreateRefreshScheduler()); client_.NotifyPolicyFetched(); client_.NotifyRegistrationStateChanged(); @@ -182,7 +182,7 @@ TEST_F(CloudPolicyRefreshSchedulerSteadyStateTest, OnRegistrationStateChanged) { EXPECT_EQ(GetLastDelay(), base::TimeDelta()); task_runner_->ClearPendingTasks(); - client_.SetDMToken(""); + client_.SetDMToken(std::string()); client_.NotifyRegistrationStateChanged(); EXPECT_TRUE(task_runner_->GetPendingTasks().empty()); } diff --git a/chrome/browser/policy/cloud/cloud_policy_service_unittest.cc b/chrome/browser/policy/cloud/cloud_policy_service_unittest.cc index 90b344b..b1c7ccb 100644 --- a/chrome/browser/policy/cloud/cloud_policy_service_unittest.cc +++ b/chrome/browser/policy/cloud/cloud_policy_service_unittest.cc @@ -118,7 +118,7 @@ TEST_F(CloudPolicyServiceTest, RefreshPolicySuccess) { TEST_F(CloudPolicyServiceTest, RefreshPolicyNotRegistered) { // Clear the token so the client is not registered. - client_.SetDMToken(""); + client_.SetDMToken(std::string()); EXPECT_CALL(client_, FetchPolicy()).Times(0); EXPECT_CALL(*this, OnPolicyRefresh(false)).Times(1); diff --git a/chrome/browser/policy/cloud/device_management_service_unittest.cc b/chrome/browser/policy/cloud/device_management_service_unittest.cc index ae84965..b83ca80 100644 --- a/chrome/browser/policy/cloud/device_management_service_unittest.cc +++ b/chrome/browser/policy/cloud/device_management_service_unittest.cc @@ -513,7 +513,7 @@ TEST_F(DeviceManagementServiceTest, CancelDuringCallback) { // Generate a callback. net::URLRequestStatus status(net::URLRequestStatus::SUCCESS, 0); - SendResponse(fetcher, status, 500, ""); + SendResponse(fetcher, status, 500, std::string()); // Job should have been reset. EXPECT_FALSE(request_job.get()); @@ -534,7 +534,7 @@ TEST_F(DeviceManagementServiceTest, RetryOnProxyError) { // Generate a callback with a proxy failure. net::URLRequestStatus status(net::URLRequestStatus::FAILED, net::ERR_PROXY_CONNECTION_FAILED); - SendResponse(fetcher, status, 200, ""); + SendResponse(fetcher, status, 200, std::string()); // Verify that a new URLFetcher was started that bypasses the proxy. fetcher = GetFetcher(); @@ -564,7 +564,7 @@ TEST_F(DeviceManagementServiceTest, RetryOnBadResponseFromProxy) { // Generate a callback with a valid http response, that was generated by // a bad/wrong proxy. net::URLRequestStatus status; - SendResponse(fetcher, status, 200, ""); + SendResponse(fetcher, status, 200, std::string()); // Verify that a new URLFetcher was started that bypasses the proxy. fetcher = GetFetcher(); diff --git a/chrome/browser/policy/cloud/mock_cloud_policy_client.cc b/chrome/browser/policy/cloud/mock_cloud_policy_client.cc index 7008ec3..92b67e7 100644 --- a/chrome/browser/policy/cloud/mock_cloud_policy_client.cc +++ b/chrome/browser/policy/cloud/mock_cloud_policy_client.cc @@ -10,7 +10,11 @@ namespace em = enterprise_management; namespace policy { MockCloudPolicyClient::MockCloudPolicyClient() - : CloudPolicyClient("", "", USER_AFFILIATION_NONE, NULL, NULL) {} + : CloudPolicyClient(std::string(), + std::string(), + USER_AFFILIATION_NONE, + NULL, + NULL) {} MockCloudPolicyClient::~MockCloudPolicyClient() {} diff --git a/chrome/browser/policy/cloud/mock_device_management_service.cc b/chrome/browser/policy/cloud/mock_device_management_service.cc index 987cf62..f7836ce 100644 --- a/chrome/browser/policy/cloud/mock_device_management_service.cc +++ b/chrome/browser/policy/cloud/mock_device_management_service.cc @@ -116,7 +116,7 @@ ACTION_P2(CreateAsyncMockDeviceManagementJob, service, mock_job) { MockDeviceManagementJob::~MockDeviceManagementJob() {} MockDeviceManagementService::MockDeviceManagementService() - : DeviceManagementService("") {} + : DeviceManagementService(std::string()) {} MockDeviceManagementService::~MockDeviceManagementService() {} diff --git a/chrome/browser/policy/configuration_policy_pref_store_unittest.cc b/chrome/browser/policy/configuration_policy_pref_store_unittest.cc index a801f83..321b3732 100644 --- a/chrome/browser/policy/configuration_policy_pref_store_unittest.cc +++ b/chrome/browser/policy/configuration_policy_pref_store_unittest.cc @@ -409,9 +409,10 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, ManualOptions) { ProxyPolicyHandler::PROXY_MANUALLY_CONFIGURED_PROXY_SERVER_MODE)); UpdateProviderPolicy(policy); - VerifyProxyPrefs( - "chromium.org", "", "http://chromium.org/override", - ProxyPrefs::MODE_FIXED_SERVERS); + VerifyProxyPrefs("chromium.org", + std::string(), + "http://chromium.org/override", + ProxyPrefs::MODE_FIXED_SERVERS); } TEST_F(ConfigurationPolicyPrefStoreProxyTest, ManualOptionsReversedApplyOrder) { @@ -426,9 +427,10 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, ManualOptionsReversedApplyOrder) { base::Value::CreateStringValue("chromium.org")); UpdateProviderPolicy(policy); - VerifyProxyPrefs( - "chromium.org", "", "http://chromium.org/override", - ProxyPrefs::MODE_FIXED_SERVERS); + VerifyProxyPrefs("chromium.org", + std::string(), + "http://chromium.org/override", + ProxyPrefs::MODE_FIXED_SERVERS); } TEST_F(ConfigurationPolicyPrefStoreProxyTest, ManualOptionsInvalid) { @@ -450,7 +452,8 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, NoProxyServerMode) { base::Value::CreateIntegerValue( ProxyPolicyHandler::PROXY_SERVER_MODE)); UpdateProviderPolicy(policy); - VerifyProxyPrefs("", "", "", ProxyPrefs::MODE_DIRECT); + VerifyProxyPrefs( + std::string(), std::string(), std::string(), ProxyPrefs::MODE_DIRECT); } TEST_F(ConfigurationPolicyPrefStoreProxyTest, NoProxyModeName) { @@ -458,7 +461,8 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, NoProxyModeName) { policy.Set(key::kProxyMode, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, base::Value::CreateStringValue(ProxyPrefs::kDirectProxyModeName)); UpdateProviderPolicy(policy); - VerifyProxyPrefs("", "", "", ProxyPrefs::MODE_DIRECT); + VerifyProxyPrefs( + std::string(), std::string(), std::string(), ProxyPrefs::MODE_DIRECT); } TEST_F(ConfigurationPolicyPrefStoreProxyTest, AutoDetectProxyServerMode) { @@ -468,7 +472,10 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, AutoDetectProxyServerMode) { base::Value::CreateIntegerValue( ProxyPolicyHandler::PROXY_AUTO_DETECT_PROXY_SERVER_MODE)); UpdateProviderPolicy(policy); - VerifyProxyPrefs("", "", "", ProxyPrefs::MODE_AUTO_DETECT); + VerifyProxyPrefs(std::string(), + std::string(), + std::string(), + ProxyPrefs::MODE_AUTO_DETECT); } TEST_F(ConfigurationPolicyPrefStoreProxyTest, AutoDetectProxyModeName) { @@ -477,7 +484,10 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, AutoDetectProxyModeName) { base::Value::CreateStringValue( ProxyPrefs::kAutoDetectProxyModeName)); UpdateProviderPolicy(policy); - VerifyProxyPrefs("", "", "", ProxyPrefs::MODE_AUTO_DETECT); + VerifyProxyPrefs(std::string(), + std::string(), + std::string(), + ProxyPrefs::MODE_AUTO_DETECT); } TEST_F(ConfigurationPolicyPrefStoreProxyTest, PacScriptProxyMode) { @@ -488,7 +498,9 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, PacScriptProxyMode) { base::Value::CreateStringValue( ProxyPrefs::kPacScriptProxyModeName)); UpdateProviderPolicy(policy); - VerifyProxyPrefs("", "http://short.org/proxy.pac", "", + VerifyProxyPrefs(std::string(), + "http://short.org/proxy.pac", + std::string(), ProxyPrefs::MODE_PAC_SCRIPT); } @@ -506,15 +518,21 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, PacScriptProxyModeInvalid) { // for unset properties. TEST_F(ConfigurationPolicyPrefStoreProxyTest, PacScriptProxyModeBug78016) { PolicyMap policy; - policy.Set(key::kProxyServer, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, - base::Value::CreateStringValue("")); - policy.Set(key::kProxyPacUrl, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, + policy.Set(key::kProxyServer, + POLICY_LEVEL_MANDATORY, + POLICY_SCOPE_USER, + base::Value::CreateStringValue(std::string())); + policy.Set(key::kProxyPacUrl, + POLICY_LEVEL_MANDATORY, + POLICY_SCOPE_USER, base::Value::CreateStringValue("http://short.org/proxy.pac")); policy.Set(key::kProxyMode, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, base::Value::CreateStringValue( ProxyPrefs::kPacScriptProxyModeName)); UpdateProviderPolicy(policy); - VerifyProxyPrefs("", "http://short.org/proxy.pac", "", + VerifyProxyPrefs(std::string(), + "http://short.org/proxy.pac", + std::string(), ProxyPrefs::MODE_PAC_SCRIPT); } @@ -524,7 +542,8 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, UseSystemProxyServerMode) { base::Value::CreateIntegerValue( ProxyPolicyHandler::PROXY_USE_SYSTEM_PROXY_SERVER_MODE)); UpdateProviderPolicy(policy); - VerifyProxyPrefs("", "", "", ProxyPrefs::MODE_SYSTEM); + VerifyProxyPrefs( + std::string(), std::string(), std::string(), ProxyPrefs::MODE_SYSTEM); } TEST_F(ConfigurationPolicyPrefStoreProxyTest, UseSystemProxyMode) { @@ -532,7 +551,8 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, UseSystemProxyMode) { policy.Set(key::kProxyMode, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, base::Value::CreateStringValue(ProxyPrefs::kSystemProxyModeName)); UpdateProviderPolicy(policy); - VerifyProxyPrefs("", "", "", ProxyPrefs::MODE_SYSTEM); + VerifyProxyPrefs( + std::string(), std::string(), std::string(), ProxyPrefs::MODE_SYSTEM); } TEST_F(ConfigurationPolicyPrefStoreProxyTest, @@ -545,7 +565,10 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, base::Value::CreateStringValue( ProxyPrefs::kAutoDetectProxyModeName)); UpdateProviderPolicy(policy); - VerifyProxyPrefs("", "", "", ProxyPrefs::MODE_AUTO_DETECT); + VerifyProxyPrefs(std::string(), + std::string(), + std::string(), + ProxyPrefs::MODE_AUTO_DETECT); } TEST_F(ConfigurationPolicyPrefStoreProxyTest, ProxyInvalid) { @@ -768,7 +791,7 @@ TEST_F(ConfigurationPolicyPrefStoreDefaultSearchTest, Disabled) { base::FundamentalValue expected_enabled(false); EXPECT_TRUE(base::Value::Equals(&expected_enabled, value)); EXPECT_TRUE(store_->GetValue(prefs::kDefaultSearchProviderSearchURL, &value)); - base::StringValue expected_search_url(""); + base::StringValue expected_search_url((std::string())); EXPECT_TRUE(base::Value::Equals(&expected_search_url, value)); } @@ -908,8 +931,10 @@ TEST_F(ConfigurationPolicyPrefStorePromptDownloadTest, Default) { TEST_F(ConfigurationPolicyPrefStorePromptDownloadTest, SetDownloadDirectory) { PolicyMap policy; EXPECT_FALSE(store_->GetValue(prefs::kPromptForDownload, NULL)); - policy.Set(key::kDownloadDirectory, POLICY_LEVEL_MANDATORY, - POLICY_SCOPE_USER, base::Value::CreateStringValue("")); + policy.Set(key::kDownloadDirectory, + POLICY_LEVEL_MANDATORY, + POLICY_SCOPE_USER, + base::Value::CreateStringValue(std::string())); UpdateProviderPolicy(policy); // Setting a DownloadDirectory should disable the PromptForDownload pref. diff --git a/chrome/browser/policy/policy_map_unittest.cc b/chrome/browser/policy/policy_map_unittest.cc index a2f6207..367ce06 100644 --- a/chrome/browser/policy/policy_map_unittest.cc +++ b/chrome/browser/policy/policy_map_unittest.cc @@ -103,9 +103,13 @@ TEST(PolicyMapTest, MergeFrom) { Value::CreateBooleanValue(false)); b.Set(key::kBookmarkBarEnabled, POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_MACHINE, Value::CreateBooleanValue(true)); - b.Set(key::kDefaultSearchProviderSearchURL, POLICY_LEVEL_MANDATORY, - POLICY_SCOPE_MACHINE, Value::CreateStringValue("")); - b.Set(key::kDisableSpdy, POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER, + b.Set(key::kDefaultSearchProviderSearchURL, + POLICY_LEVEL_MANDATORY, + POLICY_SCOPE_MACHINE, + Value::CreateStringValue(std::string())); + b.Set(key::kDisableSpdy, + POLICY_LEVEL_RECOMMENDED, + POLICY_SCOPE_USER, Value::CreateBooleanValue(true)); a.MergeFrom(b); @@ -121,8 +125,10 @@ TEST(PolicyMapTest, MergeFrom) { c.Set(key::kBookmarkBarEnabled, POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_MACHINE, Value::CreateBooleanValue(true)); // POLICY_LEVEL_MANDATORY over POLICY_LEVEL_RECOMMENDED. - c.Set(key::kDefaultSearchProviderSearchURL, POLICY_LEVEL_MANDATORY, - POLICY_SCOPE_MACHINE, Value::CreateStringValue("")); + c.Set(key::kDefaultSearchProviderSearchURL, + POLICY_LEVEL_MANDATORY, + POLICY_SCOPE_MACHINE, + Value::CreateStringValue(std::string())); // Merge new ones. c.Set(key::kDisableSpdy, POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER, Value::CreateBooleanValue(true)); diff --git a/chrome/browser/policy/policy_prefs_browsertest.cc b/chrome/browser/policy/policy_prefs_browsertest.cc index bce4fe0..23173bc 100644 --- a/chrome/browser/policy/policy_prefs_browsertest.cc +++ b/chrome/browser/policy/policy_prefs_browsertest.cc @@ -519,8 +519,8 @@ IN_PROC_BROWSER_TEST_P(PolicyPrefsTest, CheckPolicyIndicators) { // set by policy. PolicyMap policies; UpdateProviderPolicy(policies); - VerifyControlledSettingIndicators(browser(), indicator_selector, - "", "", false); + VerifyControlledSettingIndicators( + browser(), indicator_selector, std::string(), std::string(), false); // Check that the appropriate controlled setting indicator is shown when a // value is enforced by policy. policies.LoadFrom(&(*indicator_test_case)->policy(), diff --git a/chrome/browser/policy/url_blacklist_manager_unittest.cc b/chrome/browser/policy/url_blacklist_manager_unittest.cc index 3e5ac0f..b1f69d1 100644 --- a/chrome/browser/policy/url_blacklist_manager_unittest.cc +++ b/chrome/browser/policy/url_blacklist_manager_unittest.cc @@ -240,31 +240,83 @@ INSTANTIATE_TEST_CASE_P( URLBlacklistFilterToComponentsTest, testing::Values( FilterTestParams("google.com", - "", ".google.com", true, 0u, ""), + std::string(), + ".google.com", + true, + 0u, + std::string()), FilterTestParams(".google.com", - "", "google.com", false, 0u, ""), + std::string(), + "google.com", + false, + 0u, + std::string()), FilterTestParams("http://google.com", - "http", ".google.com", true, 0u, ""), + "http", + ".google.com", + true, + 0u, + std::string()), FilterTestParams("google.com/", - "", ".google.com", true, 0u, "/"), + std::string(), + ".google.com", + true, + 0u, + "/"), FilterTestParams("http://google.com:8080/whatever", - "http", ".google.com", true, 8080u, "/whatever"), + "http", + ".google.com", + true, + 8080u, + "/whatever"), FilterTestParams("http://user:pass@google.com:8080/whatever", - "http", ".google.com", true, 8080u, "/whatever"), + "http", + ".google.com", + true, + 8080u, + "/whatever"), FilterTestParams("123.123.123.123", - "", "123.123.123.123", false, 0u, ""), + std::string(), + "123.123.123.123", + false, + 0u, + std::string()), FilterTestParams("https://123.123.123.123", - "https", "123.123.123.123", false, 0u, ""), + "https", + "123.123.123.123", + false, + 0u, + std::string()), FilterTestParams("123.123.123.123/", - "", "123.123.123.123", false, 0u, "/"), + std::string(), + "123.123.123.123", + false, + 0u, + "/"), FilterTestParams("http://123.123.123.123:123/whatever", - "http", "123.123.123.123", false, 123u, "/whatever"), + "http", + "123.123.123.123", + false, + 123u, + "/whatever"), FilterTestParams("*", - "", "", true, 0u, ""), + std::string(), + std::string(), + true, + 0u, + std::string()), FilterTestParams("ftp://*", - "ftp", "", true, 0u, ""), + "ftp", + std::string(), + true, + 0u, + std::string()), FilterTestParams("http://*/whatever", - "http", "", true, 0u, "/whatever"))); + "http", + std::string(), + true, + 0u, + "/whatever"))); TEST_F(URLBlacklistManagerTest, Filtering) { URLBlacklist blacklist; diff --git a/chrome/browser/popup_blocker_browsertest.cc b/chrome/browser/popup_blocker_browsertest.cc index c2e3ede..aacbbef 100644 --- a/chrome/browser/popup_blocker_browsertest.cc +++ b/chrome/browser/popup_blocker_browsertest.cc @@ -55,7 +55,7 @@ class PopupBlockerBrowserTest : public InProcessBrowserTest { // Do a round trip to the renderer first to flush any in-flight IPCs to // create a to-be-blocked window. WebContents* tab = browser->tab_strip_model()->GetActiveWebContents(); - CHECK(content::ExecuteScript(tab, "")); + CHECK(content::ExecuteScript(tab, std::string())); BlockedContentTabHelper* blocked_content_tab_helper = BlockedContentTabHelper::FromWebContents(tab); std::vector<WebContents*> blocked_contents; @@ -127,12 +127,12 @@ IN_PROC_BROWSER_TEST_F(PopupBlockerBrowserTest, MultiplePopups) { IN_PROC_BROWSER_TEST_F(PopupBlockerBrowserTest, AllowPopupThroughContentSetting) { GURL url(GetTestURL()); - browser()->profile()->GetHostContentSettingsMap()->SetContentSetting( - ContentSettingsPattern::FromURL(url), - ContentSettingsPattern::Wildcard(), - CONTENT_SETTINGS_TYPE_POPUPS, - "", - CONTENT_SETTING_ALLOW); + browser()->profile()->GetHostContentSettingsMap() + ->SetContentSetting(ContentSettingsPattern::FromURL(url), + ContentSettingsPattern::Wildcard(), + CONTENT_SETTINGS_TYPE_POPUPS, + std::string(), + CONTENT_SETTING_ALLOW); NavigateAndCheckPopupShown(browser(), url); } diff --git a/chrome/browser/predictors/autocomplete_action_predictor.cc b/chrome/browser/predictors/autocomplete_action_predictor.cc index cc183c36..184e7a7 100644 --- a/chrome/browser/predictors/autocomplete_action_predictor.cc +++ b/chrome/browser/predictors/autocomplete_action_predictor.cc @@ -148,7 +148,7 @@ void AutocompleteActionPredictor::StartPrerendering( prerender::PrerenderManagerFactory::GetForProfile(profile_)) { content::SessionStorageNamespace* session_storage_namespace = NULL; content::SessionStorageNamespaceMap::const_iterator it = - session_storage_namespace_map.find(""); + session_storage_namespace_map.find(std::string()); if (it != session_storage_namespace_map.end()) session_storage_namespace = it->second; prerender_handle_.reset( diff --git a/chrome/browser/predictors/resource_prefetch_predictor.cc b/chrome/browser/predictors/resource_prefetch_predictor.cc index a6d7cbd..b37f3a1 100644 --- a/chrome/browser/predictors/resource_prefetch_predictor.cc +++ b/chrome/browser/predictors/resource_prefetch_predictor.cc @@ -1012,7 +1012,8 @@ void ResourcePrefetchPredictor::LearnNavigation( } else { bool is_host = key_type == PREFETCH_KEY_TYPE_HOST; PrefetchData empty_data( - !is_host ? PREFETCH_KEY_TYPE_HOST : PREFETCH_KEY_TYPE_URL , ""); + !is_host ? PREFETCH_KEY_TYPE_HOST : PREFETCH_KEY_TYPE_URL, + std::string()); const PrefetchData& host_data = is_host ? cache_entry->second : empty_data; const PrefetchData& url_data = is_host ? empty_data : cache_entry->second; BrowserThread::PostTask( diff --git a/chrome/browser/predictors/resource_prefetch_predictor_tables_unittest.cc b/chrome/browser/predictors/resource_prefetch_predictor_tables_unittest.cc index d39e892..fa5be14 100644 --- a/chrome/browser/predictors/resource_prefetch_predictor_tables_unittest.cc +++ b/chrome/browser/predictors/resource_prefetch_predictor_tables_unittest.cc @@ -167,34 +167,45 @@ void ResourcePrefetchPredictorTablesTest::TestDeleteSingleDataPoint() { void ResourcePrefetchPredictorTablesTest::TestUpdateData() { PrefetchData google(PREFETCH_KEY_TYPE_URL, "http://www.google.com"); google.last_visit = base::Time::FromInternalValue(10); - google.resources.push_back(ResourceRow( - "", - "http://www.google.com/style.css", - ResourceType::STYLESHEET, - 6, 2, 0, 1.0)); - google.resources.push_back(ResourceRow( - "", - "http://www.google.com/image.png", - ResourceType::IMAGE, - 6, 4, 1, 4.2)); - google.resources.push_back(ResourceRow( - "", - "http://www.google.com/a.xml", - ResourceType::LAST_TYPE, - 1, 0, 0, 6.1)); - google.resources.push_back(ResourceRow( - "", - "http://www.resources.google.com/script.js", - ResourceType::SCRIPT, - 12, 0, 0, 8.5)); + google.resources.push_back(ResourceRow(std::string(), + "http://www.google.com/style.css", + ResourceType::STYLESHEET, + 6, + 2, + 0, + 1.0)); + google.resources.push_back(ResourceRow(std::string(), + "http://www.google.com/image.png", + ResourceType::IMAGE, + 6, + 4, + 1, + 4.2)); + google.resources.push_back(ResourceRow(std::string(), + "http://www.google.com/a.xml", + ResourceType::LAST_TYPE, + 1, + 0, + 0, + 6.1)); + google.resources + .push_back(ResourceRow(std::string(), + "http://www.resources.google.com/script.js", + ResourceType::SCRIPT, + 12, + 0, + 0, + 8.5)); PrefetchData yahoo(PREFETCH_KEY_TYPE_HOST, "www.yahoo.com"); yahoo.last_visit = base::Time::FromInternalValue(7); - yahoo.resources.push_back(ResourceRow( - "", - "http://www.yahoo.com/image.png", - ResourceType::IMAGE, - 120, 1, 1, 10.0)); + yahoo.resources.push_back(ResourceRow(std::string(), + "http://www.yahoo.com/image.png", + ResourceType::IMAGE, + 120, + 1, + 1, + 10.0)); tables_->UpdateData(google, yahoo); @@ -276,59 +287,78 @@ void ResourcePrefetchPredictorTablesTest::InitializeSampleData() { { // Url data. PrefetchData google(PREFETCH_KEY_TYPE_URL, "http://www.google.com"); google.last_visit = base::Time::FromInternalValue(1); - google.resources.push_back(ResourceRow( - "", - "http://www.google.com/style.css", - ResourceType::STYLESHEET, - 5, 2, 1, 1.1)); - google.resources.push_back(ResourceRow( - "", - "http://www.google.com/script.js", - ResourceType::SCRIPT, - 4, 0, 1, 2.1)); - google.resources.push_back(ResourceRow( - "", - "http://www.google.com/image.png", - ResourceType::IMAGE, - 6, 3, 0, 2.2)); - google.resources.push_back(ResourceRow( - "", - "http://www.google.com/a.font", - ResourceType::LAST_TYPE, - 2, 0, 0, 5.1)); - google.resources.push_back(ResourceRow( - "", - "http://www.resources.google.com/script.js", - ResourceType::SCRIPT, - 11, 0, 0, 8.5)); + google.resources.push_back(ResourceRow(std::string(), + "http://www.google.com/style.css", + ResourceType::STYLESHEET, + 5, + 2, + 1, + 1.1)); + google.resources.push_back(ResourceRow(std::string(), + "http://www.google.com/script.js", + ResourceType::SCRIPT, + 4, + 0, + 1, + 2.1)); + google.resources.push_back(ResourceRow(std::string(), + "http://www.google.com/image.png", + ResourceType::IMAGE, + 6, + 3, + 0, + 2.2)); + google.resources.push_back(ResourceRow(std::string(), + "http://www.google.com/a.font", + ResourceType::LAST_TYPE, + 2, + 0, + 0, + 5.1)); + google.resources + .push_back(ResourceRow(std::string(), + "http://www.resources.google.com/script.js", + ResourceType::SCRIPT, + 11, + 0, + 0, + 8.5)); PrefetchData reddit(PREFETCH_KEY_TYPE_URL, "http://www.reddit.com"); reddit.last_visit = base::Time::FromInternalValue(2); - reddit.resources.push_back(ResourceRow( - "", - "http://reddit-resource.com/script1.js", - ResourceType::SCRIPT, - 4, 0, 1, 1.0)); - reddit.resources.push_back(ResourceRow( - "", - "http://reddit-resource.com/script2.js", - ResourceType::SCRIPT, - 2, 0, 0, 2.1)); + reddit.resources + .push_back(ResourceRow(std::string(), + "http://reddit-resource.com/script1.js", + ResourceType::SCRIPT, + 4, + 0, + 1, + 1.0)); + reddit.resources + .push_back(ResourceRow(std::string(), + "http://reddit-resource.com/script2.js", + ResourceType::SCRIPT, + 2, + 0, + 0, + 2.1)); PrefetchData yahoo(PREFETCH_KEY_TYPE_URL, "http://www.yahoo.com"); yahoo.last_visit = base::Time::FromInternalValue(3); - yahoo.resources.push_back(ResourceRow( - "", - "http://www.google.com/image.png", - ResourceType::IMAGE, - 20, 1, 0, 10.0)); + yahoo.resources.push_back(ResourceRow(std::string(), + "http://www.google.com/image.png", + ResourceType::IMAGE, + 20, + 1, + 0, + 10.0)); test_url_data_.clear(); test_url_data_.insert(std::make_pair("http://www.google.com", google)); test_url_data_.insert(std::make_pair("http://www.reddit.com", reddit)); test_url_data_.insert(std::make_pair("http://www.yahoo.com", yahoo)); - PrefetchData empty_host_data(PREFETCH_KEY_TYPE_HOST, ""); + PrefetchData empty_host_data(PREFETCH_KEY_TYPE_HOST, std::string()); tables_->UpdateData(google, empty_host_data); tables_->UpdateData(reddit, empty_host_data); tables_->UpdateData(yahoo, empty_host_data); @@ -337,45 +367,61 @@ void ResourcePrefetchPredictorTablesTest::InitializeSampleData() { { // Host data. PrefetchData facebook(PREFETCH_KEY_TYPE_HOST, "www.facebook.com"); facebook.last_visit = base::Time::FromInternalValue(4); - facebook.resources.push_back(ResourceRow( - "", - "http://www.facebook.com/style.css", - ResourceType::STYLESHEET, - 5, 2, 1, 1.1)); - facebook.resources.push_back(ResourceRow( - "", - "http://www.facebook.com/script.js", - ResourceType::SCRIPT, - 4, 0, 1, 2.1)); - facebook.resources.push_back(ResourceRow( - "", - "http://www.facebook.com/image.png", - ResourceType::IMAGE, - 6, 3, 0, 2.2)); - facebook.resources.push_back(ResourceRow( - "", - "http://www.facebook.com/a.font", - ResourceType::LAST_TYPE, - 2, 0, 0, 5.1)); - facebook.resources.push_back(ResourceRow( - "", - "http://www.resources.facebook.com/script.js", - ResourceType::SCRIPT, - 11, 0, 0, 8.5)); + facebook.resources + .push_back(ResourceRow(std::string(), + "http://www.facebook.com/style.css", + ResourceType::STYLESHEET, + 5, + 2, + 1, + 1.1)); + facebook.resources + .push_back(ResourceRow(std::string(), + "http://www.facebook.com/script.js", + ResourceType::SCRIPT, + 4, + 0, + 1, + 2.1)); + facebook.resources + .push_back(ResourceRow(std::string(), + "http://www.facebook.com/image.png", + ResourceType::IMAGE, + 6, + 3, + 0, + 2.2)); + facebook.resources.push_back(ResourceRow(std::string(), + "http://www.facebook.com/a.font", + ResourceType::LAST_TYPE, + 2, + 0, + 0, + 5.1)); + facebook.resources + .push_back(ResourceRow(std::string(), + "http://www.resources.facebook.com/script.js", + ResourceType::SCRIPT, + 11, + 0, + 0, + 8.5)); PrefetchData yahoo(PREFETCH_KEY_TYPE_HOST, "www.yahoo.com"); yahoo.last_visit = base::Time::FromInternalValue(5); - yahoo.resources.push_back(ResourceRow( - "", - "http://www.google.com/image.png", - ResourceType::IMAGE, - 20, 1, 0, 10.0)); + yahoo.resources.push_back(ResourceRow(std::string(), + "http://www.google.com/image.png", + ResourceType::IMAGE, + 20, + 1, + 0, + 10.0)); test_host_data_.clear(); test_host_data_.insert(std::make_pair("www.facebook.com", facebook)); test_host_data_.insert(std::make_pair("www.yahoo.com", yahoo)); - PrefetchData empty_url_data(PREFETCH_KEY_TYPE_URL, ""); + PrefetchData empty_url_data(PREFETCH_KEY_TYPE_URL, std::string()); tables_->UpdateData(empty_url_data, facebook); tables_->UpdateData(empty_url_data, yahoo); } diff --git a/chrome/browser/predictors/resource_prefetch_predictor_unittest.cc b/chrome/browser/predictors/resource_prefetch_predictor_unittest.cc index 891b70c..b6203da 100644 --- a/chrome/browser/predictors/resource_prefetch_predictor_unittest.cc +++ b/chrome/browser/predictors/resource_prefetch_predictor_unittest.cc @@ -176,9 +176,8 @@ ResourcePrefetchPredictorTest::ResourcePrefetchPredictorTest() profile_(new TestingProfile()), predictor_(NULL), mock_tables_(new StrictMock<MockResourcePrefetchPredictorTables>()), - empty_url_data_(PREFETCH_KEY_TYPE_URL, ""), - empty_host_data_(PREFETCH_KEY_TYPE_HOST, "") { -} + empty_url_data_(PREFETCH_KEY_TYPE_URL, std::string()), + empty_host_data_(PREFETCH_KEY_TYPE_HOST, std::string()) {} ResourcePrefetchPredictorTest::~ResourcePrefetchPredictorTest() { profile_.reset(NULL); @@ -214,52 +213,70 @@ void ResourcePrefetchPredictorTest::InitializeSampleData() { { // Url data. PrefetchData google(PREFETCH_KEY_TYPE_URL, "http://www.google.com/"); google.last_visit = base::Time::FromInternalValue(1); - google.resources.push_back(ResourceRow( - "", - "http://google.com/style1.css", - ResourceType::STYLESHEET, - 3, 2, 1, 1.0)); - google.resources.push_back(ResourceRow( - "", - "http://google.com/script3.js", - ResourceType::SCRIPT, - 4, 0, 1, 2.1)); - google.resources.push_back(ResourceRow( - "", - "http://google.com/script4.js", - ResourceType::SCRIPT, - 11, 0, 0, 2.1)); - google.resources.push_back(ResourceRow( - "", - "http://google.com/image1.png", - ResourceType::IMAGE, - 6, 3, 0, 2.2)); - google.resources.push_back(ResourceRow( - "", - "http://google.com/a.font", - ResourceType::LAST_TYPE, - 2, 0, 0, 5.1)); + google.resources.push_back(ResourceRow(std::string(), + "http://google.com/style1.css", + ResourceType::STYLESHEET, + 3, + 2, + 1, + 1.0)); + google.resources.push_back(ResourceRow(std::string(), + "http://google.com/script3.js", + ResourceType::SCRIPT, + 4, + 0, + 1, + 2.1)); + google.resources.push_back(ResourceRow(std::string(), + "http://google.com/script4.js", + ResourceType::SCRIPT, + 11, + 0, + 0, + 2.1)); + google.resources.push_back(ResourceRow(std::string(), + "http://google.com/image1.png", + ResourceType::IMAGE, + 6, + 3, + 0, + 2.2)); + google.resources.push_back(ResourceRow(std::string(), + "http://google.com/a.font", + ResourceType::LAST_TYPE, + 2, + 0, + 0, + 5.1)); PrefetchData reddit(PREFETCH_KEY_TYPE_URL, "http://www.reddit.com/"); reddit.last_visit = base::Time::FromInternalValue(2); - reddit.resources.push_back(ResourceRow( - "", - "http://reddit-resource.com/script1.js", - ResourceType::SCRIPT, - 4, 0, 1, 1.0)); - reddit.resources.push_back(ResourceRow( - "", - "http://reddit-resource.com/script2.js", - ResourceType::SCRIPT, - 2, 0, 0, 2.1)); + reddit.resources + .push_back(ResourceRow(std::string(), + "http://reddit-resource.com/script1.js", + ResourceType::SCRIPT, + 4, + 0, + 1, + 1.0)); + reddit.resources + .push_back(ResourceRow(std::string(), + "http://reddit-resource.com/script2.js", + ResourceType::SCRIPT, + 2, + 0, + 0, + 2.1)); PrefetchData yahoo(PREFETCH_KEY_TYPE_URL, "http://www.yahoo.com/"); yahoo.last_visit = base::Time::FromInternalValue(3); - yahoo.resources.push_back(ResourceRow( - "", - "http://google.com/image.png", - ResourceType::IMAGE, - 20, 1, 0, 10.0)); + yahoo.resources.push_back(ResourceRow(std::string(), + "http://google.com/image.png", + ResourceType::IMAGE, + 20, + 1, + 0, + 10.0)); test_url_data_.clear(); test_url_data_.insert(std::make_pair("http://www.google.com/", google)); @@ -270,39 +287,55 @@ void ResourcePrefetchPredictorTest::InitializeSampleData() { { // Host data. PrefetchData facebook(PREFETCH_KEY_TYPE_HOST, "www.facebook.com"); facebook.last_visit = base::Time::FromInternalValue(4); - facebook.resources.push_back(ResourceRow( - "", - "http://www.facebook.com/style.css", - ResourceType::STYLESHEET, - 5, 2, 1, 1.1)); - facebook.resources.push_back(ResourceRow( - "", - "http://www.facebook.com/script.js", - ResourceType::SCRIPT, - 4, 0, 1, 2.1)); - facebook.resources.push_back(ResourceRow( - "", - "http://www.facebook.com/image.png", - ResourceType::IMAGE, - 6, 3, 0, 2.2)); - facebook.resources.push_back(ResourceRow( - "", - "http://www.facebook.com/a.font", - ResourceType::LAST_TYPE, - 2, 0, 0, 5.1)); - facebook.resources.push_back(ResourceRow( - "", - "http://www.resources.facebook.com/script.js", - ResourceType::SCRIPT, - 11, 0, 0, 8.5)); + facebook.resources + .push_back(ResourceRow(std::string(), + "http://www.facebook.com/style.css", + ResourceType::STYLESHEET, + 5, + 2, + 1, + 1.1)); + facebook.resources + .push_back(ResourceRow(std::string(), + "http://www.facebook.com/script.js", + ResourceType::SCRIPT, + 4, + 0, + 1, + 2.1)); + facebook.resources + .push_back(ResourceRow(std::string(), + "http://www.facebook.com/image.png", + ResourceType::IMAGE, + 6, + 3, + 0, + 2.2)); + facebook.resources.push_back(ResourceRow(std::string(), + "http://www.facebook.com/a.font", + ResourceType::LAST_TYPE, + 2, + 0, + 0, + 5.1)); + facebook.resources + .push_back(ResourceRow(std::string(), + "http://www.resources.facebook.com/script.js", + ResourceType::SCRIPT, + 11, + 0, + 0, + 8.5)); PrefetchData yahoo(PREFETCH_KEY_TYPE_HOST, "www.yahoo.com"); yahoo.last_visit = base::Time::FromInternalValue(5); - yahoo.resources.push_back(ResourceRow( - "", - "http://google.com/image.png", - ResourceType::IMAGE, - 20, 1, 0, 10.0)); + yahoo.resources.push_back(ResourceRow(std::string(), + "http://google.com/image.png", + ResourceType::IMAGE, + 20, + 1, + 0, + 10.0)); test_host_data_.clear(); test_host_data_.insert(std::make_pair("www.facebook.com", facebook)); @@ -343,9 +376,14 @@ TEST_F(ResourcePrefetchPredictorTest, NavigationNotRecorded) { // Single navigation but history count is low, so should not record. AddUrlToHistory("http://www.google.com", 1); - URLRequestSummary main_frame = CreateURLRequestSummary( - 1, 1, "http://www.google.com", "http://www.google.com", - ResourceType::MAIN_FRAME, "", false); + URLRequestSummary main_frame = + CreateURLRequestSummary(1, + 1, + "http://www.google.com", + "http://www.google.com", + ResourceType::MAIN_FRAME, + std::string(), + false); predictor_->RecordURLRequest(main_frame); EXPECT_EQ(1, static_cast<int>(predictor_->inflight_navigations_.size())); @@ -364,15 +402,27 @@ TEST_F(ResourcePrefetchPredictorTest, NavigationNotRecorded) { predictor_->RecordUrlResponse(resource3); PrefetchData host_data(PREFETCH_KEY_TYPE_HOST, "www.google.com"); - host_data.resources.push_back(ResourceRow( - "", "http://google.com/style1.css", - ResourceType::STYLESHEET, 1, 0, 0, 1.0)); - host_data.resources.push_back(ResourceRow( - "", "http://google.com/script1.js", - ResourceType::SCRIPT, 1, 0, 0, 2.0)); - host_data.resources.push_back(ResourceRow( - "", "http://google.com/script2.js", - ResourceType::SCRIPT, 1, 0, 0, 3.0)); + host_data.resources.push_back(ResourceRow(std::string(), + "http://google.com/style1.css", + ResourceType::STYLESHEET, + 1, + 0, + 0, + 1.0)); + host_data.resources.push_back(ResourceRow(std::string(), + "http://google.com/script1.js", + ResourceType::SCRIPT, + 1, + 0, + 0, + 2.0)); + host_data.resources.push_back(ResourceRow(std::string(), + "http://google.com/script2.js", + ResourceType::SCRIPT, + 1, + 0, + 0, + 3.0)); EXPECT_CALL(*mock_tables_, UpdateData(empty_url_data_, host_data)); predictor_->OnNavigationComplete(main_frame.navigation_id); @@ -384,9 +434,14 @@ TEST_F(ResourcePrefetchPredictorTest, NavigationUrlNotInDB) { // resources and also for number of resources saved. AddUrlToHistory("http://www.google.com", 4); - URLRequestSummary main_frame = CreateURLRequestSummary( - 1, 1, "http://www.google.com", "http://www.google.com", - ResourceType::MAIN_FRAME, "", false); + URLRequestSummary main_frame = + CreateURLRequestSummary(1, + 1, + "http://www.google.com", + "http://www.google.com", + ResourceType::MAIN_FRAME, + std::string(), + false); predictor_->RecordURLRequest(main_frame); EXPECT_EQ(1, static_cast<int>(predictor_->inflight_navigations_.size())); @@ -424,18 +479,34 @@ TEST_F(ResourcePrefetchPredictorTest, NavigationUrlNotInDB) { resource7.resource_type); PrefetchData url_data(PREFETCH_KEY_TYPE_URL, "http://www.google.com/"); - url_data.resources.push_back(ResourceRow( - "", "http://google.com/style1.css", - ResourceType::STYLESHEET, 1, 0, 0, 1.0)); - url_data.resources.push_back(ResourceRow( - "", "http://google.com/script1.js", - ResourceType::SCRIPT, 1, 0, 0, 2.0)); - url_data.resources.push_back(ResourceRow( - "", "http://google.com/script2.js", - ResourceType::SCRIPT, 1, 0, 0, 3.0)); - url_data.resources.push_back(ResourceRow( - "", "http://google.com/style2.css", - ResourceType::STYLESHEET, 1, 0, 0, 7.0)); + url_data.resources.push_back(ResourceRow(std::string(), + "http://google.com/style1.css", + ResourceType::STYLESHEET, + 1, + 0, + 0, + 1.0)); + url_data.resources.push_back(ResourceRow(std::string(), + "http://google.com/script1.js", + ResourceType::SCRIPT, + 1, + 0, + 0, + 2.0)); + url_data.resources.push_back(ResourceRow(std::string(), + "http://google.com/script2.js", + ResourceType::SCRIPT, + 1, + 0, + 0, + 3.0)); + url_data.resources.push_back(ResourceRow(std::string(), + "http://google.com/style2.css", + ResourceType::STYLESHEET, + 1, + 0, + 0, + 7.0)); EXPECT_CALL(*mock_tables_, UpdateData(url_data, empty_host_data_)); PrefetchData host_data(PREFETCH_KEY_TYPE_HOST, "www.google.com"); @@ -461,9 +532,14 @@ TEST_F(ResourcePrefetchPredictorTest, NavigationUrlInDB) { EXPECT_EQ(3, static_cast<int>(predictor_->url_table_cache_->size())); EXPECT_EQ(2, static_cast<int>(predictor_->host_table_cache_->size())); - URLRequestSummary main_frame = CreateURLRequestSummary( - 1, 1, "http://www.google.com", "http://www.google.com", - ResourceType::MAIN_FRAME, "", false); + URLRequestSummary main_frame = + CreateURLRequestSummary(1, + 1, + "http://www.google.com", + "http://www.google.com", + ResourceType::MAIN_FRAME, + std::string(), + false); predictor_->RecordURLRequest(main_frame); EXPECT_EQ(1, static_cast<int>(predictor_->inflight_navigations_.size())); @@ -501,18 +577,34 @@ TEST_F(ResourcePrefetchPredictorTest, NavigationUrlInDB) { resource7.resource_type); PrefetchData url_data(PREFETCH_KEY_TYPE_URL, "http://www.google.com/"); - url_data.resources.push_back(ResourceRow( - "", "http://google.com/style1.css", - ResourceType::STYLESHEET, 4, 2, 0, 1.0)); - url_data.resources.push_back(ResourceRow( - "", "http://google.com/script1.js", - ResourceType::SCRIPT, 1, 0, 0, 2.0)); - url_data.resources.push_back(ResourceRow( - "", "http://google.com/script4.js", - ResourceType::SCRIPT, 11, 1, 1, 2.1)); - url_data.resources.push_back(ResourceRow( - "", "http://google.com/script2.js", - ResourceType::SCRIPT, 1, 0, 0, 3.0)); + url_data.resources.push_back(ResourceRow(std::string(), + "http://google.com/style1.css", + ResourceType::STYLESHEET, + 4, + 2, + 0, + 1.0)); + url_data.resources.push_back(ResourceRow(std::string(), + "http://google.com/script1.js", + ResourceType::SCRIPT, + 1, + 0, + 0, + 2.0)); + url_data.resources.push_back(ResourceRow(std::string(), + "http://google.com/script4.js", + ResourceType::SCRIPT, + 11, + 1, + 1, + 2.1)); + url_data.resources.push_back(ResourceRow(std::string(), + "http://google.com/script2.js", + ResourceType::SCRIPT, + 1, + 0, + 0, + 3.0)); EXPECT_CALL(*mock_tables_, UpdateData(url_data, empty_host_data_)); EXPECT_CALL(*mock_tables_, @@ -520,18 +612,34 @@ TEST_F(ResourcePrefetchPredictorTest, NavigationUrlInDB) { PREFETCH_KEY_TYPE_HOST)); PrefetchData host_data(PREFETCH_KEY_TYPE_HOST, "www.google.com"); - host_data.resources.push_back(ResourceRow( - "", "http://google.com/style1.css", - ResourceType::STYLESHEET, 1, 0, 0, 1.0)); - host_data.resources.push_back(ResourceRow( - "", "http://google.com/script1.js", - ResourceType::SCRIPT, 1, 0, 0, 2.0)); - host_data.resources.push_back(ResourceRow( - "", "http://google.com/script2.js", - ResourceType::SCRIPT, 1, 0, 0, 3.0)); - host_data.resources.push_back(ResourceRow( - "", "http://google.com/style2.css", - ResourceType::STYLESHEET, 1, 0, 0, 7.0)); + host_data.resources.push_back(ResourceRow(std::string(), + "http://google.com/style1.css", + ResourceType::STYLESHEET, + 1, + 0, + 0, + 1.0)); + host_data.resources.push_back(ResourceRow(std::string(), + "http://google.com/script1.js", + ResourceType::SCRIPT, + 1, + 0, + 0, + 2.0)); + host_data.resources.push_back(ResourceRow(std::string(), + "http://google.com/script2.js", + ResourceType::SCRIPT, + 1, + 0, + 0, + 3.0)); + host_data.resources.push_back(ResourceRow(std::string(), + "http://google.com/style2.css", + ResourceType::STYLESHEET, + 1, + 0, + 0, + 7.0)); EXPECT_CALL(*mock_tables_, UpdateData(empty_url_data_, host_data)); predictor_->OnNavigationComplete(main_frame.navigation_id); @@ -552,9 +660,14 @@ TEST_F(ResourcePrefetchPredictorTest, NavigationUrlNotInDBAndDBFull) { EXPECT_EQ(3, static_cast<int>(predictor_->url_table_cache_->size())); EXPECT_EQ(2, static_cast<int>(predictor_->host_table_cache_->size())); - URLRequestSummary main_frame = CreateURLRequestSummary( - 1, 1, "http://www.nike.com", "http://www.nike.com", - ResourceType::MAIN_FRAME, "", false); + URLRequestSummary main_frame = + CreateURLRequestSummary(1, + 1, + "http://www.nike.com", + "http://www.nike.com", + ResourceType::MAIN_FRAME, + std::string(), + false); predictor_->RecordURLRequest(main_frame); EXPECT_EQ(1, static_cast<int>(predictor_->inflight_navigations_.size())); @@ -575,12 +688,20 @@ TEST_F(ResourcePrefetchPredictorTest, NavigationUrlNotInDBAndDBFull) { PREFETCH_KEY_TYPE_HOST)); PrefetchData url_data(PREFETCH_KEY_TYPE_URL, "http://www.nike.com/"); - url_data.resources.push_back(ResourceRow( - "", "http://nike.com/style1.css", - ResourceType::STYLESHEET, 1, 0, 0, 1.0)); - url_data.resources.push_back(ResourceRow( - "", "http://nike.com/image2.png", - ResourceType::IMAGE, 1, 0, 0, 2.0)); + url_data.resources.push_back(ResourceRow(std::string(), + "http://nike.com/style1.css", + ResourceType::STYLESHEET, + 1, + 0, + 0, + 1.0)); + url_data.resources.push_back(ResourceRow(std::string(), + "http://nike.com/image2.png", + ResourceType::IMAGE, + 1, + 0, + 0, + 2.0)); EXPECT_CALL(*mock_tables_, UpdateData(url_data, empty_host_data_)); PrefetchData host_data(PREFETCH_KEY_TYPE_HOST, "www.nike.com"); @@ -647,15 +768,27 @@ TEST_F(ResourcePrefetchPredictorTest, DeleteUrls) { } TEST_F(ResourcePrefetchPredictorTest, OnMainFrameRequest) { - URLRequestSummary summary1 = CreateURLRequestSummary( - 1, 1, "http://www.google.com", "http://www.google.com", - ResourceType::MAIN_FRAME, "", false); - URLRequestSummary summary2 = CreateURLRequestSummary( - 1, 2, "http://www.google.com", "http://www.google.com", - ResourceType::MAIN_FRAME, "", false); - URLRequestSummary summary3 = CreateURLRequestSummary( - 2, 1, "http://www.yahoo.com", "http://www.yahoo.com", - ResourceType::MAIN_FRAME, "", false); + URLRequestSummary summary1 = CreateURLRequestSummary(1, + 1, + "http://www.google.com", + "http://www.google.com", + ResourceType::MAIN_FRAME, + std::string(), + false); + URLRequestSummary summary2 = CreateURLRequestSummary(1, + 2, + "http://www.google.com", + "http://www.google.com", + ResourceType::MAIN_FRAME, + std::string(), + false); + URLRequestSummary summary3 = CreateURLRequestSummary(2, + 1, + "http://www.yahoo.com", + "http://www.yahoo.com", + ResourceType::MAIN_FRAME, + std::string(), + false); predictor_->OnMainFrameRequest(summary1); EXPECT_EQ(1, static_cast<int>(predictor_->inflight_navigations_.size())); @@ -665,12 +798,20 @@ TEST_F(ResourcePrefetchPredictorTest, OnMainFrameRequest) { EXPECT_EQ(3, static_cast<int>(predictor_->inflight_navigations_.size())); // Insert anther with same navigation id. It should replace. - URLRequestSummary summary4 = CreateURLRequestSummary( - 1, 1, "http://www.nike.com", "http://www.nike.com", - ResourceType::MAIN_FRAME, "", false); - URLRequestSummary summary5 = CreateURLRequestSummary( - 1, 2, "http://www.google.com", "http://www.google.com", - ResourceType::MAIN_FRAME, "", false); + URLRequestSummary summary4 = CreateURLRequestSummary(1, + 1, + "http://www.nike.com", + "http://www.nike.com", + ResourceType::MAIN_FRAME, + std::string(), + false); + URLRequestSummary summary5 = CreateURLRequestSummary(1, + 2, + "http://www.google.com", + "http://www.google.com", + ResourceType::MAIN_FRAME, + std::string(), + false); predictor_->OnMainFrameRequest(summary4); EXPECT_EQ(3, static_cast<int>(predictor_->inflight_navigations_.size())); @@ -681,9 +822,13 @@ TEST_F(ResourcePrefetchPredictorTest, OnMainFrameRequest) { predictor_->OnMainFrameRequest(summary5); EXPECT_EQ(3, static_cast<int>(predictor_->inflight_navigations_.size())); - URLRequestSummary summary6 = CreateURLRequestSummary( - 3, 1, "http://www.shoes.com", "http://www.shoes.com", - ResourceType::MAIN_FRAME, "", false); + URLRequestSummary summary6 = CreateURLRequestSummary(3, + 1, + "http://www.shoes.com", + "http://www.shoes.com", + ResourceType::MAIN_FRAME, + std::string(), + false); predictor_->OnMainFrameRequest(summary6); EXPECT_EQ(3, static_cast<int>(predictor_->inflight_navigations_.size())); @@ -696,15 +841,27 @@ TEST_F(ResourcePrefetchPredictorTest, OnMainFrameRequest) { } TEST_F(ResourcePrefetchPredictorTest, OnMainFrameRedirect) { - URLRequestSummary summary1 = CreateURLRequestSummary( - 1, 1, "http://www.google.com", "http://www.google.com", - ResourceType::MAIN_FRAME, "", false); - URLRequestSummary summary2 = CreateURLRequestSummary( - 1, 2, "http://www.google.com", "http://www.google.com", - ResourceType::MAIN_FRAME, "", false); - URLRequestSummary summary3 = CreateURLRequestSummary( - 2, 1, "http://www.yahoo.com", "http://www.yahoo.com", - ResourceType::MAIN_FRAME, "", false); + URLRequestSummary summary1 = CreateURLRequestSummary(1, + 1, + "http://www.google.com", + "http://www.google.com", + ResourceType::MAIN_FRAME, + std::string(), + false); + URLRequestSummary summary2 = CreateURLRequestSummary(1, + 2, + "http://www.google.com", + "http://www.google.com", + ResourceType::MAIN_FRAME, + std::string(), + false); + URLRequestSummary summary3 = CreateURLRequestSummary(2, + 1, + "http://www.yahoo.com", + "http://www.yahoo.com", + ResourceType::MAIN_FRAME, + std::string(), + false); predictor_->OnMainFrameRedirect(summary1); EXPECT_TRUE(predictor_->inflight_navigations_.empty()); @@ -731,9 +888,14 @@ TEST_F(ResourcePrefetchPredictorTest, OnSubresourceResponse) { EXPECT_TRUE(predictor_->inflight_navigations_.empty()); // Add an inflight navigation. - URLRequestSummary main_frame1 = CreateURLRequestSummary( - 1, 1, "http://www.google.com", "http://www.google.com", - ResourceType::MAIN_FRAME, "", false); + URLRequestSummary main_frame1 = + CreateURLRequestSummary(1, + 1, + "http://www.google.com", + "http://www.google.com", + ResourceType::MAIN_FRAME, + std::string(), + false); predictor_->OnMainFrameRequest(main_frame1); EXPECT_EQ(1, static_cast<int>(predictor_->inflight_navigations_.size())); diff --git a/chrome/browser/predictors/resource_prefetcher_unittest.cc b/chrome/browser/predictors/resource_prefetcher_unittest.cc index 9d5ef5a..865c8af 100644 --- a/chrome/browser/predictors/resource_prefetcher_unittest.cc +++ b/chrome/browser/predictors/resource_prefetcher_unittest.cc @@ -111,7 +111,8 @@ class ResourcePrefetcherTest : public testing::Test { void OnReceivedRedirect(const std::string& url) { - prefetcher_->OnReceivedRedirect(GetInFlightRequest(url), GURL(""), NULL); + prefetcher_->OnReceivedRedirect( + GetInFlightRequest(url), GURL(std::string()), NULL); } void OnAuthRequired(const std::string& url) { prefetcher_->OnAuthRequired(GetInFlightRequest(url), NULL); diff --git a/chrome/browser/prefs/command_line_pref_store_unittest.cc b/chrome/browser/prefs/command_line_pref_store_unittest.cc index 5d2c939..1e23383 100644 --- a/chrome/browser/prefs/command_line_pref_store_unittest.cc +++ b/chrome/browser/prefs/command_line_pref_store_unittest.cc @@ -116,7 +116,7 @@ TEST(CommandLinePrefStoreTest, MultipleSwitches) { ASSERT_EQ(Value::TYPE_DICTIONARY, value->GetType()); ProxyConfigDictionary dict(static_cast<const DictionaryValue*>(value)); - std::string string_result = ""; + std::string string_result; ASSERT_TRUE(dict.GetProxyServer(&string_result)); EXPECT_EQ("proxy", string_result); @@ -172,9 +172,9 @@ TEST(CommandLinePrefStoreTest, ManualProxyModeInference) { store2->VerifyProxyMode(ProxyPrefs::MODE_PAC_SCRIPT); CommandLine cl3(CommandLine::NO_PROGRAM); - cl3.AppendSwitchASCII(switches::kProxyServer, ""); + cl3.AppendSwitchASCII(switches::kProxyServer, std::string()); scoped_refptr<TestCommandLinePrefStore> store3 = - new TestCommandLinePrefStore(&cl3); + new TestCommandLinePrefStore(&cl3); store3->VerifyProxyMode(ProxyPrefs::MODE_DIRECT); } diff --git a/chrome/browser/prefs/proxy_config_dictionary.cc b/chrome/browser/prefs/proxy_config_dictionary.cc index a99fa7c..b6db822 100644 --- a/chrome/browser/prefs/proxy_config_dictionary.cc +++ b/chrome/browser/prefs/proxy_config_dictionary.cc @@ -67,12 +67,20 @@ bool ProxyConfigDictionary::HasBypassList() const { // static DictionaryValue* ProxyConfigDictionary::CreateDirect() { - return CreateDictionary(ProxyPrefs::MODE_DIRECT, "", false, "", ""); + return CreateDictionary(ProxyPrefs::MODE_DIRECT, + std::string(), + false, + std::string(), + std::string()); } // static DictionaryValue* ProxyConfigDictionary::CreateAutoDetect() { - return CreateDictionary(ProxyPrefs::MODE_AUTO_DETECT, "", false, "", ""); + return CreateDictionary(ProxyPrefs::MODE_AUTO_DETECT, + std::string(), + false, + std::string(), + std::string()); } // static @@ -80,7 +88,10 @@ DictionaryValue* ProxyConfigDictionary::CreatePacScript( const std::string& pac_url, bool pac_mandatory) { return CreateDictionary(ProxyPrefs::MODE_PAC_SCRIPT, - pac_url, pac_mandatory, "", ""); + pac_url, + pac_mandatory, + std::string(), + std::string()); } // static @@ -88,8 +99,11 @@ DictionaryValue* ProxyConfigDictionary::CreateFixedServers( const std::string& proxy_server, const std::string& bypass_list) { if (!proxy_server.empty()) { - return CreateDictionary( - ProxyPrefs::MODE_FIXED_SERVERS, "", false, proxy_server, bypass_list); + return CreateDictionary(ProxyPrefs::MODE_FIXED_SERVERS, + std::string(), + false, + proxy_server, + bypass_list); } else { return CreateDirect(); } @@ -97,7 +111,11 @@ DictionaryValue* ProxyConfigDictionary::CreateFixedServers( // static DictionaryValue* ProxyConfigDictionary::CreateSystem() { - return CreateDictionary(ProxyPrefs::MODE_SYSTEM, "", false, "", ""); + return CreateDictionary(ProxyPrefs::MODE_SYSTEM, + std::string(), + false, + std::string(), + std::string()); } // static diff --git a/chrome/browser/prefs/proxy_policy_unittest.cc b/chrome/browser/prefs/proxy_policy_unittest.cc index ec51894..512e514 100644 --- a/chrome/browser/prefs/proxy_policy_unittest.cc +++ b/chrome/browser/prefs/proxy_policy_unittest.cc @@ -68,9 +68,9 @@ void assertBypassList(const ProxyConfigDictionary& dict, void assertProxyModeWithoutParams(const ProxyConfigDictionary& dict, ProxyPrefs::ProxyMode proxy_mode) { assertProxyMode(dict, proxy_mode); - assertProxyServer(dict, ""); - assertPacUrl(dict, ""); - assertBypassList(dict, ""); + assertProxyServer(dict, std::string()); + assertPacUrl(dict, std::string()); + assertBypassList(dict, std::string()); } } // namespace @@ -130,7 +130,7 @@ TEST_F(ProxyPolicyTest, OverridesCommandLineOptions) { ProxyConfigDictionary dict(prefs->GetDictionary(prefs::kProxy)); assertProxyMode(dict, ProxyPrefs::MODE_FIXED_SERVERS); assertProxyServer(dict, "789"); - assertPacUrl(dict, ""); + assertPacUrl(dict, std::string()); assertBypassList(dict, "123"); // Try a second time time with the managed PrefStore in place, the @@ -140,7 +140,7 @@ TEST_F(ProxyPolicyTest, OverridesCommandLineOptions) { ProxyConfigDictionary dict2(prefs->GetDictionary(prefs::kProxy)); assertProxyMode(dict2, ProxyPrefs::MODE_FIXED_SERVERS); assertProxyServer(dict2, "ghi"); - assertPacUrl(dict2, ""); + assertPacUrl(dict2, std::string()); assertBypassList(dict2, "abc"); } @@ -160,7 +160,7 @@ TEST_F(ProxyPolicyTest, OverridesUnrelatedCommandLineOptions) { ProxyConfigDictionary dict(prefs->GetDictionary(prefs::kProxy)); assertProxyMode(dict, ProxyPrefs::MODE_FIXED_SERVERS); assertProxyServer(dict, "789"); - assertPacUrl(dict, ""); + assertPacUrl(dict, std::string()); assertBypassList(dict, "123"); // Try a second time time with the managed PrefStore in place, the diff --git a/chrome/browser/prefs/session_startup_pref.cc b/chrome/browser/prefs/session_startup_pref.cc index d822cc0..fbbf62f 100644 --- a/chrome/browser/prefs/session_startup_pref.cc +++ b/chrome/browser/prefs/session_startup_pref.cc @@ -45,7 +45,7 @@ void URLListToPref(const base::ListValue* url_list, SessionStartupPref* pref) { for (size_t i = 0; i < url_list->GetSize(); ++i) { std::string url_text; if (url_list->GetString(i, &url_text)) { - GURL fixed_url = URLFixerUpper::FixupURL(url_text, ""); + GURL fixed_url = URLFixerUpper::FixupURL(url_text, std::string()); pref->urls.push_back(fixed_url); } } diff --git a/chrome/browser/prerender/prerender_contents.cc b/chrome/browser/prerender/prerender_contents.cc index ff32646..508ec89 100644 --- a/chrome/browser/prerender/prerender_contents.cc +++ b/chrome/browser/prerender/prerender_contents.cc @@ -465,8 +465,8 @@ WebContents* PrerenderContents::CreateWebContents( // TODO(ajwong): Remove the temporary map once prerendering is aware of // multiple session storage namespaces per tab. content::SessionStorageNamespaceMap session_storage_namespace_map; - session_storage_namespace_map[""] = session_storage_namespace; - return WebContents::CreateWithSessionStorage( + session_storage_namespace_map[std::string()] = session_storage_namespace; + return WebContents::CreateWithSessionStorage( WebContents::CreateParams(profile_), session_storage_namespace_map); } diff --git a/chrome/browser/prerender/prerender_histograms.cc b/chrome/browser/prerender/prerender_histograms.cc index d836cf8..325c00e 100644 --- a/chrome/browser/prerender/prerender_histograms.cc +++ b/chrome/browser/prerender/prerender_histograms.cc @@ -92,9 +92,9 @@ bool OriginIsOmnibox(Origin origin) { #define PREFIXED_HISTOGRAM_INTERNAL(origin, experiment, wash, HISTOGRAM, \ histogram_name) { \ { \ - /* Do not rename. HISTOGRAM expects a local variable "name". */ \ - std::string name = ComposeHistogramName("", histogram_name); \ - HISTOGRAM; \ + /* Do not rename. HISTOGRAM expects a local variable "name". */ \ + std::string name = ComposeHistogramName(std::string(), histogram_name); \ + HISTOGRAM; \ } \ /* Do not rename. HISTOGRAM expects a local variable "name". */ \ std::string name = GetHistogramName(origin, experiment, wash, \ diff --git a/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc b/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc index 299567a..131b45a 100644 --- a/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc +++ b/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc @@ -66,7 +66,7 @@ CloudPrintSetupFlow* CloudPrintSetupFlow::OpenDialog( chrome::GetActiveDesktop()); // Set the arguments for showing the gaia login page. DictionaryValue args; - args.SetString("user", ""); + args.SetString("user", std::string()); args.SetInteger("error", 0); args.SetBoolean("editable_user", true); diff --git a/chrome/browser/printing/cloud_print/cloud_print_setup_source.cc b/chrome/browser/printing/cloud_print/cloud_print_setup_source.cc index 7bb6d73..8c18da8 100644 --- a/chrome/browser/printing/cloud_print/cloud_print_setup_source.cc +++ b/chrome/browser/printing/cloud_print/cloud_print_setup_source.cc @@ -87,7 +87,7 @@ void CloudPrintSetupSource::StartDataRequest( // None of the strings used here currently have sync-specific wording in // them. There is a unit test to catch if that happens. - dict->SetString("introduction", ""); + dict->SetString("introduction", std::string()); AddString(dict, "signinprefix", IDS_SYNC_LOGIN_SIGNIN_PREFIX); AddString(dict, "signinsuffix", IDS_SYNC_LOGIN_SIGNIN_SUFFIX); AddString(dict, "cannotbeblank", IDS_SYNC_CANNOT_BE_BLANK); diff --git a/chrome/browser/printing/print_dialog_cloud_interative_uitest.cc b/chrome/browser/printing/print_dialog_cloud_interative_uitest.cc index 2529a1d..eb8eef4 100644 --- a/chrome/browser/printing/print_dialog_cloud_interative_uitest.cc +++ b/chrome/browser/printing/print_dialog_cloud_interative_uitest.cc @@ -251,7 +251,7 @@ net::URLRequestJob* PrintDialogCloudTest::Factory( return new net::URLRequestTestJob(request, network_delegate, net::URLRequestTestJob::test_headers(), - "", + std::string(), true); } diff --git a/chrome/browser/printing/print_dialog_cloud_unittest.cc b/chrome/browser/printing/print_dialog_cloud_unittest.cc index 217fa53..ce50f28 100644 --- a/chrome/browser/printing/print_dialog_cloud_unittest.cc +++ b/chrome/browser/printing/print_dialog_cloud_unittest.cc @@ -270,7 +270,7 @@ TEST_F(CloudPrintDataSenderTest, NoData) { TEST_F(CloudPrintDataSenderTest, EmptyData) { EXPECT_CALL(*mock_helper_, CallJavascriptFunction(_, _, _)).Times(0); - std::string data(""); + std::string data; scoped_refptr<CloudPrintDataSender> print_data_sender( CreateSender(base::RefCountedString::TakeString(&data))); base::FilePath test_data_file_name = GetTestDataFileName(); diff --git a/chrome/browser/profiles/gaia_info_update_service_factory.cc b/chrome/browser/profiles/gaia_info_update_service_factory.cc index 88ef612..f8f46f7 100644 --- a/chrome/browser/profiles/gaia_info_update_service_factory.cc +++ b/chrome/browser/profiles/gaia_info_update_service_factory.cc @@ -39,7 +39,8 @@ void GAIAInfoUpdateServiceFactory::RegisterUserPrefs( PrefRegistrySyncable* prefs) { prefs->RegisterInt64Pref(prefs::kProfileGAIAInfoUpdateTime, 0, PrefRegistrySyncable::UNSYNCABLE_PREF); - prefs->RegisterStringPref(prefs::kProfileGAIAInfoPictureURL, "", + prefs->RegisterStringPref(prefs::kProfileGAIAInfoPictureURL, + std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); } diff --git a/chrome/browser/profiles/gaia_info_update_service_unittest.cc b/chrome/browser/profiles/gaia_info_update_service_unittest.cc index dd85970..37dfdd7 100644 --- a/chrome/browser/profiles/gaia_info_update_service_unittest.cc +++ b/chrome/browser/profiles/gaia_info_update_service_unittest.cc @@ -184,7 +184,8 @@ TEST_F(GAIAInfoUpdateServiceTest, LogOut) { GAIAInfoUpdateService service(profile()); EXPECT_FALSE(service.GetCachedPictureURL().empty()); // Log out. - profile()->GetPrefs()->SetString(prefs::kGoogleServicesUsername, ""); + profile()->GetPrefs() + ->SetString(prefs::kGoogleServicesUsername, std::string()); // Verify that the GAIA name and picture, and picture URL are unset. EXPECT_TRUE(GetCache()->GetGAIANameOfProfileAtIndex(0).empty()); @@ -193,7 +194,8 @@ TEST_F(GAIAInfoUpdateServiceTest, LogOut) { } TEST_F(GAIAInfoUpdateServiceTest, LogIn) { - profile()->GetPrefs()->SetString(prefs::kGoogleServicesUsername, ""); + profile()->GetPrefs() + ->SetString(prefs::kGoogleServicesUsername, std::string()); GAIAInfoUpdateServiceMock service(profile()); // Log in. diff --git a/chrome/browser/profiles/profile_downloader_unittest.cc b/chrome/browser/profiles/profile_downloader_unittest.cc index 2e47968..5346694 100644 --- a/chrome/browser/profiles/profile_downloader_unittest.cc +++ b/chrome/browser/profiles/profile_downloader_unittest.cc @@ -68,25 +68,25 @@ TEST_F(ProfileDownloaderTest, ParseData) { true); // Data with only name. - VerifyWithNameAndURL("Pat Smith", "", "", true); + VerifyWithNameAndURL("Pat Smith", std::string(), std::string(), true); // Data with only URL. VerifyWithNameAndURL( - "", + std::string(), "https://example.com/--Abc/AAAAAAAAAAI/AAAAAAAAACQ/Efg/photo.jpg", "https://example.com/--Abc/AAAAAAAAAAI/AAAAAAAAACQ/Efg/s32-c/photo.jpg", true); // Data without name or URL. - VerifyWithNameAndURL("", "", "", false); + VerifyWithNameAndURL(std::string(), std::string(), std::string(), false); // Data with an invalid URL. - VerifyWithNameAndURL( "", "invalid url", "", false); + VerifyWithNameAndURL(std::string(), "invalid url", std::string(), false); } TEST_F(ProfileDownloaderTest, DefaultURL) { // Empty URL should be default photo - EXPECT_TRUE(ProfileDownloader::IsDefaultProfileImageURL("")); + EXPECT_TRUE(ProfileDownloader::IsDefaultProfileImageURL(std::string())); // Picasa default photo EXPECT_TRUE(ProfileDownloader::IsDefaultProfileImageURL( "https://example.com/-4/AAAAAAAAAAA/AAAAAAAAAAE/G/s64-c/photo.jpg")); diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc index f99cbba..a068fb3 100644 --- a/chrome/browser/profiles/profile_impl.cc +++ b/chrome/browser/profiles/profile_impl.cc @@ -289,9 +289,8 @@ void ProfileImpl::RegisterUserPrefs(PrefRegistrySyncable* registry) { registry->RegisterIntegerPref(prefs::kProfileAvatarIndex, -1, PrefRegistrySyncable::SYNCABLE_PREF); - registry->RegisterStringPref(prefs::kProfileName, - "", - PrefRegistrySyncable::SYNCABLE_PREF); + registry->RegisterStringPref( + prefs::kProfileName, std::string(), PrefRegistrySyncable::SYNCABLE_PREF); registry->RegisterBooleanPref(prefs::kProfileIsManaged, false, PrefRegistrySyncable::SYNCABLE_PREF); diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc index 59f2e69..69da963 100644 --- a/chrome/browser/profiles/profile_manager.cc +++ b/chrome/browser/profiles/profile_manager.cc @@ -890,7 +890,7 @@ void ProfileManager::CreateMultiProfileAsync( // static void ProfileManager::RegisterPrefs(PrefRegistrySimple* registry) { - registry->RegisterStringPref(prefs::kProfileLastUsed, ""); + registry->RegisterStringPref(prefs::kProfileLastUsed, std::string()); registry->RegisterIntegerPref(prefs::kProfilesNumCreated, 1); registry->RegisterListPref(prefs::kProfilesLastActive); } diff --git a/chrome/browser/referrer_policy_browsertest.cc b/chrome/browser/referrer_policy_browsertest.cc index 83a32b4..0b9f40f 100644 --- a/chrome/browser/referrer_policy_browsertest.cc +++ b/chrome/browser/referrer_policy_browsertest.cc @@ -376,7 +376,7 @@ IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, History) { EXPECT_ORIGIN_AS_REFERRER); // Navigate to C. - ui_test_utils::NavigateToURL(browser(), test_server_->GetURL("")); + ui_test_utils::NavigateToURL(browser(), test_server_->GetURL(std::string())); string16 expected_title = GetExpectedTitle(start_url, EXPECT_ORIGIN_AS_REFERRER); diff --git a/chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.cc b/chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.cc index f39e75a..be2ce33 100644 --- a/chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.cc +++ b/chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.cc @@ -316,7 +316,7 @@ int32_t PepperFlashClipboardMessageFilter::OnMsgWriteData( scw.WriteText(UTF8ToUTF16(data[i])); break; case PP_FLASH_CLIPBOARD_FORMAT_HTML: - scw.WriteHTML(UTF8ToUTF16(data[i]), ""); + scw.WriteHTML(UTF8ToUTF16(data[i]), std::string()); break; case PP_FLASH_CLIPBOARD_FORMAT_RTF: scw.WriteRTF(data[i]); diff --git a/chrome/browser/safe_browsing/browser_feature_extractor.cc b/chrome/browser/safe_browsing/browser_feature_extractor.cc index 142f375..a40c66d 100644 --- a/chrome/browser/safe_browsing/browser_feature_extractor.cc +++ b/chrome/browser/safe_browsing/browser_feature_extractor.cc @@ -208,8 +208,8 @@ void BrowserFeatureExtractor::ExtractFeatures(const BrowseInfo* info, // 2) The first url on the same host as the candidate url (assuming that // it's different from the candidate url). if (url_index != -1) { - AddNavigationFeatures("", controller, url_index, info->url_redirects, - request); + AddNavigationFeatures( + std::string(), controller, url_index, info->url_redirects, request); } if (first_host_index != -1) { AddNavigationFeatures(features::kHostPrefix, diff --git a/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc b/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc index 74ec857..ec8b4e3 100644 --- a/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc +++ b/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc @@ -635,11 +635,11 @@ TEST_F(ClientSideDetectionHostTest, UpdateIPHostMap) { BrowseInfo* browse_info = GetBrowseInfo(); // Empty IP or host are skipped - UpdateIPHostMap("250.10.10.10", ""); + UpdateIPHostMap("250.10.10.10", std::string()); ASSERT_EQ(0U, browse_info->ips.size()); - UpdateIPHostMap("", "google.com/"); + UpdateIPHostMap(std::string(), "google.com/"); ASSERT_EQ(0U, browse_info->ips.size()); - UpdateIPHostMap("", ""); + UpdateIPHostMap(std::string(), std::string()); ASSERT_EQ(0U, browse_info->ips.size()); std::set<std::string> expected_hosts; diff --git a/chrome/browser/safe_browsing/client_side_detection_service_unittest.cc b/chrome/browser/safe_browsing/client_side_detection_service_unittest.cc index f5fd98b..ed533604 100644 --- a/chrome/browser/safe_browsing/client_side_detection_service_unittest.cc +++ b/chrome/browser/safe_browsing/client_side_detection_service_unittest.cc @@ -252,9 +252,8 @@ TEST_F(ClientSideDetectionServiceTest, FetchModelTest) { Mock::VerifyAndClearExpectations(&service); // Empty model file. - SetModelFetchResponse("", true /* success */); - EXPECT_CALL(service, EndFetchModel( - ClientSideDetectionService::MODEL_EMPTY)) + SetModelFetchResponse(std::string(), true /* success */); + EXPECT_CALL(service, EndFetchModel(ClientSideDetectionService::MODEL_EMPTY)) .WillOnce(QuitCurrentMessageLoop()); service.StartFetchModel(); msg_loop_.Run(); // EndFetchModel will quit the message loop. @@ -576,7 +575,7 @@ TEST_F(ClientSideDetectionServiceTest, IsBadIpAddress) { ClientSideDetectionService::SetBadSubnets( model, &(csd_service_->bad_subnets_)); EXPECT_FALSE(csd_service_->IsBadIpAddress("blabla")); - EXPECT_FALSE(csd_service_->IsBadIpAddress("")); + EXPECT_FALSE(csd_service_->IsBadIpAddress(std::string())); EXPECT_TRUE(csd_service_->IsBadIpAddress( "2620:0:1000:3103:21a:a0ff:fe10:786e")); diff --git a/chrome/browser/safe_browsing/download_protection_service_unittest.cc b/chrome/browser/safe_browsing/download_protection_service_unittest.cc index e8da2ee..af98856 100644 --- a/chrome/browser/safe_browsing/download_protection_service_unittest.cc +++ b/chrome/browser/safe_browsing/download_protection_service_unittest.cc @@ -390,7 +390,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadFetchFailed) { net::FakeURLFetcherFactory factory(NULL); // HTTP request will fail. factory.SetFakeResponse( - DownloadProtectionService::GetDownloadRequestUrl(), "", false); + DownloadProtectionService::GetDownloadRequestUrl(), std::string(), false); base::FilePath a_tmp(FILE_PATH_LITERAL("a.tmp")); base::FilePath a_exe(FILE_PATH_LITERAL("a.exe")); diff --git a/chrome/browser/safe_browsing/malware_details.cc b/chrome/browser/safe_browsing/malware_details.cc index 41cf690..7eb336d 100644 --- a/chrome/browser/safe_browsing/malware_details.cc +++ b/chrome/browser/safe_browsing/malware_details.cc @@ -178,16 +178,16 @@ void MalwareDetails::StartCollection() { } // Add the nodes, starting from the page url. - AddUrl(page_url, GURL(), "", NULL); + AddUrl(page_url, GURL(), std::string(), NULL); // Add the resource_url and its original url, if non-empty and different. if (!resource_.original_url.is_empty() && resource_.url != resource_.original_url) { // Add original_url, as the parent of resource_url. - AddUrl(resource_.original_url, GURL(), "", NULL); - AddUrl(resource_.url, resource_.original_url, "", NULL); + AddUrl(resource_.original_url, GURL(), std::string(), NULL); + AddUrl(resource_.url, resource_.original_url, std::string(), NULL); } else { - AddUrl(resource_.url, GURL(), "", NULL); + AddUrl(resource_.url, GURL(), std::string(), NULL); } // Add the redirect urls, if non-empty. The redirect urls do not include the @@ -201,13 +201,13 @@ void MalwareDetails::StartCollection() { } // Set the previous redirect url as the parent of the next one for (unsigned int i = 0; i < resource_.redirect_urls.size(); ++i) { - AddUrl(resource_.redirect_urls[i], parent_url, "", NULL); + AddUrl(resource_.redirect_urls[i], parent_url, std::string(), NULL); parent_url = resource_.redirect_urls[i]; } // Add the referrer url. if (nav_entry && !referrer_url.is_empty()) { - AddUrl(referrer_url, GURL(), "", NULL); + AddUrl(referrer_url, GURL(), std::string(), NULL); } // Get URLs of frames, scripts etc from the DOM. @@ -287,7 +287,7 @@ void MalwareDetails::OnRedirectionCollectionReady() { void MalwareDetails::AddRedirectUrlList(const std::vector<GURL>& urls) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); for (size_t i = 0; i < urls.size()-1; ++i) { - AddUrl(urls[i], urls[i+1], "", NULL); + AddUrl(urls[i], urls[i + 1], std::string(), NULL); } } diff --git a/chrome/browser/safe_browsing/ping_manager.cc b/chrome/browser/safe_browsing/ping_manager.cc index 6e73985..56580d00 100644 --- a/chrome/browser/safe_browsing/ping_manager.cc +++ b/chrome/browser/safe_browsing/ping_manager.cc @@ -113,7 +113,7 @@ GURL SafeBrowsingPingManager::SafeBrowsingHitUrl( threat_type == SB_THREAT_TYPE_BINARY_MALWARE_HASH || threat_type == SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL); std::string url = SafeBrowsingProtocolManagerHelper::ComposeUrl( - url_prefix_, "report", client_name_, version_, ""); + url_prefix_, "report", client_name_, version_, std::string()); std::string threat_list = "none"; switch (threat_type) { case SB_THREAT_TYPE_URL_MALWARE: diff --git a/chrome/browser/safe_browsing/protocol_manager_unittest.cc b/chrome/browser/safe_browsing/protocol_manager_unittest.cc index 0bd9c3a..ca89ce5 100644 --- a/chrome/browser/safe_browsing/protocol_manager_unittest.cc +++ b/chrome/browser/safe_browsing/protocol_manager_unittest.cc @@ -378,7 +378,7 @@ TEST_F(SafeBrowsingProtocolManagerTest, ExistingDatabase) { url_fetcher->set_status(net::URLRequestStatus()); url_fetcher->set_response_code(200); - url_fetcher->SetResponseString(""); + url_fetcher->SetResponseString(std::string()); url_fetcher->delegate()->OnURLFetchComplete(url_fetcher); EXPECT_TRUE(pm->IsUpdateScheduled()); @@ -424,7 +424,7 @@ TEST_F(SafeBrowsingProtocolManagerTest, UpdateResponseBadBodyBackupSuccess) { // Respond to the backup successfully. backup_url_fetcher->set_status(net::URLRequestStatus()); backup_url_fetcher->set_response_code(200); - backup_url_fetcher->SetResponseString(""); + backup_url_fetcher->SetResponseString(std::string()); backup_url_fetcher->delegate()->OnURLFetchComplete(backup_url_fetcher); EXPECT_TRUE(pm->IsUpdateScheduled()); @@ -460,7 +460,7 @@ TEST_F(SafeBrowsingProtocolManagerTest, UpdateResponseHttpErrorBackupError) { // Go ahead and respond to it. url_fetcher->set_status(net::URLRequestStatus()); url_fetcher->set_response_code(404); - url_fetcher->SetResponseString(""); + url_fetcher->SetResponseString(std::string()); url_fetcher->delegate()->OnURLFetchComplete(url_fetcher); // There should now be a backup request. @@ -471,7 +471,7 @@ TEST_F(SafeBrowsingProtocolManagerTest, UpdateResponseHttpErrorBackupError) { // Respond to the backup unsuccessfully. backup_url_fetcher->set_status(net::URLRequestStatus()); backup_url_fetcher->set_response_code(404); - backup_url_fetcher->SetResponseString(""); + backup_url_fetcher->SetResponseString(std::string()); backup_url_fetcher->delegate()->OnURLFetchComplete(backup_url_fetcher); EXPECT_TRUE(pm->IsUpdateScheduled()); @@ -507,7 +507,7 @@ TEST_F(SafeBrowsingProtocolManagerTest, UpdateResponseHttpErrorBackupSuccess) { // Go ahead and respond to it. url_fetcher->set_status(net::URLRequestStatus()); url_fetcher->set_response_code(404); - url_fetcher->SetResponseString(""); + url_fetcher->SetResponseString(std::string()); url_fetcher->delegate()->OnURLFetchComplete(url_fetcher); // There should now be a backup request. @@ -519,7 +519,7 @@ TEST_F(SafeBrowsingProtocolManagerTest, UpdateResponseHttpErrorBackupSuccess) { // Respond to the backup successfully. backup_url_fetcher->set_status(net::URLRequestStatus()); backup_url_fetcher->set_response_code(200); - backup_url_fetcher->SetResponseString(""); + backup_url_fetcher->SetResponseString(std::string()); backup_url_fetcher->delegate()->OnURLFetchComplete(backup_url_fetcher); EXPECT_TRUE(pm->IsUpdateScheduled()); @@ -555,7 +555,7 @@ TEST_F(SafeBrowsingProtocolManagerTest, UpdateResponseHttpErrorBackupTimeout) { // Go ahead and respond to it. url_fetcher->set_status(net::URLRequestStatus()); url_fetcher->set_response_code(404); - url_fetcher->SetResponseString(""); + url_fetcher->SetResponseString(std::string()); url_fetcher->delegate()->OnURLFetchComplete(url_fetcher); // There should now be a backup request. @@ -617,7 +617,7 @@ TEST_F(SafeBrowsingProtocolManagerTest, // Respond to the backup unsuccessfully. backup_url_fetcher->set_status(net::URLRequestStatus()); backup_url_fetcher->set_response_code(404); - backup_url_fetcher->SetResponseString(""); + backup_url_fetcher->SetResponseString(std::string()); backup_url_fetcher->delegate()->OnURLFetchComplete(backup_url_fetcher); EXPECT_TRUE(pm->IsUpdateScheduled()); @@ -665,7 +665,7 @@ TEST_F(SafeBrowsingProtocolManagerTest, // Respond to the backup unsuccessfully. backup_url_fetcher->set_status(net::URLRequestStatus()); backup_url_fetcher->set_response_code(200); - backup_url_fetcher->SetResponseString(""); + backup_url_fetcher->SetResponseString(std::string()); backup_url_fetcher->delegate()->OnURLFetchComplete(backup_url_fetcher); EXPECT_TRUE(pm->IsUpdateScheduled()); @@ -713,7 +713,7 @@ TEST_F(SafeBrowsingProtocolManagerTest, // Respond to the backup unsuccessfully. backup_url_fetcher->set_status(net::URLRequestStatus()); backup_url_fetcher->set_response_code(404); - backup_url_fetcher->SetResponseString(""); + backup_url_fetcher->SetResponseString(std::string()); backup_url_fetcher->delegate()->OnURLFetchComplete(backup_url_fetcher); EXPECT_TRUE(pm->IsUpdateScheduled()); @@ -762,7 +762,7 @@ TEST_F(SafeBrowsingProtocolManagerTest, // Respond to the backup unsuccessfully. backup_url_fetcher->set_status(net::URLRequestStatus()); backup_url_fetcher->set_response_code(200); - backup_url_fetcher->SetResponseString(""); + backup_url_fetcher->SetResponseString(std::string()); backup_url_fetcher->delegate()->OnURLFetchComplete(backup_url_fetcher); EXPECT_TRUE(pm->IsUpdateScheduled()); @@ -807,7 +807,7 @@ TEST_F(SafeBrowsingProtocolManagerTest, UpdateResponseTimeoutBackupSuccess) { // Respond to the backup unsuccessfully. backup_url_fetcher->set_status(net::URLRequestStatus()); backup_url_fetcher->set_response_code(200); - backup_url_fetcher->SetResponseString(""); + backup_url_fetcher->SetResponseString(std::string()); backup_url_fetcher->delegate()->OnURLFetchComplete(backup_url_fetcher); EXPECT_TRUE(pm->IsUpdateScheduled()); @@ -888,7 +888,7 @@ TEST_F(SafeBrowsingProtocolManagerTest, EmptyRedirectResponse) { chunk_url_fetcher, "https://redirect-server.example.com/path"); chunk_url_fetcher->set_status(net::URLRequestStatus()); chunk_url_fetcher->set_response_code(200); - chunk_url_fetcher->SetResponseString(""); + chunk_url_fetcher->SetResponseString(std::string()); chunk_url_fetcher->delegate()->OnURLFetchComplete(chunk_url_fetcher); EXPECT_TRUE(pm->IsUpdateScheduled()); diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc index 3d0f2d9..032d5ec 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc @@ -1004,8 +1004,8 @@ void SafeBrowsingBlockingPageV2::PopulateMalwareStringDictionary( if (!CanShowMalwareDetailsOption()) { strings->SetBoolean(kDisplayCheckBox, false); - strings->SetString("confirm_text", ""); - strings->SetString(kBoxChecked, ""); + strings->SetString("confirm_text", std::string()); + strings->SetString(kBoxChecked, std::string()); } else { // Show the checkbox for sending malware details. strings->SetBoolean(kDisplayCheckBox, true); @@ -1022,7 +1022,7 @@ void SafeBrowsingBlockingPageV2::PopulateMalwareStringDictionary( if (IsPrefEnabled(prefs::kSafeBrowsingReportingEnabled)) strings->SetString(kBoxChecked, "yes"); else - strings->SetString(kBoxChecked, ""); + strings->SetString(kBoxChecked, std::string()); } strings->SetString("report_error", string16()); @@ -1042,10 +1042,11 @@ void SafeBrowsingBlockingPageV2::PopulatePhishingStringDictionary( string16(), l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_V2_DESCRIPTION2)); - strings->SetString("details", ""); - strings->SetString("confirm_text", ""); - strings->SetString(kBoxChecked, ""); - strings->SetString("report_error", + strings->SetString("details", std::string()); + strings->SetString("confirm_text", std::string()); + strings->SetString(kBoxChecked, std::string()); + strings->SetString( + "report_error", l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_V2_REPORT_ERROR)); strings->SetBoolean(kDisplayCheckBox, false); strings->SetString("learnMore", diff --git a/chrome/browser/safe_browsing/safe_browsing_util.cc b/chrome/browser/safe_browsing/safe_browsing_util.cc index ef620a7..7e6710f 100644 --- a/chrome/browser/safe_browsing/safe_browsing_util.cc +++ b/chrome/browser/safe_browsing/safe_browsing_util.cc @@ -298,8 +298,10 @@ void CanonicalizeUrl(const GURL& url, url_unescaped_str.length(), &parsed); // 3. In hostname, remove all leading and trailing dots. - const std::string host = (parsed.host.len > 0) ? url_unescaped_str.substr( - parsed.host.begin, parsed.host.len) : ""; + const std::string host = + (parsed.host.len > 0) + ? url_unescaped_str.substr(parsed.host.begin, parsed.host.len) + : std::string(); const char kCharsToTrim[] = "."; std::string host_without_end_dots; TrimString(host, kCharsToTrim, &host_without_end_dots); @@ -309,10 +311,11 @@ void CanonicalizeUrl(const GURL& url, host_without_end_dots, '.')); // 5. In path, replace runs of consecutive slashes with a single slash. - std::string path = (parsed.path.len > 0) ? url_unescaped_str.substr( - parsed.path.begin, parsed.path.len): ""; - std::string path_without_consecutive_slash(RemoveConsecutiveChars( - path, '/')); + std::string path = + (parsed.path.len > 0) + ? url_unescaped_str.substr(parsed.path.begin, parsed.path.len) + : std::string(); + std::string path_without_consecutive_slash(RemoveConsecutiveChars(path, '/')); url_canon::Replacements<char> hp_replacements; hp_replacements.SetHost(host_without_consecutive_dots.data(), diff --git a/chrome/browser/safe_browsing/two_phase_uploader.cc b/chrome/browser/safe_browsing/two_phase_uploader.cc index 9b6165e..df58625 100644 --- a/chrome/browser/safe_browsing/two_phase_uploader.cc +++ b/chrome/browser/safe_browsing/two_phase_uploader.cc @@ -63,7 +63,7 @@ void TwoPhaseUploader::OnURLFetchComplete(const net::URLFetcher* source) { if (!status.is_success()) { LOG(ERROR) << "URLFetcher failed, status=" << status.status() << " err=" << status.error(); - Finish(status.error(), response_code, ""); + Finish(status.error(), response_code, std::string()); return; } @@ -83,7 +83,7 @@ void TwoPhaseUploader::OnURLFetchComplete(const net::URLFetcher* source) { if (!source->GetResponseHeaders()->EnumerateHeader( NULL, kLocationHeader, &location)) { LOG(ERROR) << "no location header"; - Finish(net::OK, response_code, ""); + Finish(net::OK, response_code, std::string()); return; } DVLOG(1) << "upload location: " << location; diff --git a/chrome/browser/search/local_ntp_source.cc b/chrome/browser/search/local_ntp_source.cc index d1fde35..38cbd7a 100644 --- a/chrome/browser/search/local_ntp_source.cc +++ b/chrome/browser/search/local_ntp_source.cc @@ -74,7 +74,7 @@ std::string LocalNtpSource::GetMimeType( path == kCloseBarActiveFilename) { return "image/png"; } - return ""; + return std::string(); } bool LocalNtpSource::ShouldServiceRequest( diff --git a/chrome/browser/search/local_omnibox_popup_source.cc b/chrome/browser/search/local_omnibox_popup_source.cc index 1ae3c8a..fa2d940 100644 --- a/chrome/browser/search/local_omnibox_popup_source.cc +++ b/chrome/browser/search/local_omnibox_popup_source.cc @@ -76,7 +76,7 @@ std::string LocalOmniboxPopupSource::GetMimeType( if (path == kPageIconFilename || path == kPageIcon2xFilename || path == kSearchIconFilename || path == kSearchIcon2xFilename) return "image/png"; - return ""; + return std::string(); } bool LocalOmniboxPopupSource::ShouldServiceRequest( diff --git a/chrome/browser/search/search.cc b/chrome/browser/search/search.cc index 83186b4..726bc89 100644 --- a/chrome/browser/search/search.cc +++ b/chrome/browser/search/search.cc @@ -527,7 +527,8 @@ uint64 GetUInt64ValueForFlagWithDefault(const std::string& flag, uint64 default_value, const FieldTrialFlags& flags) { uint64 value; - std::string str_value = GetStringValueForFlagWithDefault(flag, "", flags); + std::string str_value = + GetStringValueForFlagWithDefault(flag, std::string(), flags); if (base::StringToUint64(str_value, &value)) return value; return default_value; diff --git a/chrome/browser/search/search_unittest.cc b/chrome/browser/search/search_unittest.cc index 90ff642b..7c4bf4c 100644 --- a/chrome/browser/search/search_unittest.cc +++ b/chrome/browser/search/search_unittest.cc @@ -22,7 +22,7 @@ TEST(EmbeddedSearchFieldTrialTest, GetFieldTrialInfo) { uint64 group_number = 0; const uint64 ZERO = 0; - EXPECT_FALSE(GetFieldTrialInfo("", &flags, &group_number)); + EXPECT_FALSE(GetFieldTrialInfo(std::string(), &flags, &group_number)); EXPECT_EQ(ZERO, group_number); EXPECT_EQ(ZERO, flags.size()); @@ -62,9 +62,10 @@ TEST(EmbeddedSearchFieldTrialTest, GetFieldTrialInfo) { EXPECT_EQ(uint64(3), flags.size()); EXPECT_EQ(true, GetBoolValueForFlagWithDefault("bar", false, flags)); EXPECT_EQ(uint64(7), GetUInt64ValueForFlagWithDefault("baz", 0, flags)); - EXPECT_EQ("dogs", GetStringValueForFlagWithDefault("cat", "", flags)); - EXPECT_EQ("default", GetStringValueForFlagWithDefault( - "moose", "default", flags)); + EXPECT_EQ("dogs", + GetStringValueForFlagWithDefault("cat", std::string(), flags)); + EXPECT_EQ("default", + GetStringValueForFlagWithDefault("moose", "default", flags)); group_number = 0; flags.clear(); diff --git a/chrome/browser/search_engines/template_url_prepopulate_data_unittest.cc b/chrome/browser/search_engines/template_url_prepopulate_data_unittest.cc index 3237137..aa47992 100644 --- a/chrome/browser/search_engines/template_url_prepopulate_data_unittest.cc +++ b/chrome/browser/search_engines/template_url_prepopulate_data_unittest.cc @@ -167,7 +167,7 @@ TEST(TemplateURLPrepopulateDataTest, ProvidersFromPrefs) { entry->SetInteger("id", 1002); entry->SetString("name", "bar"); entry->SetString("keyword", "bark"); - entry->SetString("encoding", ""); + entry->SetString("encoding", std::string()); overrides->Append(entry->DeepCopy()); entry->SetInteger("id", 1003); entry->SetString("name", "baz"); diff --git a/chrome/browser/sessions/session_restore_browsertest.cc b/chrome/browser/sessions/session_restore_browsertest.cc index 5e2953a..e82391e 100644 --- a/chrome/browser/sessions/session_restore_browsertest.cc +++ b/chrome/browser/sessions/session_restore_browsertest.cc @@ -985,7 +985,7 @@ IN_PROC_BROWSER_TEST_F(SessionRestoreTest, SessionStorageAfterTabReplace) { ASSERT_TRUE(controller->GetDefaultSessionStorageNamespace()); content::SessionStorageNamespaceMap session_storage_namespace_map; - session_storage_namespace_map[""] = + session_storage_namespace_map[std::string()] = controller->GetDefaultSessionStorageNamespace(); scoped_ptr<content::WebContents> web_contents( content::WebContents::CreateWithSessionStorage( diff --git a/chrome/browser/shell_integration_linux.cc b/chrome/browser/shell_integration_linux.cc index 2a656fe..c0be6de 100644 --- a/chrome/browser/shell_integration_linux.cc +++ b/chrome/browser/shell_integration_linux.cc @@ -435,7 +435,7 @@ ShellIntegration::DefaultWebClientSetPermission // static bool ShellIntegration::SetAsDefaultBrowser() { - return SetDefaultWebClient(""); + return SetDefaultWebClient(std::string()); } // static @@ -445,7 +445,7 @@ bool ShellIntegration::SetAsDefaultProtocolClient(const std::string& protocol) { // static ShellIntegration::DefaultWebClientState ShellIntegration::GetDefaultBrowser() { - return GetIsDefaultWebClient(""); + return GetIsDefaultWebClient(std::string()); } // static diff --git a/chrome/browser/shell_integration_unittest.cc b/chrome/browser/shell_integration_unittest.cc index 0b81311..8715114 100644 --- a/chrome/browser/shell_integration_unittest.cc +++ b/chrome/browser/shell_integration_unittest.cc @@ -644,7 +644,7 @@ TEST(ShellIntegrationTest, GetDesktopFileContents) { test_cases[i].template_contents, web_app::GenerateApplicationNameFromURL(GURL(test_cases[i].url)), GURL(test_cases[i].url), - "", + std::string(), base::FilePath(), ASCIIToUTF16(test_cases[i].title), test_cases[i].icon_name, diff --git a/chrome/browser/signin/about_signin_internals.cc b/chrome/browser/signin/about_signin_internals.cc index ad83b0d..e58a013 100644 --- a/chrome/browser/signin/about_signin_internals.cc +++ b/chrome/browser/signin/about_signin_internals.cc @@ -25,7 +25,8 @@ AboutSigninInternals::AboutSigninInternals() : profile_(NULL) { for (size_t i = 0; i < kNumTokenPrefs; ++i) { signin_status_.token_info_map.insert(std::pair<std::string, TokenInfo>( kTokenPrefsArray[i], - TokenInfo("", "Not Loaded", "", kTokenPrefsArray[i]))); + TokenInfo( + std::string(), "Not Loaded", std::string(), kTokenPrefsArray[i]))); } } @@ -170,7 +171,7 @@ void AboutSigninInternals::NotifyTokenReceivedFailure( const std::string value_pref = TokenPrefPath(token_name) + ".value"; const std::string time_pref = TokenPrefPath(token_name) + ".time"; const std::string status_pref = TokenPrefPath(token_name) + ".status"; - profile_->GetPrefs()->SetString(value_pref.c_str(), ""); + profile_->GetPrefs()->SetString(value_pref.c_str(), std::string()); profile_->GetPrefs()->SetString(time_pref.c_str(), time_as_str); profile_->GetPrefs()->SetString(status_pref.c_str(), error); @@ -186,7 +187,7 @@ void AboutSigninInternals::NotifyClearStoredToken( signin_status_.token_info_map[token_name].token.clear(); const std::string value_pref = TokenPrefPath(token_name) + ".value"; - profile_->GetPrefs()->SetString(value_pref.c_str(), ""); + profile_->GetPrefs()->SetString(value_pref.c_str(), std::string()); NotifyObservers(); } diff --git a/chrome/browser/signin/about_signin_internals_factory.cc b/chrome/browser/signin/about_signin_internals_factory.cc index ccce353..f5f197f 100644 --- a/chrome/browser/signin/about_signin_internals_factory.cc +++ b/chrome/browser/signin/about_signin_internals_factory.cc @@ -42,7 +42,8 @@ void AboutSigninInternalsFactory::RegisterUserPrefs( for (int i = UNTIMED_FIELDS_BEGIN; i < UNTIMED_FIELDS_END; ++i) { const std::string pref_path = SigninStatusFieldToString( static_cast<UntimedSigninStatusField>(i)); - user_prefs->RegisterStringPref(pref_path.c_str(), "", + user_prefs->RegisterStringPref(pref_path.c_str(), + std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); } for (int i = TIMED_FIELDS_BEGIN; i < TIMED_FIELDS_END; ++i) { @@ -50,10 +51,10 @@ void AboutSigninInternalsFactory::RegisterUserPrefs( static_cast<TimedSigninStatusField>(i)) + ".value"; const std::string time = SigninStatusFieldToString( static_cast<TimedSigninStatusField>(i)) + ".time"; - user_prefs->RegisterStringPref(value.c_str(), "", - PrefRegistrySyncable::UNSYNCABLE_PREF); - user_prefs->RegisterStringPref(time.c_str(), "", - PrefRegistrySyncable::UNSYNCABLE_PREF); + user_prefs->RegisterStringPref( + value.c_str(), std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); + user_prefs->RegisterStringPref( + time.c_str(), std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); } // TokenService information for about:signin-internals. for (size_t i = 0; i < kNumTokenPrefs; i++) { @@ -61,12 +62,12 @@ void AboutSigninInternalsFactory::RegisterUserPrefs( const std::string value = pref + ".value"; const std::string status = pref + ".status"; const std::string time = pref + ".time"; - user_prefs->RegisterStringPref(value.c_str(), "", - PrefRegistrySyncable::UNSYNCABLE_PREF); - user_prefs->RegisterStringPref(status.c_str(), "", - PrefRegistrySyncable::UNSYNCABLE_PREF); - user_prefs->RegisterStringPref(time.c_str(), "", - PrefRegistrySyncable::UNSYNCABLE_PREF); + user_prefs->RegisterStringPref( + value.c_str(), std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); + user_prefs->RegisterStringPref( + status.c_str(), std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); + user_prefs->RegisterStringPref( + time.c_str(), std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); } } diff --git a/chrome/browser/signin/oauth2_token_service_unittest.cc b/chrome/browser/signin/oauth2_token_service_unittest.cc index 3649374..7095b43 100644 --- a/chrome/browser/signin/oauth2_token_service_unittest.cc +++ b/chrome/browser/signin/oauth2_token_service_unittest.cc @@ -138,7 +138,7 @@ TEST_F(OAuth2TokenServiceTest, FailureShouldNotRetry) { net::TestURLFetcher* fetcher = factory_.GetFetcherByID(0); EXPECT_TRUE(fetcher); fetcher->set_response_code(net::HTTP_UNAUTHORIZED); - fetcher->SetResponseString(""); + fetcher->SetResponseString(std::string()); fetcher->delegate()->OnURLFetchComplete(fetcher); EXPECT_EQ(0, consumer_.number_of_correct_tokens_); EXPECT_EQ(1, consumer_.number_of_errors_); @@ -251,7 +251,7 @@ TEST_F(OAuth2TokenServiceTest, SuccessAndExpirationAndFailure) { fetcher = factory_.GetFetcherByID(0); EXPECT_TRUE(fetcher); fetcher->set_response_code(net::HTTP_UNAUTHORIZED); - fetcher->SetResponseString(""); + fetcher->SetResponseString(std::string()); fetcher->delegate()->OnURLFetchComplete(fetcher); EXPECT_EQ(1, consumer_.number_of_correct_tokens_); EXPECT_EQ(1, consumer_.number_of_errors_); @@ -374,7 +374,7 @@ TEST_F(OAuth2TokenServiceTest, SuccessAndSignOutAndRequest) { // Signs out service_->IssueAuthTokenForTest(GaiaConstants::kGaiaOAuth2LoginRefreshToken, - ""); + std::string()); service_->EraseTokensFromDB(); request = oauth2_service_->StartRequest(std::set<std::string>(), &consumer_); @@ -404,7 +404,7 @@ TEST_F(OAuth2TokenServiceTest, SuccessAndSignOutAndSignInAndSuccess) { // Signs out and signs in service_->IssueAuthTokenForTest(GaiaConstants::kGaiaOAuth2LoginRefreshToken, - ""); + std::string()); service_->EraseTokensFromDB(); service_->IssueAuthTokenForTest(GaiaConstants::kGaiaOAuth2LoginRefreshToken, "refreshToken"); @@ -486,7 +486,7 @@ TEST_F(OAuth2TokenServiceTest, RetryingConsumer) { net::TestURLFetcher* fetcher = factory_.GetFetcherByID(0); EXPECT_TRUE(fetcher); fetcher->set_response_code(net::HTTP_UNAUTHORIZED); - fetcher->SetResponseString(""); + fetcher->SetResponseString(std::string()); fetcher->delegate()->OnURLFetchComplete(fetcher); EXPECT_EQ(0, consumer.number_of_correct_tokens_); EXPECT_EQ(1, consumer.number_of_errors_); @@ -494,7 +494,7 @@ TEST_F(OAuth2TokenServiceTest, RetryingConsumer) { fetcher = factory_.GetFetcherByID(0); EXPECT_TRUE(fetcher); fetcher->set_response_code(net::HTTP_UNAUTHORIZED); - fetcher->SetResponseString(""); + fetcher->SetResponseString(std::string()); fetcher->delegate()->OnURLFetchComplete(fetcher); EXPECT_EQ(0, consumer.number_of_correct_tokens_); EXPECT_EQ(2, consumer.number_of_errors_); diff --git a/chrome/browser/signin/signin_internals_util.cc b/chrome/browser/signin/signin_internals_util.cc index adae0a1..f187418 100644 --- a/chrome/browser/signin/signin_internals_util.cc +++ b/chrome/browser/signin/signin_internals_util.cc @@ -98,11 +98,11 @@ std::string SigninStatusFieldToString(UntimedSigninStatusField field) { ENUM_CASE(LSID); case UNTIMED_FIELDS_END: NOTREACHED(); - return ""; + return std::string(); } NOTREACHED(); - return ""; + return std::string(); } std::string SigninStatusFieldToString(TimedSigninStatusField field) { @@ -113,11 +113,11 @@ std::string SigninStatusFieldToString(TimedSigninStatusField field) { ENUM_CASE(GET_USER_INFO_STATUS); case TIMED_FIELDS_END: NOTREACHED(); - return ""; + return std::string(); } NOTREACHED(); - return ""; + return std::string(); } SigninStatus::SigninStatus() @@ -203,10 +203,10 @@ std::string SigninStatusFieldToLabel(UntimedSigninStatusField field) { return "Sid (Hash)"; case UNTIMED_FIELDS_END: NOTREACHED(); - return ""; + return std::string(); } NOTREACHED(); - return ""; + return std::string(); } TimedSigninStatusValue SigninStatusFieldToLabel( @@ -226,10 +226,10 @@ TimedSigninStatusValue SigninStatusFieldToLabel( "Last OnGetUserInfo Time"); case TIMED_FIELDS_END: NOTREACHED(); - return TimedSigninStatusValue("Error", ""); + return TimedSigninStatusValue("Error", std::string()); } NOTREACHED(); - return TimedSigninStatusValue("Error", ""); + return TimedSigninStatusValue("Error", std::string()); } } // namespace diff --git a/chrome/browser/signin/signin_manager.cc b/chrome/browser/signin/signin_manager.cc index a8bc081..ab5befc 100644 --- a/chrome/browser/signin/signin_manager.cc +++ b/chrome/browser/signin/signin_manager.cc @@ -305,10 +305,9 @@ std::string SigninManager::SigninTypeToString( } NOTREACHED(); - return ""; + return std::string(); } - bool SigninManager::PrepareForSignin(SigninType type, const std::string& username, const std::string& password) { @@ -468,7 +467,8 @@ void SigninManager::StartSignInWithOAuth(const std::string& username, scopes.push_back(GaiaUrls::GetInstance()->oauth1_login_scope()); const std::string& locale = g_browser_process->GetApplicationLocale(); - client_login_->StartClientOAuth(username, password, scopes, "", locale); + client_login_->StartClientOAuth( + username, password, scopes, std::string(), locale); // Register for token availability. The signin manager will pre-login the // user when the GAIA service token is ready for use. Only do this if we @@ -549,10 +549,9 @@ void SigninManager::SignOut() { profile_->GetPrefs()->ClearPref(prefs::kGoogleServicesUsername); // Erase (now) stale information from AboutSigninInternals. - NotifyDiagnosticsObservers(USERNAME, ""); - NotifyDiagnosticsObservers(LSID, ""); - NotifyDiagnosticsObservers( - signin_internals_util::SID, ""); + NotifyDiagnosticsObservers(USERNAME, std::string()); + NotifyDiagnosticsObservers(LSID, std::string()); + NotifyDiagnosticsObservers(signin_internals_util::SID, std::string()); TokenService* token_service = TokenServiceFactory::GetForProfile(profile_); content::NotificationService::current()->Notify( diff --git a/chrome/browser/signin/signin_manager_factory.cc b/chrome/browser/signin/signin_manager_factory.cc index 67e33c0..11dd5e6 100644 --- a/chrome/browser/signin/signin_manager_factory.cc +++ b/chrome/browser/signin/signin_manager_factory.cc @@ -39,9 +39,11 @@ SigninManagerFactory* SigninManagerFactory::GetInstance() { } void SigninManagerFactory::RegisterUserPrefs(PrefRegistrySyncable* registry) { - registry->RegisterStringPref(prefs::kGoogleServicesLastUsername, "", + registry->RegisterStringPref(prefs::kGoogleServicesLastUsername, + std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); - registry->RegisterStringPref(prefs::kGoogleServicesUsername, "", + registry->RegisterStringPref(prefs::kGoogleServicesUsername, + std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); registry->RegisterBooleanPref(prefs::kAutologinEnabled, true, PrefRegistrySyncable::UNSYNCABLE_PREF); @@ -54,7 +56,8 @@ void SigninManagerFactory::RegisterUserPrefs(PrefRegistrySyncable* registry) { // static void SigninManagerFactory::RegisterPrefs(PrefRegistrySimple* registry) { - registry->RegisterStringPref(prefs::kGoogleServicesUsernamePattern, ""); + registry->RegisterStringPref(prefs::kGoogleServicesUsernamePattern, + std::string()); } ProfileKeyedService* SigninManagerFactory::BuildServiceInstanceFor( diff --git a/chrome/browser/signin/signin_manager_unittest.cc b/chrome/browser/signin/signin_manager_unittest.cc index 79964d0..c49f7a1 100644 --- a/chrome/browser/signin/signin_manager_unittest.cc +++ b/chrome/browser/signin/signin_manager_unittest.cc @@ -308,7 +308,8 @@ TEST_F(SigninManagerTest, SignInClientLogin) { manager_->Initialize(profile_.get()); EXPECT_TRUE(manager_->GetAuthenticatedUsername().empty()); - manager_->StartSignIn("user@gmail.com", "password", "", ""); + manager_->StartSignIn( + "user@gmail.com", "password", std::string(), std::string()); EXPECT_TRUE(manager_->GetAuthenticatedUsername().empty()); SimulateValidResponseClientLogin(true); @@ -340,7 +341,7 @@ TEST_F(SigninManagerTest, Prohibited) { EXPECT_TRUE(manager_->IsAllowedUsername("happy@google.com")); EXPECT_FALSE(manager_->IsAllowedUsername("test@invalid.com")); EXPECT_FALSE(manager_->IsAllowedUsername("test@notgoogle.com")); - EXPECT_FALSE(manager_->IsAllowedUsername("")); + EXPECT_FALSE(manager_->IsAllowedUsername(std::string())); } TEST_F(SigninManagerTest, TestAlternateWildcard) { @@ -353,7 +354,7 @@ TEST_F(SigninManagerTest, TestAlternateWildcard) { EXPECT_TRUE(manager_->IsAllowedUsername("happy@google.com")); EXPECT_FALSE(manager_->IsAllowedUsername("test@invalid.com")); EXPECT_FALSE(manager_->IsAllowedUsername("test@notgoogle.com")); - EXPECT_FALSE(manager_->IsAllowedUsername("")); + EXPECT_FALSE(manager_->IsAllowedUsername(std::string())); } TEST_F(SigninManagerTest, ProhibitedAtStartup) { @@ -421,7 +422,7 @@ TEST_F(SigninManagerTest, SignInWithCredentialsEmptyPasswordValidCookie) { net::CookieMonster::SetCookiesCallback()); // Since the password is empty, will verify the gaia cookies first. - manager_->StartSignInWithCredentials("0", "user@gmail.com", ""); + manager_->StartSignInWithCredentials("0", "user@gmail.com", std::string()); WaitUntilUIDone(); @@ -434,7 +435,7 @@ TEST_F(SigninManagerTest, SignInWithCredentialsEmptyPasswordNoValidCookie) { EXPECT_TRUE(manager_->GetAuthenticatedUsername().empty()); // Since the password is empty, will verify the gaia cookies first. - manager_->StartSignInWithCredentials("0", "user@gmail.com", ""); + manager_->StartSignInWithCredentials("0", "user@gmail.com", std::string()); WaitUntilUIDone(); @@ -458,7 +459,7 @@ TEST_F(SigninManagerTest, SignInWithCredentialsEmptyPasswordInValidCookie) { net::CookieMonster::SetCookiesCallback()); // Since the password is empty, must verify the gaia cookies first. - manager_->StartSignInWithCredentials("0", "user@gmail.com", ""); + manager_->StartSignInWithCredentials("0", "user@gmail.com", std::string()); WaitUntilUIDone(); @@ -471,7 +472,7 @@ TEST_F(SigninManagerTest, SignInClientLoginNoGPlus) { manager_->Initialize(profile_.get()); EXPECT_TRUE(manager_->GetAuthenticatedUsername().empty()); - manager_->StartSignIn("username", "password", "", ""); + manager_->StartSignIn("username", "password", std::string(), std::string()); EXPECT_TRUE(manager_->GetAuthenticatedUsername().empty()); SimulateValidResponseClientLogin(false); @@ -482,7 +483,7 @@ TEST_F(SigninManagerTest, ClearTransientSigninData) { manager_->Initialize(profile_.get()); EXPECT_TRUE(manager_->GetAuthenticatedUsername().empty()); - manager_->StartSignIn("username", "password", "", ""); + manager_->StartSignIn("username", "password", std::string(), std::string()); EXPECT_TRUE(manager_->GetAuthenticatedUsername().empty()); SimulateValidResponseClientLogin(false); @@ -513,7 +514,7 @@ TEST_F(SigninManagerTest, ClearTransientSigninData) { TEST_F(SigninManagerTest, SignOutClientLogin) { manager_->Initialize(profile_.get()); - manager_->StartSignIn("username", "password", "", ""); + manager_->StartSignIn("username", "password", std::string(), std::string()); SimulateValidResponseClientLogin(false); manager_->OnClientLoginSuccess(credentials_); @@ -529,7 +530,7 @@ TEST_F(SigninManagerTest, SignOutClientLogin) { TEST_F(SigninManagerTest, SignInFailureClientLogin) { manager_->Initialize(profile_.get()); - manager_->StartSignIn("username", "password", "", ""); + manager_->StartSignIn("username", "password", std::string(), std::string()); GoogleServiceAuthError error(GoogleServiceAuthError::REQUEST_CANCELED); manager_->OnClientLoginFailure(error); @@ -547,7 +548,7 @@ TEST_F(SigninManagerTest, SignInFailureClientLogin) { TEST_F(SigninManagerTest, ProvideSecondFactorSuccess) { manager_->Initialize(profile_.get()); - manager_->StartSignIn("username", "password", "", ""); + manager_->StartSignIn("username", "password", std::string(), std::string()); GoogleServiceAuthError error(GoogleServiceAuthError::TWO_FACTOR); manager_->OnClientLoginFailure(error); @@ -566,7 +567,7 @@ TEST_F(SigninManagerTest, ProvideSecondFactorSuccess) { TEST_F(SigninManagerTest, ProvideSecondFactorFailure) { manager_->Initialize(profile_.get()); - manager_->StartSignIn("username", "password", "", ""); + manager_->StartSignIn("username", "password", std::string(), std::string()); GoogleServiceAuthError error1(GoogleServiceAuthError::TWO_FACTOR); manager_->OnClientLoginFailure(error1); @@ -596,7 +597,7 @@ TEST_F(SigninManagerTest, ProvideSecondFactorFailure) { TEST_F(SigninManagerTest, SignOutMidConnect) { manager_->Initialize(profile_.get()); - manager_->StartSignIn("username", "password", "", ""); + manager_->StartSignIn("username", "password", std::string(), std::string()); manager_->SignOut(); EXPECT_EQ(0U, google_login_success_.size()); EXPECT_EQ(0U, google_login_failure_.size()); diff --git a/chrome/browser/signin/token_service_unittest.cc b/chrome/browser/signin/token_service_unittest.cc index 617a394..fbe83df 100644 --- a/chrome/browser/signin/token_service_unittest.cc +++ b/chrome/browser/signin/token_service_unittest.cc @@ -225,7 +225,7 @@ TEST_F(TokenServiceTest, OnTokenSuccessUpdate) { EXPECT_EQ(service_->GetTokenForService(GaiaConstants::kSyncService), "token2"); - service_->OnIssueAuthTokenSuccess(GaiaConstants::kSyncService, ""); + service_->OnIssueAuthTokenSuccess(GaiaConstants::kSyncService, std::string()); EXPECT_TRUE(service_->HasTokenForService(GaiaConstants::kSyncService)); EXPECT_EQ(service_->GetTokenForService(GaiaConstants::kSyncService), ""); } diff --git a/chrome/browser/spellchecker/spelling_service_client_unittest.cc b/chrome/browser/spellchecker/spelling_service_client_unittest.cc index d3243e8..5833fce 100644 --- a/chrome/browser/spellchecker/spelling_service_client_unittest.cc +++ b/chrome/browser/spellchecker/spelling_service_client_unittest.cc @@ -343,7 +343,7 @@ TEST_F(SpellingServiceClientTest, AvailableServices) { // SpellingServiceClient::IsAvailable() describes why this function returns // false for suggestions.) If there is no language set, then we // do not allow any remote. - pref->SetString(prefs::kSpellCheckDictionary, ""); + pref->SetString(prefs::kSpellCheckDictionary, std::string()); EXPECT_FALSE(client_.IsAvailable(&profile_, kSuggest)); EXPECT_FALSE(client_.IsAvailable(&profile_, kSpellcheck)); diff --git a/chrome/browser/ssl/ssl_blocking_page.cc b/chrome/browser/ssl/ssl_blocking_page.cc index 6942d1e..615c4c6 100644 --- a/chrome/browser/ssl/ssl_blocking_page.cc +++ b/chrome/browser/ssl/ssl_blocking_page.cc @@ -218,9 +218,9 @@ std::string SSLBlockingPage::GetHTMLContents() { l10n_util::GetStringUTF16( IDS_SSL_ERROR_PAGE_CANNOT_PROCEED)); } else { - strings.SetString("reasonForNotProceeding", ""); + strings.SetString("reasonForNotProceeding", std::string()); } - strings.SetString("errorType", ""); + strings.SetString("errorType", std::string()); } strings.SetString("textdirection", base::i18n::IsRTL() ? "rtl" : "ltr"); @@ -318,6 +318,6 @@ void SSLBlockingPage::SetExtraInfo( strings->SetString(keys[i], extra_info[i]); } for (; i < 5; i++) { - strings->SetString(keys[i], ""); + strings->SetString(keys[i], std::string()); } } diff --git a/chrome/browser/ssl/ssl_browser_tests.cc b/chrome/browser/ssl/ssl_browser_tests.cc index 42cfbf6..d4afe0f 100644 --- a/chrome/browser/ssl/ssl_browser_tests.cc +++ b/chrome/browser/ssl/ssl_browser_tests.cc @@ -738,9 +738,9 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, MAYBE_TestHTTPSErrorWithNoNavEntry) { IN_PROC_BROWSER_TEST_F(SSLUITest, TestBadHTTPSDownload) { ASSERT_TRUE(test_server()->Start()); ASSERT_TRUE(https_server_expired_.Start()); - GURL url_non_dangerous = test_server()->GetURL(""); - GURL url_dangerous = https_server_expired_.GetURL( - "files/downloads/dangerous/dangerous.exe"); + GURL url_non_dangerous = test_server()->GetURL(std::string()); + GURL url_dangerous = + https_server_expired_.GetURL("files/downloads/dangerous/dangerous.exe"); base::ScopedTempDir downloads_directory_; // Need empty temp dir to avoid having Chrome ask us for a new filename diff --git a/chrome/browser/storage_monitor/media_storage_util.cc b/chrome/browser/storage_monitor/media_storage_util.cc index 72602fa..dc9c61b 100644 --- a/chrome/browser/storage_monitor/media_storage_util.cc +++ b/chrome/browser/storage_monitor/media_storage_util.cc @@ -187,8 +187,9 @@ std::string MediaStorageUtil::MakeDeviceId(Type type, bool MediaStorageUtil::CrackDeviceId(const std::string& device_id, Type* type, std::string* unique_id) { size_t prefix_length = device_id.find_first_of(':'); - std::string prefix = prefix_length != std::string::npos ? - device_id.substr(0, prefix_length + 1) : ""; + std::string prefix = prefix_length != std::string::npos + ? device_id.substr(0, prefix_length + 1) + : std::string(); Type found_type; if (prefix == kRemovableMassStorageWithDCIMPrefix) { diff --git a/chrome/browser/sync/glue/session_model_associator_unittest.cc b/chrome/browser/sync/glue/session_model_associator_unittest.cc index d1f63bb..e5ceab1e 100644 --- a/chrome/browser/sync/glue/session_model_associator_unittest.cc +++ b/chrome/browser/sync/glue/session_model_associator_unittest.cc @@ -375,7 +375,7 @@ TEST_F(SyncSessionModelAssociatorTest, SetSessionTabFromDelegate) { // Create tab specifics with an empty favicon. Ensure it gets ignored and not // stored into the synced favicon lookups. TEST_F(SyncSessionModelAssociatorTest, LoadEmptyFavicon) { - std::string favicon = ""; + std::string favicon; std::string favicon_url = "http://www.faviconurl.com/favicon.ico"; std::string page_url = "http://www.faviconurl.com/page.html"; sync_pb::SessionTab tab; diff --git a/chrome/browser/sync/glue/sync_backend_host_unittest.cc b/chrome/browser/sync/glue/sync_backend_host_unittest.cc index 96d1acb..d05dd46 100644 --- a/chrome/browser/sync/glue/sync_backend_host_unittest.cc +++ b/chrome/browser/sync/glue/sync_backend_host_unittest.cc @@ -194,7 +194,7 @@ class SyncBackendHostTest : public testing::Test { WillOnce(InvokeWithoutArgs(QuitMessageLoop)); backend_->Initialize(&mock_frontend_, syncer::WeakHandle<syncer::JsEventHandler>(), - GURL(""), + GURL(std::string()), credentials_, true, &fake_manager_factory_, diff --git a/chrome/browser/sync/glue/synced_session.h b/chrome/browser/sync/glue/synced_session.h index a1d0d68..80ff9be 100644 --- a/chrome/browser/sync/glue/synced_session.h +++ b/chrome/browser/sync/glue/synced_session.h @@ -74,7 +74,7 @@ struct SyncedSession { case SyncedSession::TYPE_TABLET: return "tablet"; default: - return ""; + return std::string(); } } diff --git a/chrome/browser/sync/invalidations/invalidator_storage.cc b/chrome/browser/sync/invalidations/invalidator_storage.cc index acbbd47..e88d0e2 100644 --- a/chrome/browser/sync/invalidations/invalidator_storage.cc +++ b/chrome/browser/sync/invalidations/invalidator_storage.cc @@ -282,8 +282,10 @@ void InvalidatorStorage::SetBootstrapData(const std::string& data) { } std::string InvalidatorStorage::GetBootstrapData() const { - std::string base64_data(pref_service_ ? - pref_service_->GetString(prefs::kInvalidatorInvalidationState) : ""); + std::string base64_data( + pref_service_ + ? pref_service_->GetString(prefs::kInvalidatorInvalidationState) + : std::string()); std::string data; base::Base64Decode(base64_data, &data); return data; diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc index 2d8bbd3..a58fff4 100644 --- a/chrome/browser/sync/profile_sync_service.cc +++ b/chrome/browser/sync/profile_sync_service.cc @@ -726,7 +726,7 @@ void ProfileSyncService::ClearUnrecoverableError() { std::string ProfileSyncService::GetExperimentNameForDataType( syncer::ModelType data_type) { NOTREACHED(); - return ""; + return std::string(); } void ProfileSyncService::RegisterNewDataType(syncer::ModelType data_type) { diff --git a/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc b/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc index bc62c97..1ad62a1 100644 --- a/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc @@ -706,9 +706,9 @@ TEST_F(ProfileSyncServiceBookmarkTest, ServerChangeProcessing) { "'about:blank','gnotesWin','location=0,menubar=0," \ "scrollbars=0,status=0,toolbar=0,width=300," \ "height=300,resizable');});"); - adds.AddURL(L"", javascript_url, other_bookmarks_id(), 0); - int64 u6 = adds.AddURL(L"Sync1", "http://www.syncable.edu/", - mobile_bookmarks_id(), 0); + adds.AddURL(std::wstring(), javascript_url, other_bookmarks_id(), 0); + int64 u6 = adds.AddURL( + L"Sync1", "http://www.syncable.edu/", mobile_bookmarks_id(), 0); syncer::ChangeRecordList::const_iterator it; // The bookmark model shouldn't yet have seen any of the nodes of |adds|. diff --git a/chrome/browser/sync/profile_sync_service_harness.cc b/chrome/browser/sync/profile_sync_service_harness.cc index c290374..eb0b074 100644 --- a/chrome/browser/sync/profile_sync_service_harness.cc +++ b/chrome/browser/sync/profile_sync_service_harness.cc @@ -134,7 +134,7 @@ ProfileSyncServiceHarness* ProfileSyncServiceHarness::CreateAndAttach( NOTREACHED() << "Profile has never signed into sync."; return NULL; } - return new ProfileSyncServiceHarness(profile, "", ""); + return new ProfileSyncServiceHarness(profile, std::string(), std::string()); } void ProfileSyncServiceHarness::SetCredentials(const std::string& username, @@ -179,7 +179,8 @@ bool ProfileSyncServiceHarness::SetupSync( service_->SetSetupInProgress(true); // Authenticate sync client using GAIA credentials. - service_->signin()->StartSignIn(username_, password_, "", ""); + service_->signin() + ->StartSignIn(username_, password_, std::string(), std::string()); // Wait for the OnBackendInitialized() callback. if (!AwaitBackendInitialized()) { @@ -1014,7 +1015,7 @@ std::string ProfileSyncServiceHarness::GetSerializedProgressMarker( syncer::ProgressMarkerMap::const_iterator it = markers_map.find(model_type); - return (it != markers_map.end()) ? it->second : ""; + return (it != markers_map.end()) ? it->second : std::string(); } std::string ProfileSyncServiceHarness::GetClientInfoString( diff --git a/chrome/browser/sync/profile_sync_service_session_unittest.cc b/chrome/browser/sync/profile_sync_service_session_unittest.cc index 1ee92a6..4ed28ab 100644 --- a/chrome/browser/sync/profile_sync_service_session_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_session_unittest.cc @@ -85,8 +85,10 @@ class FakeProfileSyncService : public TestProfileSyncService { virtual ~FakeProfileSyncService() {} virtual scoped_ptr<DeviceInfo> GetLocalDeviceInfo() const OVERRIDE { - return scoped_ptr<DeviceInfo>( - new DeviceInfo("client_name", "", "", sync_pb::SyncEnums::TYPE_WIN)); + return scoped_ptr<DeviceInfo>(new DeviceInfo("client_name", + std::string(), + std::string(), + sync_pb::SyncEnums::TYPE_WIN)); } }; diff --git a/chrome/browser/sync/profile_sync_service_startup_unittest.cc b/chrome/browser/sync/profile_sync_service_startup_unittest.cc index 1a00308..d85946e 100644 --- a/chrome/browser/sync/profile_sync_service_startup_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_startup_unittest.cc @@ -189,9 +189,10 @@ TEST_F(ProfileSyncServiceStartupTest, StartFirstTime) { // Create some tokens in the token service; the service will startup when // it is notified that tokens are available. sync_->SetSetupInProgress(true); - sync_->signin()->StartSignIn("test_user", "", "", ""); - TokenServiceFactory::GetForProfile(profile_.get())->IssueAuthTokenForTest( - GaiaConstants::kSyncService, "sync_token"); + sync_->signin() + ->StartSignIn("test_user", std::string(), std::string(), std::string()); + TokenServiceFactory::GetForProfile(profile_.get()) + ->IssueAuthTokenForTest(GaiaConstants::kSyncService, "sync_token"); TokenServiceFactory::GetForProfile(profile_.get())->IssueAuthTokenForTest( GaiaConstants::kGaiaOAuth2LoginRefreshToken, "oauth2_login_token"); sync_->SetSetupInProgress(false); @@ -235,7 +236,8 @@ TEST_F(ProfileSyncServiceStartupTest, StartNoCredentials) { EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber()); sync_->SetSetupInProgress(true); - sync_->signin()->StartSignIn("test_user", "", "", ""); + sync_->signin() + ->StartSignIn("test_user", std::string(), std::string(), std::string()); // NOTE: Unlike StartFirstTime, this test does not issue any auth tokens. token_service->LoadTokensFromDB(); sync_->SetSetupInProgress(false); @@ -269,9 +271,10 @@ TEST_F(ProfileSyncServiceStartupTest, StartInvalidCredentials) { EXPECT_CALL(*data_type_manager, Stop()).Times(1); EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber()); sync_->SetSetupInProgress(true); - sync_->signin()->StartSignIn("test_user", "", "", ""); - token_service->IssueAuthTokenForTest( - GaiaConstants::kSyncService, "sync_token"); + sync_->signin() + ->StartSignIn("test_user", std::string(), std::string(), std::string()); + token_service->IssueAuthTokenForTest(GaiaConstants::kSyncService, + "sync_token"); sync_->SetSetupInProgress(false); MessageLoop::current()->Run(); diff --git a/chrome/browser/sync/sync_prefs.cc b/chrome/browser/sync/sync_prefs.cc index 0c7a4bd..a5c58e8 100644 --- a/chrome/browser/sync/sync_prefs.cc +++ b/chrome/browser/sync/sync_prefs.cc @@ -87,10 +87,10 @@ void SyncPrefs::RegisterUserPrefs(PrefRegistrySyncable* registry) { false, PrefRegistrySyncable::UNSYNCABLE_PREF); registry->RegisterStringPref(prefs::kSyncEncryptionBootstrapToken, - "", + std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); registry->RegisterStringPref(prefs::kSyncKeystoreEncryptionBootstrapToken, - "", + std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); #if defined(OS_CHROMEOS) registry->RegisterStringPref(prefs::kSyncSpareBootstrapToken, @@ -99,7 +99,7 @@ void SyncPrefs::RegisterUserPrefs(PrefRegistrySyncable* registry) { #endif registry->RegisterStringPref(prefs::kSyncSessionsGUID, - "", + std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); // We will start prompting people about new data types after the launch of @@ -181,9 +181,9 @@ void SyncPrefs::SetStartSuppressed(bool is_suppressed) { std::string SyncPrefs::GetGoogleServicesUsername() const { DCHECK(CalledOnValidThread()); - return - pref_service_ ? - pref_service_->GetString(prefs::kGoogleServicesUsername) : ""; + return pref_service_ + ? pref_service_->GetString(prefs::kGoogleServicesUsername) + : std::string(); } base::Time SyncPrefs::GetLastSyncedTime() const { @@ -266,9 +266,9 @@ bool SyncPrefs::IsManaged() const { std::string SyncPrefs::GetEncryptionBootstrapToken() const { DCHECK(CalledOnValidThread()); - return - pref_service_ ? - pref_service_->GetString(prefs::kSyncEncryptionBootstrapToken) : ""; + return pref_service_ + ? pref_service_->GetString(prefs::kSyncEncryptionBootstrapToken) + : std::string(); } void SyncPrefs::SetEncryptionBootstrapToken(const std::string& token) { @@ -278,10 +278,9 @@ void SyncPrefs::SetEncryptionBootstrapToken(const std::string& token) { std::string SyncPrefs::GetKeystoreEncryptionBootstrapToken() const { DCHECK(CalledOnValidThread()); - return - pref_service_ ? - pref_service_->GetString(prefs::kSyncKeystoreEncryptionBootstrapToken) : - ""; + return pref_service_ ? pref_service_->GetString( + prefs::kSyncKeystoreEncryptionBootstrapToken) + : std::string(); } void SyncPrefs::SetKeystoreEncryptionBootstrapToken(const std::string& token) { @@ -291,9 +290,8 @@ void SyncPrefs::SetKeystoreEncryptionBootstrapToken(const std::string& token) { std::string SyncPrefs::GetSyncSessionsGUID() const { DCHECK(CalledOnValidThread()); - return - pref_service_ ? - pref_service_->GetString(prefs::kSyncSessionsGUID) : ""; + return pref_service_ ? pref_service_->GetString(prefs::kSyncSessionsGUID) + : std::string(); } void SyncPrefs::SetSyncSessionsGUID(const std::string& guid) { diff --git a/chrome/browser/sync/test/integration/sync_extension_helper.cc b/chrome/browser/sync/test/integration/sync_extension_helper.cc index 84cf7547..fc007af9 100644 --- a/chrome/browser/sync/test/integration/sync_extension_helper.cc +++ b/chrome/browser/sync/test/integration/sync_extension_helper.cc @@ -63,7 +63,7 @@ std::string SyncExtensionHelper::InstallExtension( scoped_refptr<Extension> extension = GetExtension(profile, name, type); if (!extension.get()) { NOTREACHED() << "Could not install extension " << name; - return ""; + return std::string(); } profile->GetExtensionService()->OnExtensionInstalled( extension, syncer::StringOrdinal(), false /* no requirement errors */, diff --git a/chrome/browser/sync_file_system/drive_file_sync_client.cc b/chrome/browser/sync_file_system/drive_file_sync_client.cc index b6c8095..7f8903a 100644 --- a/chrome/browser/sync_file_system/drive_file_sync_client.cc +++ b/chrome/browser/sync_file_system/drive_file_sync_client.cc @@ -129,7 +129,7 @@ DriveFileSyncClient::DriveFileSyncClient(Profile* profile) drive_service_.reset(new google_apis::GDataWapiService( profile->GetRequestContext(), GURL(google_apis::GDataWapiUrlGenerator::kBaseUrlForProduction), - "" /* custom_user_agent */)); + std::string() /* custom_user_agent */)); drive_service_->Initialize(profile); drive_service_->AddObserver(this); net::NetworkChangeNotifier::AddConnectionTypeObserver(this); diff --git a/chrome/browser/sync_file_system/drive_file_sync_service.cc b/chrome/browser/sync_file_system/drive_file_sync_service.cc index c7a12a7..15691f49 100644 --- a/chrome/browser/sync_file_system/drive_file_sync_service.cc +++ b/chrome/browser/sync_file_system/drive_file_sync_service.cc @@ -411,7 +411,8 @@ void DriveFileSyncService::RegisterOriginForTrackingChanges( void DriveFileSyncService::UnregisterOriginForTrackingChanges( const GURL& origin, const SyncStatusCallback& callback) { - scoped_ptr<TaskToken> token(GetToken(FROM_HERE, TASK_TYPE_DATABASE, "")); + scoped_ptr<TaskToken> token( + GetToken(FROM_HERE, TASK_TYPE_DATABASE, std::string())); if (!token) { pending_tasks_.push_back(base::Bind( &DriveFileSyncService::UnregisterOriginForTrackingChanges, @@ -442,7 +443,8 @@ void DriveFileSyncService::EnableOriginForTrackingChanges( if (!metadata_store_->IsOriginDisabled(origin)) return; - scoped_ptr<TaskToken> token(GetToken(FROM_HERE, TASK_TYPE_DATABASE, "")); + scoped_ptr<TaskToken> token( + GetToken(FROM_HERE, TASK_TYPE_DATABASE, std::string())); if (!token) { pending_tasks_.push_back(base::Bind( &DriveFileSyncService::EnableOriginForTrackingChanges, @@ -463,7 +465,8 @@ void DriveFileSyncService::DisableOriginForTrackingChanges( !metadata_store_->IsIncrementalSyncOrigin(origin)) return; - scoped_ptr<TaskToken> token(GetToken(FROM_HERE, TASK_TYPE_DATABASE, "")); + scoped_ptr<TaskToken> token( + GetToken(FROM_HERE, TASK_TYPE_DATABASE, std::string())); if (!token) { pending_tasks_.push_back(base::Bind( &DriveFileSyncService::DisableOriginForTrackingChanges, diff --git a/chrome/browser/tab_contents/spelling_menu_observer_browsertest.cc b/chrome/browser/tab_contents/spelling_menu_observer_browsertest.cc index fd5ca6f..47d6bdb 100644 --- a/chrome/browser/tab_contents/spelling_menu_observer_browsertest.cc +++ b/chrome/browser/tab_contents/spelling_menu_observer_browsertest.cc @@ -301,7 +301,7 @@ IN_PROC_BROWSER_TEST_F(SpellingMenuObserverTest, EnableSpellingService) { new SpellingMenuObserver(menu.get())); menu->SetObserver(observer.get()); menu->GetPrefs()->SetBoolean(prefs::kSpellCheckUseSpellingService, true); - menu->GetPrefs()->SetString(prefs::kSpellCheckDictionary, ""); + menu->GetPrefs()->SetString(prefs::kSpellCheckDictionary, std::string()); content::ContextMenuParams params; params.is_editable = true; diff --git a/chrome/browser/themes/theme_syncable_service_unittest.cc b/chrome/browser/themes/theme_syncable_service_unittest.cc index 8a1829f..8fa7d25 100644 --- a/chrome/browser/themes/theme_syncable_service_unittest.cc +++ b/chrome/browser/themes/theme_syncable_service_unittest.cc @@ -104,7 +104,7 @@ class FakeThemeService : public ThemeService { if (theme_extension_) return theme_extension_->id(); else - return ""; + return std::string(); } const extensions::Extension* theme_extension() const { diff --git a/chrome/browser/translate/translate_manager_browsertest.cc b/chrome/browser/translate/translate_manager_browsertest.cc index 1078295..8f2b12d 100644 --- a/chrome/browser/translate/translate_manager_browsertest.cc +++ b/chrome/browser/translate/translate_manager_browsertest.cc @@ -538,7 +538,7 @@ TEST_F(TranslateManagerBrowserTest, TranslateUnknownLanguage) { RenderViewHostTester::TestOnMessageReceived( rvh(), ChromeViewHostMsg_PageTranslated( - 2, 0, "", "en", TranslateErrors::UNKNOWN_LANGUAGE)); + 2, 0, std::string(), "en", TranslateErrors::UNKNOWN_LANGUAGE)); infobar = GetTranslateInfoBar(); ASSERT_TRUE(infobar != NULL); EXPECT_EQ(TranslateInfoBarDelegate::TRANSLATION_ERROR, diff --git a/chrome/browser/translate/translate_manager_unittest.cc b/chrome/browser/translate/translate_manager_unittest.cc index 9b25c95..6b176a1 100644 --- a/chrome/browser/translate/translate_manager_unittest.cc +++ b/chrome/browser/translate/translate_manager_unittest.cc @@ -16,7 +16,7 @@ typedef testing::Test TranslateManagerTest; TEST_F(TranslateManagerTest, CheckTranslatableURL) { - GURL empty_url = GURL(""); + GURL empty_url = GURL(std::string()); EXPECT_FALSE(TranslateManager::IsTranslatableURL(empty_url)); std::string chrome = std::string(chrome::kChromeUIScheme) + "://flags"; diff --git a/chrome/browser/ui/app_list/app_list_service.cc b/chrome/browser/ui/app_list/app_list_service.cc index f02da1e..a0bf010 100644 --- a/chrome/browser/ui/app_list/app_list_service.cc +++ b/chrome/browser/ui/app_list/app_list_service.cc @@ -66,7 +66,7 @@ void AppListService::RegisterPrefs(PrefRegistrySimple* registry) { registry->RegisterIntegerPref(prefs::kAppListLaunchCount, 0); registry->RegisterInt64Pref(prefs::kLastAppListAppLaunchPing, 0); registry->RegisterIntegerPref(prefs::kAppListAppLaunchCount, 0); - registry->RegisterStringPref(prefs::kAppListProfile, ""); + registry->RegisterStringPref(prefs::kAppListProfile, std::string()); #if defined(OS_WIN) registry->RegisterBooleanPref(prefs::kRestartWithAppList, false); #endif diff --git a/chrome/browser/ui/blocked_content/blocked_content_tab_helper.cc b/chrome/browser/ui/blocked_content/blocked_content_tab_helper.cc index 2ee22c3..844f210 100644 --- a/chrome/browser/ui/blocked_content/blocked_content_tab_helper.cc +++ b/chrome/browser/ui/blocked_content/blocked_content_tab_helper.cc @@ -110,10 +110,8 @@ void BlockedContentTabHelper::AddPopup(content::WebContents* new_contents, if (creator.is_valid() && profile->GetHostContentSettingsMap()->GetContentSetting( - creator, - creator, - CONTENT_SETTINGS_TYPE_POPUPS, - "") == CONTENT_SETTING_ALLOW) { + creator, creator, CONTENT_SETTINGS_TYPE_POPUPS, std::string()) == + CONTENT_SETTING_ALLOW) { content::WebContentsDelegate* delegate = web_contents()->GetDelegate(); if (delegate) { delegate->AddNewContents(web_contents(), diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index 47f07ca..c6b30b8 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -813,9 +813,13 @@ void Browser::OpenFile() { ui::SelectFileDialog::FileTypeInfo file_types; file_types.support_drive = true; select_file_dialog_->SelectFile(ui::SelectFileDialog::SELECT_OPEN_FILE, - string16(), directory, - &file_types, 0, FILE_PATH_LITERAL(""), - parent_window, NULL); + string16(), + directory, + &file_types, + 0, + FILE_PATH_LITERAL(std::string()), + parent_window, + NULL); } void Browser::UpdateDownloadShelfVisibility(bool visible) { diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc index 5e6b769..e253102 100644 --- a/chrome/browser/ui/browser_browsertest.cc +++ b/chrome/browser/ui/browser_browsertest.cc @@ -558,7 +558,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, NullOpenerRedirectForksProcess) { base::FilePath(kDocRoot)); ASSERT_TRUE(https_test_server.Start()); GURL http_url(test_server()->GetURL("files/title1.html")); - GURL https_url(https_test_server.GetURL("")); + GURL https_url(https_test_server.GetURL(std::string())); // Start with an http URL. ui_test_utils::NavigateToURL(browser(), http_url); @@ -647,7 +647,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, OtherRedirectsDontForkProcess) { base::FilePath(kDocRoot)); ASSERT_TRUE(https_test_server.Start()); GURL http_url(test_server()->GetURL("files/title1.html")); - GURL https_url(https_test_server.GetURL("")); + GURL https_url(https_test_server.GetURL(std::string())); // Start with an http URL. ui_test_utils::NavigateToURL(browser(), http_url); @@ -747,7 +747,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, CommandCreateAppShortcutHttp) { browser()->command_controller()->command_updater(); ASSERT_TRUE(test_server()->Start()); - GURL http_url(test_server()->GetURL("")); + GURL http_url(test_server()->GetURL(std::string())); ASSERT_TRUE(http_url.SchemeIs(chrome::kHttpScheme)); ui_test_utils::NavigateToURL(browser(), http_url); EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS)); @@ -775,7 +775,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, CommandCreateAppShortcutFtp) { net::TestServer::kLocalhost, base::FilePath(kDocRoot)); ASSERT_TRUE(test_server.Start()); - GURL ftp_url(test_server.GetURL("")); + GURL ftp_url(test_server.GetURL(std::string())); ASSERT_TRUE(ftp_url.SchemeIs(chrome::kFtpScheme)); ui_test_utils::NavigateToURL(browser(), ftp_url); EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS)); @@ -807,7 +807,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, CommandCreateAppShortcutInvalid) { // DISABLED: http://crbug.com/72310 IN_PROC_BROWSER_TEST_F(BrowserTest, DISABLED_ConvertTabToAppShortcut) { ASSERT_TRUE(test_server()->Start()); - GURL http_url(test_server()->GetURL("")); + GURL http_url(test_server()->GetURL(std::string())); ASSERT_TRUE(http_url.SchemeIs(chrome::kHttpScheme)); ASSERT_EQ(1, browser()->tab_strip_model()->count()); diff --git a/chrome/browser/ui/browser_tab_contents.cc b/chrome/browser/ui/browser_tab_contents.cc index c4fe56c..fdcaa16 100644 --- a/chrome/browser/ui/browser_tab_contents.cc +++ b/chrome/browser/ui/browser_tab_contents.cc @@ -172,8 +172,10 @@ void BrowserTabContents::AttachTabHelpers(WebContents* web_contents) { // because the connected state may change while this tab is open. Having a // one-click signin helper attached does not cause problems if the profile // happens to be already connected. - if (OneClickSigninHelper::CanOffer( - web_contents, OneClickSigninHelper::CAN_OFFER_FOR_ALL, "", NULL)) { + if (OneClickSigninHelper::CanOffer(web_contents, + OneClickSigninHelper::CAN_OFFER_FOR_ALL, + std::string(), + NULL)) { OneClickSigninHelper::CreateForWebContents(web_contents); } #endif diff --git a/chrome/browser/ui/browser_tabrestore.cc b/chrome/browser/ui/browser_tabrestore.cc index 0e96e0d..373de5c 100644 --- a/chrome/browser/ui/browser_tabrestore.cc +++ b/chrome/browser/ui/browser_tabrestore.cc @@ -50,7 +50,7 @@ WebContents* CreateRestoredTab( // session_storage_namespace.h include since we only need that to assign // into the map. content::SessionStorageNamespaceMap session_storage_namespace_map; - session_storage_namespace_map[""] = session_storage_namespace; + session_storage_namespace_map[std::string()] = session_storage_namespace; WebContents::CreateParams create_params( browser->profile(), tab_util::GetSiteInstanceForNewTab(browser->profile(), restore_url)); diff --git a/chrome/browser/ui/certificate_dialogs.cc b/chrome/browser/ui/certificate_dialogs.cc index 8e69b5d..939c3a13 100644 --- a/chrome/browser/ui/certificate_dialogs.cc +++ b/chrome/browser/ui/certificate_dialogs.cc @@ -52,7 +52,7 @@ std::string GetBase64String(net::X509Certificate::OSCertHandle cert) { if (!base::Base64Encode( x509_certificate_model::GetDerString(cert), &base64)) { LOG(ERROR) << "base64 encoding error"; - return ""; + return std::string(); } return "-----BEGIN CERTIFICATE-----\r\n" + WrapAt64(base64) + diff --git a/chrome/browser/ui/chrome_pages.cc b/chrome/browser/ui/chrome_pages.cc index fe9300c..7fed38a 100644 --- a/chrome/browser/ui/chrome_pages.cc +++ b/chrome/browser/ui/chrome_pages.cc @@ -65,7 +65,7 @@ void ShowBookmarkManager(Browser* browser) { } void ShowBookmarkManagerForNode(Browser* browser, int64 node_id) { - OpenBookmarkManagerWithHash(browser, "", node_id); + OpenBookmarkManagerWithHash(browser, std::string(), node_id); } void ShowHistory(Browser* browser) { diff --git a/chrome/browser/ui/chrome_select_file_policy_unittest.cc b/chrome/browser/ui/chrome_select_file_policy_unittest.cc index d5a6c10..0d20463 100644 --- a/chrome/browser/ui/chrome_select_file_policy_unittest.cc +++ b/chrome/browser/ui/chrome_select_file_policy_unittest.cc @@ -56,7 +56,7 @@ class FileSelectionUser : public ui::SelectFileDialog::Listener { file_path, NULL, 0, - FILE_PATH_LITERAL(""), + FILE_PATH_LITERAL(std::string()), NULL, NULL); file_selection_initialisation_in_progress = false; diff --git a/chrome/browser/ui/fullscreen/fullscreen_controller_state_test.cc b/chrome/browser/ui/fullscreen/fullscreen_controller_state_test.cc index 34bb7f0..3c851f4 100644 --- a/chrome/browser/ui/fullscreen/fullscreen_controller_state_test.cc +++ b/chrome/browser/ui/fullscreen/fullscreen_controller_state_test.cc @@ -658,7 +658,7 @@ FullscreenControllerStateTest::StateTransitionInfo std::string FullscreenControllerStateTest::GetAndClearDebugLog() { debugging_log_ << "(End of Debugging Log)\n"; std::string output_log = "\nDebugging Log:\n" + debugging_log_.str(); - debugging_log_.str(""); + debugging_log_.str(std::string()); return output_log; } diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.cc index 3796706..a4d0a2b 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.cc +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.cc @@ -462,7 +462,12 @@ bool CreateNewBookmarkFromNetscapeURL(GtkSelectionData* selection_data, string16 GetNameForURL(const GURL& url) { if (url.is_valid()) { - return net::GetSuggestedFilename(url, "", "", "", "", std::string()); + return net::GetSuggestedFilename(url, + std::string(), + std::string(), + std::string(), + std::string(), + std::string()); } else { return l10n_util::GetStringUTF16(IDS_APP_UNTITLED_SHORTCUT_FILE_NAME); } diff --git a/chrome/browser/ui/gtk/constrained_web_dialog_delegate_gtk.cc b/chrome/browser/ui/gtk/constrained_web_dialog_delegate_gtk.cc index fe42588..fdb10b5 100644 --- a/chrome/browser/ui/gtk/constrained_web_dialog_delegate_gtk.cc +++ b/chrome/browser/ui/gtk/constrained_web_dialog_delegate_gtk.cc @@ -127,7 +127,7 @@ ConstrainedWebDialogDelegateViewGtk::ConstrainedWebDialogDelegateViewGtk( void ConstrainedWebDialogDelegateViewGtk::OnDestroy(GtkWidget* widget) { if (!impl_->closed_via_webui()) - GetWebDialogDelegate()->OnDialogClosed(""); + GetWebDialogDelegate()->OnDialogClosed(std::string()); delete this; } diff --git a/chrome/browser/ui/gtk/first_run_bubble.cc b/chrome/browser/ui/gtk/first_run_bubble.cc index 7207758..70bf245 100644 --- a/chrome/browser/ui/gtk/first_run_bubble.cc +++ b/chrome/browser/ui/gtk/first_run_bubble.cc @@ -44,10 +44,12 @@ FirstRunBubble::FirstRunBubble(Browser* browser, : browser_(browser), bubble_(NULL) { GtkThemeService* theme_service = GtkThemeService::GetFrom(browser->profile()); - GtkWidget* title = theme_service->BuildLabel("", ui::kGdkBlack); - char* markup = g_markup_printf_escaped(kSearchLabelMarkup, + GtkWidget* title = theme_service->BuildLabel(std::string(), ui::kGdkBlack); + char* markup = g_markup_printf_escaped( + kSearchLabelMarkup, l10n_util::GetStringFUTF8(IDS_FR_BUBBLE_TITLE, - GetDefaultSearchEngineName(browser->profile())).c_str()); + GetDefaultSearchEngineName(browser->profile())) + .c_str()); gtk_label_set_markup(GTK_LABEL(title), markup); g_free(markup); diff --git a/chrome/browser/ui/gtk/location_bar_view_gtk.cc b/chrome/browser/ui/gtk/location_bar_view_gtk.cc index befcd30..9bd0ebb 100644 --- a/chrome/browser/ui/gtk/location_bar_view_gtk.cc +++ b/chrome/browser/ui/gtk/location_bar_view_gtk.cc @@ -410,9 +410,9 @@ void LocationBarViewGtk::Init(bool popup_window_mode) { // Tab to search (the keyword box on the left hand side). tab_to_search_full_label_ = - theme_service_->BuildLabel("", ui::kGdkBlack); + theme_service_->BuildLabel(std::string(), ui::kGdkBlack); tab_to_search_partial_label_ = - theme_service_->BuildLabel("", ui::kGdkBlack); + theme_service_->BuildLabel(std::string(), ui::kGdkBlack); GtkWidget* tab_to_search_label_hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(tab_to_search_label_hbox), tab_to_search_full_label_, FALSE, FALSE, 0); @@ -458,12 +458,12 @@ void LocationBarViewGtk::Init(bool popup_window_mode) { tab_to_search_hint_ = gtk_hbox_new(FALSE, 0); gtk_widget_set_name(tab_to_search_hint_, "chrome-tab-to-search-hint"); tab_to_search_hint_leading_label_ = - theme_service_->BuildLabel("", kHintTextColor); + theme_service_->BuildLabel(std::string(), kHintTextColor); gtk_widget_set_sensitive(tab_to_search_hint_leading_label_, FALSE); tab_to_search_hint_icon_ = gtk_image_new_from_pixbuf( rb.GetNativeImageNamed(IDR_LOCATION_BAR_KEYWORD_HINT_TAB).ToGdkPixbuf()); tab_to_search_hint_trailing_label_ = - theme_service_->BuildLabel("", kHintTextColor); + theme_service_->BuildLabel(std::string(), kHintTextColor); gtk_widget_set_sensitive(tab_to_search_hint_trailing_label_, FALSE); gtk_box_pack_start(GTK_BOX(tab_to_search_hint_), tab_to_search_hint_leading_label_, diff --git a/chrome/browser/ui/gtk/ssl_client_certificate_selector.cc b/chrome/browser/ui/gtk/ssl_client_certificate_selector.cc index ebf2e78..d96e1d2 100644 --- a/chrome/browser/ui/gtk/ssl_client_certificate_selector.cc +++ b/chrome/browser/ui/gtk/ssl_client_certificate_selector.cc @@ -249,7 +249,7 @@ std::string SSLClientCertificateSelector::FormatComboBoxText( net::X509Certificate::OSCertHandle cert, const std::string& nickname) { std::string rv(nickname); rv += " ["; - rv += x509_certificate_model::GetSerialNumberHexified(cert, ""); + rv += x509_certificate_model::GetSerialNumberHexified(cert, std::string()); rv += ']'; return rv; } @@ -266,8 +266,8 @@ std::string SSLClientCertificateSelector::FormatDetailsText( rv += "\n "; rv += l10n_util::GetStringFUTF8( IDS_CERT_SERIAL_NUMBER_FORMAT, - UTF8ToUTF16( - x509_certificate_model::GetSerialNumberHexified(cert, ""))); + UTF8ToUTF16(x509_certificate_model::GetSerialNumberHexified( + cert, std::string()))); base::Time issued, expires; if (x509_certificate_model::GetTimes(cert, &issued, &expires)) { diff --git a/chrome/browser/ui/prefs/prefs_tab_helper.cc b/chrome/browser/ui/prefs/prefs_tab_helper.cc index b629064..7056161 100644 --- a/chrome/browser/ui/prefs/prefs_tab_helper.cc +++ b/chrome/browser/ui/prefs/prefs_tab_helper.cc @@ -152,7 +152,7 @@ ALL_FONT_SCRIPTS(WEBKIT_WEBPREFS_FONTS_STANDARD) // We haven't already set a default value for this font preference, so set // an empty string as the default. registry->RegisterStringPref( - pref_name, "", PrefRegistrySyncable::UNSYNCABLE_PREF); + pref_name, std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); } } } @@ -587,7 +587,7 @@ void PrefsTabHelper::RegisterUserPrefs(PrefRegistrySyncable* registry) { IDS_STATIC_ENCODING_LIST, PrefRegistrySyncable::UNSYNCABLE_PREF); registry->RegisterStringPref(prefs::kRecentlySelectedEncoding, - "", + std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); RegisterPrefsToMigrate(registry); @@ -666,7 +666,7 @@ void PrefsTabHelper::OnWebPrefChanged(const std::string& pref_name) { if (pref_value.empty()) { WebPreferences web_prefs = web_contents_->GetRenderViewHost()->GetWebkitPreferences(); - OverrideFontFamily(&web_prefs, generic_family, script, ""); + OverrideFontFamily(&web_prefs, generic_family, script, std::string()); web_contents_->GetRenderViewHost()->UpdateWebkitPreferences(web_prefs); return; } diff --git a/chrome/browser/ui/search/instant_browsertest.cc b/chrome/browser/ui/search/instant_browsertest.cc index 6afe15b..2e4beb2 100644 --- a/chrome/browser/ui/search/instant_browsertest.cc +++ b/chrome/browser/ui/search/instant_browsertest.cc @@ -607,7 +607,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, PageVisibility) { EXPECT_TRUE(CheckVisibilityIs(overlay, true)); // Deleting the omnibox text should hide the overlay. - SetOmniboxText(""); + SetOmniboxText(std::string()); EXPECT_TRUE(CheckVisibilityIs(active_tab, true)); EXPECT_TRUE(CheckVisibilityIs(overlay, false)); diff --git a/chrome/browser/ui/startup/startup_browser_creator_impl.cc b/chrome/browser/ui/startup/startup_browser_creator_impl.cc index 7600026..1d0cff3 100644 --- a/chrome/browser/ui/startup/startup_browser_creator_impl.cc +++ b/chrome/browser/ui/startup/startup_browser_creator_impl.cc @@ -933,8 +933,8 @@ void StartupBrowserCreatorImpl::AddStartupURLs( GURL(std::string(chrome::kChromeUISettingsURL) + chrome::kManagedUserSettingsSubPage)); if (has_reset_local_passphrase_switch) { - prefs->SetString(prefs::kManagedModeLocalPassphrase, ""); - prefs->SetString(prefs::kManagedModeLocalSalt, ""); + prefs->SetString(prefs::kManagedModeLocalPassphrase, std::string()); + prefs->SetString(prefs::kManagedModeLocalSalt, std::string()); } } diff --git a/chrome/browser/ui/sync/one_click_signin_helper_unittest.cc b/chrome/browser/ui/sync/one_click_signin_helper_unittest.cc index e879b6e..4892ab6 100644 --- a/chrome/browser/ui/sync/one_click_signin_helper_unittest.cc +++ b/chrome/browser/ui/sync/one_click_signin_helper_unittest.cc @@ -389,13 +389,15 @@ TEST_F(OneClickSigninHelperTest, CanOfferNoContents) { "user@gmail.com", &error_message)); EXPECT_EQ("", error_message); EXPECT_FALSE(OneClickSigninHelper::CanOffer( - NULL, OneClickSigninHelper::CAN_OFFER_FOR_INTERSTITAL_ONLY, - "", &error_message)); + NULL, + OneClickSigninHelper::CAN_OFFER_FOR_INTERSTITAL_ONLY, + std::string(), + &error_message)); EXPECT_EQ("", error_message); } TEST_F(OneClickSigninHelperTest, CanOffer) { - CreateSigninManager(false, ""); + CreateSigninManager(false, std::string()); EXPECT_CALL(*signin_manager_, IsAllowedUsername(_)). WillRepeatedly(Return(true)); @@ -408,9 +410,10 @@ TEST_F(OneClickSigninHelperTest, CanOffer) { web_contents(), OneClickSigninHelper::CAN_OFFER_FOR_ALL, "user@gmail.com", NULL)); EXPECT_TRUE(OneClickSigninHelper::CanOffer( - web_contents(), - OneClickSigninHelper::CAN_OFFER_FOR_INTERSTITAL_ONLY, - "", NULL)); + web_contents(), + OneClickSigninHelper::CAN_OFFER_FOR_INTERSTITAL_ONLY, + std::string(), + NULL)); EnableOneClick(false); @@ -424,14 +427,15 @@ TEST_F(OneClickSigninHelperTest, CanOffer) { web_contents(), OneClickSigninHelper::CAN_OFFER_FOR_ALL, "user@gmail.com", &error_message)); EXPECT_FALSE(OneClickSigninHelper::CanOffer( - web_contents(), - OneClickSigninHelper::CAN_OFFER_FOR_INTERSTITAL_ONLY, - "", &error_message)); + web_contents(), + OneClickSigninHelper::CAN_OFFER_FOR_INTERSTITAL_ONLY, + std::string(), + &error_message)); EXPECT_EQ("", error_message); } TEST_F(OneClickSigninHelperTest, CanOfferFirstSetup) { - CreateSigninManager(false, ""); + CreateSigninManager(false, std::string()); EXPECT_CALL(*signin_manager_, IsAllowedUsername(_)). WillRepeatedly(Return(true)); @@ -454,8 +458,10 @@ TEST_F(OneClickSigninHelperTest, CanOfferFirstSetup) { OneClickSigninHelper::CAN_OFFER_FOR_INTERSTITAL_ONLY, "foo@gmail.com", NULL)); EXPECT_TRUE(OneClickSigninHelper::CanOffer( - web_contents(), OneClickSigninHelper::CAN_OFFER_FOR_INTERSTITAL_ONLY, - "", NULL)); + web_contents(), + OneClickSigninHelper::CAN_OFFER_FOR_INTERSTITAL_ONLY, + std::string(), + NULL)); } TEST_F(OneClickSigninHelperTest, CanOfferProfileConnected) { @@ -492,12 +498,14 @@ TEST_F(OneClickSigninHelperTest, CanOfferProfileConnected) { UTF8ToUTF16("foo@gmail.com")), error_message); EXPECT_TRUE(OneClickSigninHelper::CanOffer( - web_contents(), OneClickSigninHelper::CAN_OFFER_FOR_INTERSTITAL_ONLY, - "", &error_message)); + web_contents(), + OneClickSigninHelper::CAN_OFFER_FOR_INTERSTITAL_ONLY, + std::string(), + &error_message)); } TEST_F(OneClickSigninHelperTest, CanOfferUsernameNotAllowed) { - CreateSigninManager(false, ""); + CreateSigninManager(false, std::string()); EXPECT_CALL(*signin_manager_, IsAllowedUsername(_)). WillRepeatedly(Return(false)); @@ -513,16 +521,15 @@ TEST_F(OneClickSigninHelperTest, CanOfferUsernameNotAllowed) { "foo@gmail.com", &error_message)); EXPECT_EQ(l10n_util::GetStringUTF8(IDS_SYNC_LOGIN_NAME_PROHIBITED), error_message); - EXPECT_TRUE( - OneClickSigninHelper::CanOffer( - web_contents(), - OneClickSigninHelper::CAN_OFFER_FOR_INTERSTITAL_ONLY, - "", - &error_message)); + EXPECT_TRUE(OneClickSigninHelper::CanOffer( + web_contents(), + OneClickSigninHelper::CAN_OFFER_FOR_INTERSTITAL_ONLY, + std::string(), + &error_message)); } TEST_F(OneClickSigninHelperTest, CanOfferWithRejectedEmail) { - CreateSigninManager(false, ""); + CreateSigninManager(false, std::string()); EXPECT_CALL(*signin_manager_, IsAllowedUsername(_)). WillRepeatedly(Return(true)); @@ -551,7 +558,7 @@ TEST_F(OneClickSigninHelperTest, CanOfferWithRejectedEmail) { } TEST_F(OneClickSigninHelperTest, CanOfferIncognito) { - CreateSigninManager(true, ""); + CreateSigninManager(true, std::string()); std::string error_message; EXPECT_FALSE(OneClickSigninHelper::CanOffer( @@ -563,13 +570,15 @@ TEST_F(OneClickSigninHelperTest, CanOfferIncognito) { "user@gmail.com", &error_message)); EXPECT_EQ("", error_message); EXPECT_FALSE(OneClickSigninHelper::CanOffer( - web_contents(), OneClickSigninHelper::CAN_OFFER_FOR_INTERSTITAL_ONLY, - "", &error_message)); + web_contents(), + OneClickSigninHelper::CAN_OFFER_FOR_INTERSTITAL_ONLY, + std::string(), + &error_message)); EXPECT_EQ("", error_message); } TEST_F(OneClickSigninHelperTest, CanOfferNoSigninCookies) { - CreateSigninManager(false, ""); + CreateSigninManager(false, std::string()); AllowSigninCookies(false); EXPECT_CALL(*signin_manager_, IsAllowedUsername(_)). @@ -585,8 +594,10 @@ TEST_F(OneClickSigninHelperTest, CanOfferNoSigninCookies) { "user@gmail.com", &error_message)); EXPECT_EQ("", error_message); EXPECT_FALSE(OneClickSigninHelper::CanOffer( - web_contents(), OneClickSigninHelper::CAN_OFFER_FOR_INTERSTITAL_ONLY, - "", &error_message)); + web_contents(), + OneClickSigninHelper::CAN_OFFER_FOR_INTERSTITAL_ONLY, + std::string(), + &error_message)); EXPECT_EQ("", error_message); } @@ -595,7 +606,7 @@ TEST_F(OneClickSigninHelperTest, CanOfferUntrustedProcess) { ASSERT_NE(trusted.GetID(), process()->GetID()); // Make sure the RenderProcessHost used by the test is untrusted. SetTrustedSigninProcessID(trusted.GetID()); - CreateSigninManager(false, ""); + CreateSigninManager(false, std::string()); EXPECT_CALL(*signin_manager_, IsAllowedUsername(_)). WillRepeatedly(Return(true)); @@ -607,7 +618,7 @@ TEST_F(OneClickSigninHelperTest, CanOfferUntrustedProcess) { } TEST_F(OneClickSigninHelperTest, CanOfferDisabledByPolicy) { - CreateSigninManager(false, ""); + CreateSigninManager(false, std::string()); EXPECT_CALL(*signin_manager_, IsAllowedUsername(_)). WillRepeatedly(Return(true)); @@ -642,7 +653,7 @@ TEST_F(OneClickSigninHelperTest, CanOfferDisabledByPolicy) { // Should not crash if a helper instance is not associated with an incognito // web contents. TEST_F(OneClickSigninHelperTest, ShowInfoBarUIThreadIncognito) { - CreateSigninManager(true, ""); + CreateSigninManager(true, std::string()); OneClickSigninHelper* helper = OneClickSigninHelper::FromWebContents(web_contents()); EXPECT_EQ(NULL, helper); @@ -657,9 +668,9 @@ TEST_F(OneClickSigninHelperTest, ShowInfoBarUIThreadIncognito) { // config sync, then Chrome should redirect immidiately to sync settings page, // and upon successful setup, redirect back to webstore. TEST_F(OneClickSigninHelperTest, SigninFromWebstoreWithConfigSyncfirst) { - CreateSigninManager(false, ""); - EXPECT_CALL(*signin_manager_, IsAllowedUsername(_)). - WillRepeatedly(Return(true)); + CreateSigninManager(false, std::string()); + EXPECT_CALL(*signin_manager_, IsAllowedUsername(_)) + .WillRepeatedly(Return(true)); CreateProfileSyncServiceMock(); @@ -687,9 +698,9 @@ TEST_F(OneClickSigninHelperTest, SigninFromWebstoreWithConfigSyncfirst) { } TEST_F(OneClickSigninHelperTest, ShowSigninBubbleAfterSigninComplete) { - CreateSigninManager(false, ""); - EXPECT_CALL(*signin_manager_, IsAllowedUsername(_)). - WillRepeatedly(Return(true)); + CreateSigninManager(false, std::string()); + EXPECT_CALL(*signin_manager_, IsAllowedUsername(_)) + .WillRepeatedly(Return(true)); CreateProfileSyncServiceMock(); @@ -725,31 +736,34 @@ TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThread) { scoped_ptr<TestProfileIOData> io_data(CreateTestProfileIOData(false)); EXPECT_EQ(OneClickSigninHelper::CAN_OFFER, OneClickSigninHelper::CanOfferOnIOThreadImpl( - valid_gaia_url_, "", &request_, io_data.get())); + valid_gaia_url_, std::string(), &request_, io_data.get())); } TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThreadIncognito) { scoped_ptr<TestProfileIOData> io_data(CreateTestProfileIOData(true)); EXPECT_EQ(OneClickSigninHelper::DONT_OFFER, OneClickSigninHelper::CanOfferOnIOThreadImpl( - valid_gaia_url_, "", &request_, io_data.get())); + valid_gaia_url_, std::string(), &request_, io_data.get())); } TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThreadNoIOData) { EXPECT_EQ(OneClickSigninHelper::DONT_OFFER, OneClickSigninHelper::CanOfferOnIOThreadImpl( - valid_gaia_url_, "", &request_, NULL)); + valid_gaia_url_, std::string(), &request_, NULL)); } TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThreadBadURL) { scoped_ptr<TestProfileIOData> io_data(CreateTestProfileIOData(false)); + EXPECT_EQ( + OneClickSigninHelper::IGNORE_REQUEST, + OneClickSigninHelper::CanOfferOnIOThreadImpl( + GURL("https://foo.com/"), std::string(), &request_, io_data.get())); EXPECT_EQ(OneClickSigninHelper::IGNORE_REQUEST, OneClickSigninHelper::CanOfferOnIOThreadImpl( - GURL("https://foo.com/"), "", &request_, io_data.get())); - EXPECT_EQ(OneClickSigninHelper::IGNORE_REQUEST, - OneClickSigninHelper::CanOfferOnIOThreadImpl( - GURL("http://accounts.google.com/"), "", - &request_, io_data.get())); + GURL("http://accounts.google.com/"), + std::string(), + &request_, + io_data.get())); } TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThreadReferrer) { @@ -796,7 +810,7 @@ TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThreadDisabled) { scoped_ptr<TestProfileIOData> io_data(CreateTestProfileIOData(false)); EXPECT_EQ(OneClickSigninHelper::DONT_OFFER, OneClickSigninHelper::CanOfferOnIOThreadImpl( - valid_gaia_url_, "", &request_, io_data.get())); + valid_gaia_url_, std::string(), &request_, io_data.get())); } TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThreadSignedIn) { @@ -806,7 +820,7 @@ TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThreadSignedIn) { scoped_ptr<TestProfileIOData> io_data(CreateTestProfileIOData(false)); EXPECT_EQ(OneClickSigninHelper::DONT_OFFER, OneClickSigninHelper::CanOfferOnIOThreadImpl( - valid_gaia_url_, "", &request_, io_data.get())); + valid_gaia_url_, std::string(), &request_, io_data.get())); } TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThreadEmailNotAllowed) { @@ -814,7 +828,7 @@ TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThreadEmailNotAllowed) { scoped_ptr<TestProfileIOData> io_data(CreateTestProfileIOData(false)); EXPECT_EQ(OneClickSigninHelper::DONT_OFFER, OneClickSigninHelper::CanOfferOnIOThreadImpl( - valid_gaia_url_, "", &request_, io_data.get())); + valid_gaia_url_, std::string(), &request_, io_data.get())); } TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThreadEmailAlreadyUsed) { @@ -827,7 +841,7 @@ TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThreadEmailAlreadyUsed) { scoped_ptr<TestProfileIOData> io_data(CreateTestProfileIOData(false)); EXPECT_EQ(OneClickSigninHelper::DONT_OFFER, OneClickSigninHelper::CanOfferOnIOThreadImpl( - valid_gaia_url_, "", &request_, io_data.get())); + valid_gaia_url_, std::string(), &request_, io_data.get())); } TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThreadWithRejectedEmail) { @@ -835,7 +849,7 @@ TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThreadWithRejectedEmail) { scoped_ptr<TestProfileIOData> io_data(CreateTestProfileIOData(false)); EXPECT_EQ(OneClickSigninHelper::DONT_OFFER, OneClickSigninHelper::CanOfferOnIOThreadImpl( - valid_gaia_url_, "", &request_, io_data.get())); + valid_gaia_url_, std::string(), &request_, io_data.get())); } TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThreadNoSigninCookies) { @@ -843,14 +857,14 @@ TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThreadNoSigninCookies) { scoped_ptr<TestProfileIOData> io_data(CreateTestProfileIOData(false)); EXPECT_EQ(OneClickSigninHelper::DONT_OFFER, OneClickSigninHelper::CanOfferOnIOThreadImpl( - valid_gaia_url_, "", &request_, io_data.get())); + valid_gaia_url_, std::string(), &request_, io_data.get())); } TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThreadDisabledByPolicy) { scoped_ptr<TestProfileIOData> io_data(CreateTestProfileIOData(false)); EXPECT_EQ(OneClickSigninHelper::CAN_OFFER, OneClickSigninHelper::CanOfferOnIOThreadImpl( - valid_gaia_url_, "", &request_, io_data.get())); + valid_gaia_url_, std::string(), &request_, io_data.get())); // Simulate a policy disabling signin by writing kSigninAllowed directly. // We should not offer to sign in the browser. @@ -858,7 +872,7 @@ TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThreadDisabledByPolicy) { prefs::kSigninAllowed, base::Value::CreateBooleanValue(false)); EXPECT_EQ(OneClickSigninHelper::DONT_OFFER, OneClickSigninHelper::CanOfferOnIOThreadImpl( - valid_gaia_url_, "", &request_, io_data.get())); + valid_gaia_url_, std::string(), &request_, io_data.get())); // Reset the preference. profile_->GetTestingPrefService()->SetManagedPref( @@ -870,5 +884,5 @@ TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThreadDisabledByPolicy) { prefs::kSyncManaged, base::Value::CreateBooleanValue(true)); EXPECT_EQ(OneClickSigninHelper::CAN_OFFER, OneClickSigninHelper::CanOfferOnIOThreadImpl( - valid_gaia_url_, "", &request_, io_data.get())); + valid_gaia_url_, std::string(), &request_, io_data.get())); } diff --git a/chrome/browser/ui/sync/tab_contents_synced_tab_delegate.cc b/chrome/browser/ui/sync/tab_contents_synced_tab_delegate.cc index 4b003cf..4115f18 100644 --- a/chrome/browser/ui/sync/tab_contents_synced_tab_delegate.cc +++ b/chrome/browser/ui/sync/tab_contents_synced_tab_delegate.cc @@ -43,7 +43,7 @@ Profile* TabContentsSyncedTabDelegate::profile() const { std::string TabContentsSyncedTabDelegate::GetExtensionAppId() const { const scoped_refptr<const extensions::Extension> extension_app( extensions::TabHelper::FromWebContents(web_contents_)->extension_app()); - return (extension_app.get() ? extension_app->id() : ""); + return (extension_app.get() ? extension_app->id() : std::string()); } int TabContentsSyncedTabDelegate::GetCurrentEntryIndex() const { diff --git a/chrome/browser/ui/website_settings/website_settings.cc b/chrome/browser/ui/website_settings/website_settings.cc index daf7257..8a37c39 100644 --- a/chrome/browser/ui/website_settings/website_settings.cc +++ b/chrome/browser/ui/website_settings/website_settings.cc @@ -143,12 +143,18 @@ void WebsiteSettings::OnSitePermissionChanged(ContentSettingsType type, secondary_pattern = ContentSettingsPattern::Wildcard(); // Set permission for both microphone and camera. content_settings_->SetContentSetting( - primary_pattern, secondary_pattern, - CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, "", setting); + primary_pattern, + secondary_pattern, + CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, + std::string(), + setting); content_settings_->SetContentSetting( - primary_pattern, secondary_pattern, - CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, "", setting); + primary_pattern, + secondary_pattern, + CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, + std::string(), + setting); break; } default: @@ -167,7 +173,7 @@ void WebsiteSettings::OnSitePermissionChanged(ContentSettingsType type, // can not create media settings exceptions by hand. content_settings::SettingInfo info; scoped_ptr<Value> v(content_settings_->GetWebsiteSetting( - site_url_, site_url_, type, "", &info)); + site_url_, site_url_, type, std::string(), &info)); DCHECK(info.source == content_settings::SETTING_SOURCE_USER); ContentSettingsPattern::Relation r1 = info.primary_pattern.Compare(primary_pattern); @@ -188,7 +194,7 @@ void WebsiteSettings::OnSitePermissionChanged(ContentSettingsType type, if (setting != CONTENT_SETTING_DEFAULT) value = Value::CreateIntegerValue(setting); content_settings_->SetWebsiteSetting( - primary_pattern, secondary_pattern, type, "", value); + primary_pattern, secondary_pattern, type, std::string(), value); } show_info_bar_ = true; @@ -452,14 +458,20 @@ void WebsiteSettings::PresentSitePermissions() { content_settings::SettingInfo info; if (permission_info.type == CONTENT_SETTINGS_TYPE_MEDIASTREAM) { scoped_ptr<base::Value> mic_value(content_settings_->GetWebsiteSetting( - site_url_, site_url_, CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, - "", &info)); + site_url_, + site_url_, + CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, + std::string(), + &info)); ContentSetting mic_setting = content_settings::ValueToContentSetting(mic_value.get()); scoped_ptr<base::Value> camera_value(content_settings_->GetWebsiteSetting( - site_url_, site_url_, CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, - "", &info)); + site_url_, + site_url_, + CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, + std::string(), + &info)); ContentSetting camera_setting = content_settings::ValueToContentSetting(camera_value.get()); @@ -469,7 +481,7 @@ void WebsiteSettings::PresentSitePermissions() { permission_info.setting = mic_setting; } else { scoped_ptr<Value> value(content_settings_->GetWebsiteSetting( - site_url_, site_url_, permission_info.type, "", &info)); + site_url_, site_url_, permission_info.type, std::string(), &info)); DCHECK(value.get()); if (value->GetType() == Value::TYPE_INTEGER) { permission_info.setting = diff --git a/chrome/browser/ui/website_settings/website_settings_unittest.cc b/chrome/browser/ui/website_settings/website_settings_unittest.cc index 4fe881a..8f486af 100644 --- a/chrome/browser/ui/website_settings/website_settings_unittest.cc +++ b/chrome/browser/ui/website_settings/website_settings_unittest.cc @@ -165,22 +165,22 @@ TEST_F(WebsiteSettingsTest, OnPermissionsChanged) { HostContentSettingsMap* content_settings = profile()->GetHostContentSettingsMap(); ContentSetting setting = content_settings->GetContentSetting( - url(), url(), CONTENT_SETTINGS_TYPE_POPUPS, ""); + url(), url(), CONTENT_SETTINGS_TYPE_POPUPS, std::string()); EXPECT_EQ(setting, CONTENT_SETTING_BLOCK); setting = content_settings->GetContentSetting( - url(), url(), CONTENT_SETTINGS_TYPE_PLUGINS, ""); + url(), url(), CONTENT_SETTINGS_TYPE_PLUGINS, std::string()); EXPECT_EQ(setting, CONTENT_SETTING_ALLOW); setting = content_settings->GetContentSetting( - url(), url(), CONTENT_SETTINGS_TYPE_GEOLOCATION, ""); + url(), url(), CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string()); EXPECT_EQ(setting, CONTENT_SETTING_ASK); setting = content_settings->GetContentSetting( - url(), url(), CONTENT_SETTINGS_TYPE_NOTIFICATIONS, ""); + url(), url(), CONTENT_SETTINGS_TYPE_NOTIFICATIONS, std::string()); EXPECT_EQ(setting, CONTENT_SETTING_ASK); setting = content_settings->GetContentSetting( - url(), url(), CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, ""); + url(), url(), CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, std::string()); EXPECT_EQ(setting, CONTENT_SETTING_ASK); setting = content_settings->GetContentSetting( - url(), url(), CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, ""); + url(), url(), CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, std::string()); EXPECT_EQ(setting, CONTENT_SETTING_ASK); EXPECT_CALL(*mock_ui(), SetIdentityInfo(_)); @@ -212,22 +212,22 @@ TEST_F(WebsiteSettingsTest, OnPermissionsChanged) { // Verify that the site permissions were changed correctly. setting = content_settings->GetContentSetting( - url(), url(), CONTENT_SETTINGS_TYPE_POPUPS, ""); + url(), url(), CONTENT_SETTINGS_TYPE_POPUPS, std::string()); EXPECT_EQ(setting, CONTENT_SETTING_ALLOW); setting = content_settings->GetContentSetting( - url(), url(), CONTENT_SETTINGS_TYPE_PLUGINS, ""); + url(), url(), CONTENT_SETTINGS_TYPE_PLUGINS, std::string()); EXPECT_EQ(setting, CONTENT_SETTING_BLOCK); setting = content_settings->GetContentSetting( - url(), url(), CONTENT_SETTINGS_TYPE_GEOLOCATION, ""); + url(), url(), CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string()); EXPECT_EQ(setting, CONTENT_SETTING_ALLOW); setting = content_settings->GetContentSetting( - url(), url(), CONTENT_SETTINGS_TYPE_NOTIFICATIONS, ""); + url(), url(), CONTENT_SETTINGS_TYPE_NOTIFICATIONS, std::string()); EXPECT_EQ(setting, CONTENT_SETTING_ALLOW); setting = content_settings->GetContentSetting( - url(), url(), CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, ""); + url(), url(), CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, std::string()); EXPECT_EQ(setting, CONTENT_SETTING_ALLOW); setting = content_settings->GetContentSetting( - url(), url(), CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, ""); + url(), url(), CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, std::string()); EXPECT_EQ(setting, CONTENT_SETTING_ALLOW); } diff --git a/chrome/browser/ui/webui/about_ui.cc b/chrome/browser/ui/webui/about_ui.cc index 861d2be..b2dc2ae 100644 --- a/chrome/browser/ui/webui/about_ui.cc +++ b/chrome/browser/ui/webui/about_ui.cc @@ -785,15 +785,21 @@ std::string AboutSandbox() { data.append("<table>"); - AboutSandboxRow(&data, "", IDS_ABOUT_SANDBOX_SUID_SANDBOX, + AboutSandboxRow(&data, + std::string(), + IDS_ABOUT_SANDBOX_SUID_SANDBOX, status & content::kSandboxLinuxSUID); AboutSandboxRow(&data, " ", IDS_ABOUT_SANDBOX_PID_NAMESPACES, status & content::kSandboxLinuxPIDNS); AboutSandboxRow(&data, " ", IDS_ABOUT_SANDBOX_NET_NAMESPACES, status & content::kSandboxLinuxNetNS); - AboutSandboxRow(&data, "", IDS_ABOUT_SANDBOX_SECCOMP_LEGACY_SANDBOX, + AboutSandboxRow(&data, + std::string(), + IDS_ABOUT_SANDBOX_SECCOMP_LEGACY_SANDBOX, status & content::kSandboxLinuxSeccompLegacy); - AboutSandboxRow(&data, "", IDS_ABOUT_SANDBOX_SECCOMP_BPF_SANDBOX, + AboutSandboxRow(&data, + std::string(), + IDS_ABOUT_SANDBOX_SECCOMP_BPF_SANDBOX, status & content::kSandboxLinuxSeccompBpf); data.append("</table>"); diff --git a/chrome/browser/ui/webui/downloads_dom_handler_browsertest.cc b/chrome/browser/ui/webui/downloads_dom_handler_browsertest.cc index 0bfa286..19e6404 100644 --- a/chrome/browser/ui/webui/downloads_dom_handler_browsertest.cc +++ b/chrome/browser/ui/webui/downloads_dom_handler_browsertest.cc @@ -147,7 +147,7 @@ IN_PROC_BROWSER_TEST_F(DownloadsDOMHandlerTest, base::FilePath(FILE_PATH_LITERAL("/path/to/file")), base::FilePath(FILE_PATH_LITERAL("/path/to/file")), url_chain, - GURL(""), + GURL(std::string()), current, current, 128, diff --git a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc index bd3bc6f..914939e 100644 --- a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc +++ b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc @@ -930,9 +930,14 @@ void ExtensionSettingsHandler::HandleLoadUnpackedExtensionMessage( load_extension_dialog_ = ui::SelectFileDialog::Create( this, new ChromeSelectFilePolicy(web_ui()->GetWebContents())); load_extension_dialog_->SelectFile( - kSelectType, select_title, last_unpacked_directory_, NULL, - kFileTypeIndex, FILE_PATH_LITERAL(""), - web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(), NULL); + kSelectType, + select_title, + last_unpacked_directory_, + NULL, + kFileTypeIndex, + FILE_PATH_LITERAL(std::string()), + web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(), + NULL); } void ExtensionSettingsHandler::ShowAlert(const std::string& message) { diff --git a/chrome/browser/ui/webui/extensions/pack_extension_handler.cc b/chrome/browser/ui/webui/extensions/pack_extension_handler.cc index a69cd4d..0623fda 100644 --- a/chrome/browser/ui/webui/extensions/pack_extension_handler.cc +++ b/chrome/browser/ui/webui/extensions/pack_extension_handler.cc @@ -184,8 +184,12 @@ void PackExtensionHandler::HandleSelectFilePathMessage( load_extension_dialog_ = ui::SelectFileDialog::Create( this, new ChromeSelectFilePolicy(web_ui()->GetWebContents())); load_extension_dialog_->SelectFile( - type, select_title, base::FilePath(), &info, file_type_index, - FILE_PATH_LITERAL(""), + type, + select_title, + base::FilePath(), + &info, + file_type_index, + FILE_PATH_LITERAL(std::string()), web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(), NULL); } diff --git a/chrome/browser/ui/webui/favicon_source.cc b/chrome/browser/ui/webui/favicon_source.cc index 6864120..232b6eb 100644 --- a/chrome/browser/ui/webui/favicon_source.cc +++ b/chrome/browser/ui/webui/favicon_source.cc @@ -253,10 +253,8 @@ void FaviconSource::OnFaviconDataAvailable( void FaviconSource::SendDefaultResponse( const content::URLDataSource::GotDataCallback& callback) { - SendDefaultResponse(IconRequest(callback, - "", - 16, - ui::SCALE_FACTOR_100P)); + SendDefaultResponse( + IconRequest(callback, std::string(), 16, ui::SCALE_FACTOR_100P)); } void FaviconSource::SendDefaultResponse(const IconRequest& icon_request) { diff --git a/chrome/browser/ui/webui/feedback_ui.cc b/chrome/browser/ui/webui/feedback_ui.cc index 3cb20bf..b28e065 100644 --- a/chrome/browser/ui/webui/feedback_ui.cc +++ b/chrome/browser/ui/webui/feedback_ui.cc @@ -409,23 +409,23 @@ bool FeedbackHandler::Init() { std::string query_str = *it; if (StartsWithASCII(query_str, std::string(kSessionIDParameter), true)) { ReplaceFirstSubstringAfterOffset( - &query_str, 0, kSessionIDParameter, ""); + &query_str, 0, kSessionIDParameter, std::string()); if (!base::StringToInt(query_str, &session_id)) return false; } else if (StartsWithASCII(*it, std::string(kTabIndexParameter), true)) { ReplaceFirstSubstringAfterOffset( - &query_str, 0, kTabIndexParameter, ""); + &query_str, 0, kTabIndexParameter, std::string()); if (!base::StringToInt(query_str, &index)) return false; } else if (StartsWithASCII(*it, std::string(kCustomPageUrlParameter), true)) { ReplaceFirstSubstringAfterOffset( - &query_str, 0, kCustomPageUrlParameter, ""); + &query_str, 0, kCustomPageUrlParameter, std::string()); custom_page_url = query_str; } else if (StartsWithASCII(*it, std::string(kCategoryTagParameter), true)) { ReplaceFirstSubstringAfterOffset( - &query_str, 0, kCategoryTagParameter, ""); + &query_str, 0, kCategoryTagParameter, std::string()); category_tag_ = query_str; #if defined(OS_CHROMEOS) } else if (StartsWithASCII(*it, std::string(kTimestampParameter), true)) { diff --git a/chrome/browser/ui/webui/inspect_ui.cc b/chrome/browser/ui/webui/inspect_ui.cc index b0b67c3..b98ea9e 100644 --- a/chrome/browser/ui/webui/inspect_ui.cc +++ b/chrome/browser/ui/webui/inspect_ui.cc @@ -462,7 +462,7 @@ void InspectUI::OnAdbPages( targets.Append(target_data); } - std::string json_string = ""; + std::string json_string; base::JSONWriter::Write(&targets, &json_string); callback.Run(base::RefCountedString::TakeString(&json_string)); } diff --git a/chrome/browser/ui/webui/instant_ui.cc b/chrome/browser/ui/webui/instant_ui.cc index f84bf9a..23a255c 100644 --- a/chrome/browser/ui/webui/instant_ui.cc +++ b/chrome/browser/ui/webui/instant_ui.cc @@ -169,6 +169,7 @@ InstantUI::InstantUI(content::WebUI* web_ui) : WebUIController(web_ui) { // static void InstantUI::RegisterUserPrefs(PrefRegistrySyncable* registry) { - registry->RegisterStringPref(prefs::kInstantUIZeroSuggestUrlPrefix, "", + registry->RegisterStringPref(prefs::kInstantUIZeroSuggestUrlPrefix, + std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); } diff --git a/chrome/browser/ui/webui/net_internals/net_internals_ui.cc b/chrome/browser/ui/webui/net_internals/net_internals_ui.cc index cea9824..0ac1324 100644 --- a/chrome/browser/ui/webui/net_internals/net_internals_ui.cc +++ b/chrome/browser/ui/webui/net_internals/net_internals_ui.cc @@ -1409,7 +1409,7 @@ void NetInternalsMessageHandler::IOThreadImpl::OnGetSpdyStatus( next_protos_value = Value::CreateStringValue( JoinString(net::HttpStreamFactory::next_protos(), ',')); } else { - next_protos_value = Value::CreateStringValue(""); + next_protos_value = Value::CreateStringValue(std::string()); } status_dict->Set("next_protos", next_protos_value); diff --git a/chrome/browser/ui/webui/options/browser_options_handler.cc b/chrome/browser/ui/webui/options/browser_options_handler.cc index 48f4f60..081806f 100644 --- a/chrome/browser/ui/webui/options/browser_options_handler.cc +++ b/chrome/browser/ui/webui/options/browser_options_handler.cc @@ -1194,8 +1194,11 @@ void BrowserOptionsHandler::HandleSelectDownloadLocation( ui::SelectFileDialog::SELECT_FOLDER, l10n_util::GetStringUTF16(IDS_OPTIONS_DOWNLOADLOCATION_BROWSE_TITLE), pref_service->GetFilePath(prefs::kDownloadDefaultDirectory), - &info, 0, FILE_PATH_LITERAL(""), - web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(), NULL); + &info, + 0, + FILE_PATH_LITERAL(std::string()), + web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(), + NULL); } void BrowserOptionsHandler::FileSelected(const base::FilePath& path, int index, diff --git a/chrome/browser/ui/webui/options/certificate_manager_handler.cc b/chrome/browser/ui/webui/options/certificate_manager_handler.cc index c1e18da..f30eaec 100644 --- a/chrome/browser/ui/webui/options/certificate_manager_handler.cc +++ b/chrome/browser/ui/webui/options/certificate_manager_handler.cc @@ -326,7 +326,7 @@ void CertificateManagerHandler::GetLocalizedValues( l10n_util::GetStringUTF16(IDS_CERT_MANAGER_DELETE_CA_DESCRIPTION)); localized_strings->SetString("unknownCertsTabDeleteConfirm", l10n_util::GetStringUTF16(IDS_CERT_MANAGER_DELETE_UNKNOWN_FORMAT)); - localized_strings->SetString("unknownCertsTabDeleteImpact", ""); + localized_strings->SetString("unknownCertsTabDeleteImpact", std::string()); // Certificate Restore overlay strings. localized_strings->SetString("certificateRestorePasswordDescription", @@ -614,7 +614,7 @@ void CertificateManagerHandler::ExportPersonalPasswordSelected( chrome::UnlockCertSlotIfNecessary( selected_cert_list_[0].get(), chrome::kCryptoModulePasswordCertExport, - "", // unused. + std::string(), // unused. base::Bind(&CertificateManagerHandler::ExportPersonalSlotsUnlocked, base::Unretained(this))); } @@ -723,7 +723,7 @@ void CertificateManagerHandler::ImportPersonalFileRead( chrome::UnlockSlotsIfNecessary( modules, chrome::kCryptoModulePasswordCertImport, - "", // unused. + std::string(), // unused. base::Bind(&CertificateManagerHandler::ImportPersonalSlotUnlocked, base::Unretained(this))); } diff --git a/chrome/browser/ui/webui/options/content_settings_handler.cc b/chrome/browser/ui/webui/options/content_settings_handler.cc index 85249bc..549856b 100644 --- a/chrome/browser/ui/webui/options/content_settings_handler.cc +++ b/chrome/browser/ui/webui/options/content_settings_handler.cc @@ -123,7 +123,7 @@ std::string ContentSettingToString(ContentSetting setting) { NOTREACHED(); } - return ""; + return std::string(); } ContentSetting ContentSettingFromString(const std::string& name) { @@ -151,8 +151,9 @@ DictionaryValue* GetExceptionForPage( DictionaryValue* exception = new DictionaryValue(); exception->SetString(kOrigin, pattern.ToString()); exception->SetString(kEmbeddingOrigin, - secondary_pattern == ContentSettingsPattern::Wildcard() ? "" : - secondary_pattern.ToString()); + secondary_pattern == ContentSettingsPattern::Wildcard() + ? std::string() + : secondary_pattern.ToString()); exception->SetString(kSetting, ContentSettingToString(setting)); exception->SetString(kSource, provider_name); return exception; @@ -604,7 +605,7 @@ void ContentSettingsHandler::UpdateMediaSettingsView() { media_ui_settings.SetString("askText", "mediaStreamAsk"); media_ui_settings.SetString("blockText", "mediaStreamBlock"); media_ui_settings.SetBoolean("showBubble", false); - media_ui_settings.SetString("bubbleText", ""); + media_ui_settings.SetString("bubbleText", std::string()); web_ui()->CallJavascriptFunction("ContentSettings.updateMediaUI", media_ui_settings); @@ -1052,18 +1053,16 @@ void ContentSettingsHandler::RemoveMediaException( mode == "normal" ? GetContentSettingsMap() : GetOTRContentSettingsMap(); if (settings_map) { - settings_map->SetWebsiteSetting( - ContentSettingsPattern::FromString(pattern), - ContentSettingsPattern::Wildcard(), - CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, - "", - NULL); - settings_map->SetWebsiteSetting( - ContentSettingsPattern::FromString(pattern), - ContentSettingsPattern::Wildcard(), - CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, - "", - NULL); + settings_map->SetWebsiteSetting(ContentSettingsPattern::FromString(pattern), + ContentSettingsPattern::Wildcard(), + CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, + std::string(), + NULL); + settings_map->SetWebsiteSetting(ContentSettingsPattern::FromString(pattern), + ContentSettingsPattern::Wildcard(), + CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, + std::string(), + NULL); } } @@ -1088,10 +1087,11 @@ void ContentSettingsHandler::RemoveExceptionFromHostContentSettingsMap( if (settings_map) { settings_map->SetWebsiteSetting( ContentSettingsPattern::FromString(pattern), - secondary_pattern.empty() ? ContentSettingsPattern::Wildcard() : - ContentSettingsPattern::FromString(secondary_pattern), + secondary_pattern.empty() + ? ContentSettingsPattern::Wildcard() + : ContentSettingsPattern::FromString(secondary_pattern), type, - "", + std::string(), NULL); } } @@ -1259,7 +1259,7 @@ void ContentSettingsHandler::SetException(const ListValue* args) { settings_map->SetContentSetting(ContentSettingsPattern::FromString(pattern), ContentSettingsPattern::Wildcard(), type, - "", + std::string(), ContentSettingFromString(setting)); } } diff --git a/chrome/browser/ui/webui/options/font_settings_handler.cc b/chrome/browser/ui/webui/options/font_settings_handler.cc index 61f1524..558effc 100644 --- a/chrome/browser/ui/webui/options/font_settings_handler.cc +++ b/chrome/browser/ui/webui/options/font_settings_handler.cc @@ -188,8 +188,8 @@ void FontSettingsHandler::FontsListHasLoaded( option->Append(new base::StringValue(has_rtl_chars ? "rtl" : "ltr")); } else { // Add empty name/value to indicate a separator item. - option->Append(new base::StringValue("")); - option->Append(new base::StringValue("")); + option->Append(new base::StringValue(std::string())); + option->Append(new base::StringValue(std::string())); } encoding_list.Append(option); } diff --git a/chrome/browser/ui/webui/options/managed_user_passphrase_handler.cc b/chrome/browser/ui/webui/options/managed_user_passphrase_handler.cc index 2090137..f3aac91 100644 --- a/chrome/browser/ui/webui/options/managed_user_passphrase_handler.cc +++ b/chrome/browser/ui/webui/options/managed_user_passphrase_handler.cc @@ -110,8 +110,8 @@ void ManagedUserPassphraseHandler::IsPassphraseSet( void ManagedUserPassphraseHandler::ResetPassphrase( const base::ListValue* args) { PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs(); - pref_service->SetString(prefs::kManagedModeLocalPassphrase, ""); - pref_service->SetString(prefs::kManagedModeLocalSalt, ""); + pref_service->SetString(prefs::kManagedModeLocalPassphrase, std::string()); + pref_service->SetString(prefs::kManagedModeLocalSalt, std::string()); } void ManagedUserPassphraseHandler::SetLocalPassphrase( diff --git a/chrome/browser/ui/webui/options/preferences_browsertest.cc b/chrome/browser/ui/webui/options/preferences_browsertest.cc index 5839538..8dbc971 100644 --- a/chrome/browser/ui/webui/options/preferences_browsertest.cc +++ b/chrome/browser/ui/webui/options/preferences_browsertest.cc @@ -343,7 +343,7 @@ void PreferencesBrowserTest::VerifySetPref(const std::string& name, std::string observed_json; ASSERT_TRUE(content::ExecuteScriptAndExtractString( render_view_host_, javascript.str(), &observed_json)); - VerifyObservedPref(observed_json, name, value, "", false, !commit); + VerifyObservedPref(observed_json, name, value, std::string(), false, !commit); VerifyAndClearExpectations(); } @@ -385,7 +385,7 @@ void PreferencesBrowserTest::VerifyCommit(const std::string& name, void PreferencesBrowserTest::VerifySetCommit(const std::string& name, const base::Value* value) { ExpectSetCommit(name, value); - VerifyCommit(name, value, ""); + VerifyCommit(name, value, std::string()); VerifyAndClearExpectations(); } @@ -476,8 +476,8 @@ IN_PROC_BROWSER_TEST_F(PreferencesBrowserTest, FetchPrefs) { // Verify notifications when default values are in effect. SetupJavaScriptTestEnvironment(pref_names_, &observed_json); - VerifyObservedPrefs(observed_json, pref_names_, default_values_, - "", false, false); + VerifyObservedPrefs( + observed_json, pref_names_, default_values_, std::string(), false, false); // Verify notifications when recommended values are in effect. SetUserPolicies(policy_names_, non_default_values_, @@ -497,8 +497,12 @@ IN_PROC_BROWSER_TEST_F(PreferencesBrowserTest, FetchPrefs) { ClearUserPolicies(); SetUserValues(pref_names_, non_default_values_); SetupJavaScriptTestEnvironment(pref_names_, &observed_json); - VerifyObservedPrefs(observed_json, pref_names_, non_default_values_, - "", false, false); + VerifyObservedPrefs(observed_json, + pref_names_, + non_default_values_, + std::string(), + false, + false); } // Verifies that setting a user-modified pref value through the JavaScript @@ -550,7 +554,7 @@ IN_PROC_BROWSER_TEST_F(PreferencesBrowserTest, DialogPrefsSetRollback) { ASSERT_NO_FATAL_FAILURE(SetupJavaScriptTestEnvironment(pref_names_, NULL)); for (size_t i = 0; i < pref_names_.size(); ++i) { VerifySetPref(pref_names_[i], types_[i], non_default_values_[i], false); - VerifyRollback(pref_names_[i], default_values_[i], ""); + VerifyRollback(pref_names_[i], default_values_[i], std::string()); } // Verify behavior when recommended values are in effect. @@ -592,7 +596,7 @@ IN_PROC_BROWSER_TEST_F(PreferencesBrowserTest, DialogPrefsClearRollback) { ASSERT_NO_FATAL_FAILURE(SetupJavaScriptTestEnvironment(pref_names_, NULL)); for (size_t i = 0; i < pref_names_.size(); ++i) { VerifyClearPref(pref_names_[i], default_values_[i], false); - VerifyRollback(pref_names_[i], non_default_values_[i], ""); + VerifyRollback(pref_names_[i], non_default_values_[i], std::string()); } } @@ -624,15 +628,19 @@ IN_PROC_BROWSER_TEST_F(PreferencesBrowserTest, NotificationsOnBackendChanges) { StartObserving(); ClearUserPolicies(); FinishObserving(&observed_json); - VerifyObservedPrefs(observed_json, pref_names_, default_values_, - "", false, false); + VerifyObservedPrefs( + observed_json, pref_names_, default_values_, std::string(), false, false); // Verify notifications when user-modified values come into effect. StartObserving(); SetUserValues(pref_names_, non_default_values_); FinishObserving(&observed_json); - VerifyObservedPrefs(observed_json, pref_names_, non_default_values_, - "", false, false); + VerifyObservedPrefs(observed_json, + pref_names_, + non_default_values_, + std::string(), + false, + false); } #if defined(OS_CHROMEOS) diff --git a/chrome/browser/ui/webui/policy_ui_browsertest.cc b/chrome/browser/ui/webui/policy_ui_browsertest.cc index 6af1613..6293fef 100644 --- a/chrome/browser/ui/webui/policy_ui_browsertest.cc +++ b/chrome/browser/ui/webui/policy_ui_browsertest.cc @@ -43,7 +43,7 @@ std::vector<std::string> PopulateExpectedPolicy( metadata->scope == policy::POLICY_SCOPE_MACHINE ? IDS_POLICY_SCOPE_DEVICE : IDS_POLICY_SCOPE_USER)); } else { - expected_policy.push_back(""); + expected_policy.push_back(std::string()); } // Populate expected level. @@ -52,7 +52,7 @@ std::vector<std::string> PopulateExpectedPolicy( metadata->level == policy::POLICY_LEVEL_RECOMMENDED ? IDS_POLICY_LEVEL_RECOMMENDED : IDS_POLICY_LEVEL_MANDATORY)); } else { - expected_policy.push_back(""); + expected_policy.push_back(std::string()); } // Populate expected policy name. @@ -178,7 +178,7 @@ IN_PROC_BROWSER_TEST_F(PolicyUITest, SendPolicyNames) { for (const policy::PolicyDefinitionList::Entry* policy = policies->begin; policy != policies->end; ++policy) { expected_policies.push_back( - PopulateExpectedPolicy(policy->name, "", NULL, false)); + PopulateExpectedPolicy(policy->name, std::string(), NULL, false)); } // Retrieve the contents of the policy table from the UI and verify that it @@ -240,7 +240,8 @@ IN_PROC_BROWSER_TEST_F(PolicyUITest, SendPolicyValues) { policy != policies->end; ++policy) { std::map<std::string, std::string>::const_iterator it = expected_values.find(policy->name); - const std::string value = it == expected_values.end() ? "" : it->second; + const std::string value = + it == expected_values.end() ? std::string() : it->second; const policy::PolicyMap::Entry* metadata = values.Get(policy->name); expected_policies.insert( metadata ? expected_policies.begin() + first_unset_position++ : diff --git a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc index 0525da3..ec05b59 100644 --- a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc +++ b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc @@ -866,7 +866,7 @@ void PrintPreviewHandler::SelectFile(const base::FilePath& default_filename) { sticky_settings->save_path()->Append(default_filename), &file_type_info, 0, - FILE_PATH_LITERAL(""), + FILE_PATH_LITERAL(std::string()), platform_util::GetTopLevel( preview_web_contents()->GetView()->GetNativeView()), NULL); diff --git a/chrome/browser/ui/webui/print_preview/print_preview_ui.cc b/chrome/browser/ui/webui/print_preview/print_preview_ui.cc index 52cbe91..4e10802 100644 --- a/chrome/browser/ui/webui/print_preview/print_preview_ui.cc +++ b/chrome/browser/ui/webui/print_preview/print_preview_ui.cc @@ -571,7 +571,7 @@ void PrintPreviewUI::OnClosePrintPreviewDialog() { ConstrainedWebDialogDelegate* delegate = GetConstrainedDelegate(); if (!delegate) return; - delegate->GetWebDialogDelegate()->OnDialogClosed(""); + delegate->GetWebDialogDelegate()->OnDialogClosed(std::string()); delegate->OnDialogCloseFromWebUI(); } diff --git a/chrome/browser/ui/webui/signin/profile_signin_confirmation_dialog_unittest.cc b/chrome/browser/ui/webui/signin/profile_signin_confirmation_dialog_unittest.cc index e24b730..cd6f5fe 100644 --- a/chrome/browser/ui/webui/signin/profile_signin_confirmation_dialog_unittest.cc +++ b/chrome/browser/ui/webui/signin/profile_signin_confirmation_dialog_unittest.cc @@ -142,11 +142,11 @@ class ProfileSigninConfirmationDialogTest : public testing::Test { false); // Create a dialog, but don't display it. - dialog_ = new ProfileSigninConfirmationDialog( - profile_.get(), "", - base::Bind(&base::DoNothing), - base::Bind(&base::DoNothing), - base::Bind(&base::DoNothing)); + dialog_ = new ProfileSigninConfirmationDialog(profile_.get(), + std::string(), + base::Bind(&base::DoNothing), + base::Bind(&base::DoNothing), + base::Bind(&base::DoNothing)); } virtual void TearDown() OVERRIDE { @@ -204,10 +204,10 @@ TEST_F(ProfileSigninConfirmationDialogTest, PromptForNewProfile_Extensions) { &ProfileSigninConfirmationDialog::CheckShouldPromptForNewProfile, base::Unretained(dialog_)))); - scoped_refptr<extensions::Extension> extension = CreateExtension("foo", ""); + scoped_refptr<extensions::Extension> extension = + CreateExtension("foo", std::string()); extensions->extension_prefs()->AddGrantedPermissions( - extension->id(), - make_scoped_refptr(new extensions::PermissionSet)); + extension->id(), make_scoped_refptr(new extensions::PermissionSet)); extensions->AddExtension(extension); EXPECT_TRUE( GetCallbackResult( diff --git a/chrome/browser/ui/webui/sync_setup_handler_unittest.cc b/chrome/browser/ui/webui/sync_setup_handler_unittest.cc index f958519..19f2d0e 100644 --- a/chrome/browser/ui/webui/sync_setup_handler_unittest.cc +++ b/chrome/browser/ui/webui/sync_setup_handler_unittest.cc @@ -457,8 +457,13 @@ TEST_P(SyncSetupHandlerTest, DisplayBasicLogin) { // Now make sure that the appropriate params are being passed. DictionaryValue* dictionary; ASSERT_TRUE(data.arg2->GetAsDictionary(&dictionary)); - CheckShowSyncSetupArgs( - dictionary, "", false, GoogleServiceAuthError::NONE, "", true, ""); + CheckShowSyncSetupArgs(dictionary, + std::string(), + false, + GoogleServiceAuthError::NONE, + std::string(), + true, + std::string()); } else { ASSERT_FALSE(handler_->is_configuring_sync()); ASSERT_TRUE(handler_->have_signin_tracker()); @@ -494,8 +499,13 @@ TEST_P(SyncSetupHandlerTest, DisplayForceLogin) { // Now make sure that the appropriate params are being passed. DictionaryValue* dictionary; ASSERT_TRUE(data.arg2->GetAsDictionary(&dictionary)); - CheckShowSyncSetupArgs( - dictionary, "", false, GoogleServiceAuthError::NONE, "", true, ""); + CheckShowSyncSetupArgs(dictionary, + std::string(), + false, + GoogleServiceAuthError::NONE, + std::string(), + true, + std::string()); } else { ASSERT_FALSE(handler_->is_configuring_sync()); ASSERT_TRUE(handler_->have_signin_tracker()); @@ -679,7 +689,7 @@ TEST_P(SyncSetupHandlerTest, HandleGaiaAuthFailure) { if (!SyncPromoUI::UseWebBasedSigninFlow()) { // Fake a failed signin attempt. - handler_->TryLogin(kTestUser, kTestPassword, "", ""); + handler_->TryLogin(kTestUser, kTestPassword, std::string(), std::string()); GoogleServiceAuthError error( GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); handler_->SigninFailed(error); @@ -695,9 +705,13 @@ TEST_P(SyncSetupHandlerTest, HandleGaiaAuthFailure) { // Now make sure that the appropriate params are being passed. DictionaryValue* dictionary; ASSERT_TRUE(data.arg2->GetAsDictionary(&dictionary)); - CheckShowSyncSetupArgs( - dictionary, "", false, GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS, - kTestUser, true, ""); + CheckShowSyncSetupArgs(dictionary, + std::string(), + false, + GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS, + kTestUser, + true, + std::string()); } else { ASSERT_FALSE(handler_->is_configuring_sync()); ASSERT_TRUE(handler_->have_signin_tracker()); @@ -718,7 +732,7 @@ TEST_P(SyncSetupHandlerTest, HandleCaptcha) { if (!SyncPromoUI::UseWebBasedSigninFlow()) { // Fake a failed signin attempt that requires a captcha. - handler_->TryLogin(kTestUser, kTestPassword, "", ""); + handler_->TryLogin(kTestUser, kTestPassword, std::string(), std::string()); GoogleServiceAuthError error = GoogleServiceAuthError::FromClientLoginCaptchaChallenge( "token", GURL(kTestCaptchaImageUrl), GURL(kTestCaptchaUnlockUrl)); @@ -734,9 +748,13 @@ TEST_P(SyncSetupHandlerTest, HandleCaptcha) { // Now make sure that the appropriate params are being passed. DictionaryValue* dictionary; ASSERT_TRUE(data.arg2->GetAsDictionary(&dictionary)); - CheckShowSyncSetupArgs( - dictionary, "", false, GoogleServiceAuthError::CAPTCHA_REQUIRED, - kTestUser, true, kTestCaptchaImageUrl); + CheckShowSyncSetupArgs(dictionary, + std::string(), + false, + GoogleServiceAuthError::CAPTCHA_REQUIRED, + kTestUser, + true, + kTestCaptchaImageUrl); } else { ASSERT_FALSE(handler_->is_configuring_sync()); ASSERT_TRUE(handler_->have_signin_tracker()); @@ -758,7 +776,7 @@ TEST_P(SyncSetupHandlerTest, UnrecoverableErrorInitializingSync) { ASSERT_EQ(1U, web_ui_.call_data().size()); // Fake a successful GAIA request (gaia credentials valid, but signin not // complete yet). - handler_->TryLogin(kTestUser, kTestPassword, "", ""); + handler_->TryLogin(kTestUser, kTestPassword, std::string(), std::string()); handler_->GaiaCredentialsValid(); ASSERT_EQ(2U, web_ui_.call_data().size()); EXPECT_EQ("SyncSetupOverlay.showSuccessAndSettingUp", @@ -780,9 +798,13 @@ TEST_P(SyncSetupHandlerTest, UnrecoverableErrorInitializingSync) { // Now make sure that the appropriate params are being passed. DictionaryValue* dictionary; ASSERT_TRUE(data.arg2->GetAsDictionary(&dictionary)); - CheckShowSyncSetupArgs( - dictionary, "", true, GoogleServiceAuthError::NONE, - kTestUser, true, ""); + CheckShowSyncSetupArgs(dictionary, + std::string(), + true, + GoogleServiceAuthError::NONE, + kTestUser, + true, + std::string()); } else { ASSERT_FALSE(handler_->is_configuring_sync()); ASSERT_TRUE(handler_->have_signin_tracker()); @@ -803,7 +825,7 @@ TEST_P(SyncSetupHandlerTest, GaiaErrorInitializingSync) { ASSERT_EQ(1U, web_ui_.call_data().size()); // Fake a successful GAIA request (gaia credentials valid, but signin not // complete yet). - handler_->TryLogin(kTestUser, kTestPassword, "", ""); + handler_->TryLogin(kTestUser, kTestPassword, std::string(), std::string()); handler_->GaiaCredentialsValid(); ASSERT_EQ(2U, web_ui_.call_data().size()); EXPECT_EQ("SyncSetupOverlay.showSuccessAndSettingUp", @@ -826,9 +848,13 @@ TEST_P(SyncSetupHandlerTest, GaiaErrorInitializingSync) { // Now make sure that the appropriate params are being passed. DictionaryValue* dictionary; ASSERT_TRUE(data.arg2->GetAsDictionary(&dictionary)); - CheckShowSyncSetupArgs( - dictionary, "", false, GoogleServiceAuthError::SERVICE_UNAVAILABLE, - kTestUser, true, ""); + CheckShowSyncSetupArgs(dictionary, + std::string(), + false, + GoogleServiceAuthError::SERVICE_UNAVAILABLE, + kTestUser, + true, + std::string()); } else { ASSERT_FALSE(handler_->is_configuring_sync()); ASSERT_TRUE(handler_->have_signin_tracker()); @@ -837,7 +863,7 @@ TEST_P(SyncSetupHandlerTest, GaiaErrorInitializingSync) { TEST_P(SyncSetupHandlerTest, TestSyncEverything) { std::string args = GetConfiguration( - NULL, SYNC_ALL_DATA, GetAllTypes(), "", ENCRYPT_PASSWORDS); + NULL, SYNC_ALL_DATA, GetAllTypes(), std::string(), ENCRYPT_PASSWORDS); ListValue list_args; list_args.Append(new StringValue(args)); EXPECT_CALL(*mock_pss_, IsPassphraseRequiredForDecryption()) @@ -855,7 +881,7 @@ TEST_P(SyncSetupHandlerTest, TestSyncEverything) { TEST_P(SyncSetupHandlerTest, TurnOnEncryptAll) { std::string args = GetConfiguration( - NULL, SYNC_ALL_DATA, GetAllTypes(), "", ENCRYPT_ALL_DATA); + NULL, SYNC_ALL_DATA, GetAllTypes(), std::string(), ENCRYPT_ALL_DATA); ListValue list_args; list_args.Append(new StringValue(args)); EXPECT_CALL(*mock_pss_, IsPassphraseRequiredForDecryption()) @@ -874,7 +900,7 @@ TEST_P(SyncSetupHandlerTest, TurnOnEncryptAll) { TEST_P(SyncSetupHandlerTest, TestPassphraseStillRequired) { std::string args = GetConfiguration( - NULL, SYNC_ALL_DATA, GetAllTypes(), "", ENCRYPT_PASSWORDS); + NULL, SYNC_ALL_DATA, GetAllTypes(), std::string(), ENCRYPT_PASSWORDS); ListValue list_args; list_args.Append(new StringValue(args)); EXPECT_CALL(*mock_pss_, IsPassphraseRequiredForDecryption()) @@ -990,8 +1016,11 @@ TEST_P(SyncSetupHandlerTest, TestSyncIndividualTypes) { for (it = user_selectable_types.First(); it.Good(); it.Inc()) { syncer::ModelTypeSet type_to_set; type_to_set.Put(it.Get()); - std::string args = GetConfiguration( - NULL, CHOOSE_WHAT_TO_SYNC, type_to_set, "", ENCRYPT_PASSWORDS); + std::string args = GetConfiguration(NULL, + CHOOSE_WHAT_TO_SYNC, + type_to_set, + std::string(), + ENCRYPT_PASSWORDS); ListValue list_args; list_args.Append(new StringValue(args)); EXPECT_CALL(*mock_pss_, IsPassphraseRequiredForDecryption()) @@ -1010,8 +1039,11 @@ TEST_P(SyncSetupHandlerTest, TestSyncIndividualTypes) { } TEST_P(SyncSetupHandlerTest, TestSyncAllManually) { - std::string args = GetConfiguration( - NULL, CHOOSE_WHAT_TO_SYNC, GetAllTypes(), "", ENCRYPT_PASSWORDS); + std::string args = GetConfiguration(NULL, + CHOOSE_WHAT_TO_SYNC, + GetAllTypes(), + std::string(), + ENCRYPT_PASSWORDS); ListValue list_args; list_args.Append(new StringValue(args)); EXPECT_CALL(*mock_pss_, IsPassphraseRequiredForDecryption()) @@ -1074,12 +1106,12 @@ TEST_P(SyncSetupHandlerTest, ShowSyncSetupWithAuthError) { ASSERT_TRUE(data.arg2->GetAsDictionary(&dictionary)); // We should display a login screen with a non-editable username filled in. CheckShowSyncSetupArgs(dictionary, - "", + std::string(), false, GoogleServiceAuthError::NONE, kTestUser, false, - ""); + std::string()); } else { ASSERT_FALSE(handler_->is_configuring_sync()); ASSERT_TRUE(handler_->have_signin_tracker()); @@ -1244,9 +1276,9 @@ TEST_P(SyncSetupHandlerTest, SubmitAuthWithInvalidUsername) { DictionaryValue args; args.SetString("user", "user@not_allowed.com"); args.SetString("pass", "password"); - args.SetString("captcha", ""); - args.SetString("otp", ""); - args.SetString("accessCode", ""); + args.SetString("captcha", std::string()); + args.SetString("otp", std::string()); + args.SetString("accessCode", std::string()); std::string json; base::JSONWriter::Write(&args, &json); ListValue list_args; @@ -1267,8 +1299,13 @@ TEST_P(SyncSetupHandlerTest, SubmitAuthWithInvalidUsername) { DictionaryValue* dictionary; ASSERT_TRUE(data.arg2->GetAsDictionary(&dictionary)); std::string err = l10n_util::GetStringUTF8(IDS_SYNC_LOGIN_NAME_PROHIBITED); - CheckShowSyncSetupArgs( - dictionary, err, false, GoogleServiceAuthError::NONE, "", true, ""); + CheckShowSyncSetupArgs(dictionary, + err, + false, + GoogleServiceAuthError::NONE, + std::string(), + true, + std::string()); handler_->CloseSyncSetup(); EXPECT_EQ(NULL, LoginUIServiceFactory::GetForProfile( diff --git a/chrome/browser/ui/webui/version_ui.cc b/chrome/browser/ui/webui/version_ui.cc index 678492a..6497ae0 100644 --- a/chrome/browser/ui/webui/version_ui.cc +++ b/chrome/browser/ui/webui/version_ui.cc @@ -92,7 +92,7 @@ content::WebUIDataSource* CreateVersionUIDataSource(Profile* profile) { html_source->AddString("command_line", WideToUTF16(CommandLine::ForCurrentProcess()->GetCommandLineString())); #elif defined(OS_POSIX) - std::string command_line = ""; + std::string command_line; typedef std::vector<std::string> ArgvList; const ArgvList& argv = CommandLine::ForCurrentProcess()->argv(); for (ArgvList::const_iterator iter = argv.begin(); iter != argv.end(); iter++) diff --git a/chrome/browser/value_store/leveldb_value_store.cc b/chrome/browser/value_store/leveldb_value_store.cc index 47ad0c0..bad05dd 100644 --- a/chrome/browser/value_store/leveldb_value_store.cc +++ b/chrome/browser/value_store/leveldb_value_store.cc @@ -334,7 +334,7 @@ std::string LeveldbValueStore::EnsureDbIsOpen() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); if (db_.get()) - return ""; + return std::string(); #if defined(OS_POSIX) std::string os_path(db_path_.value()); @@ -356,7 +356,7 @@ std::string LeveldbValueStore::EnsureDbIsOpen() { } db_.reset(db); - return ""; + return std::string(); } std::string LeveldbValueStore::ReadFromDb( @@ -371,7 +371,7 @@ std::string LeveldbValueStore::ReadFromDb( if (s.IsNotFound()) { // Despite there being no value, it was still a success. // Check this first because ok() is false on IsNotFound. - return ""; + return std::string(); } if (!s.ok()) @@ -384,7 +384,7 @@ std::string LeveldbValueStore::ReadFromDb( } setting->reset(value); - return ""; + return std::string(); } std::string LeveldbValueStore::AddToBatch( @@ -410,16 +410,16 @@ std::string LeveldbValueStore::AddToBatch( batch->Put(key, value_as_json); } - return ""; + return std::string(); } std::string LeveldbValueStore::WriteToDb(leveldb::WriteBatch* batch) { leveldb::Status status = db_->Write(leveldb::WriteOptions(), batch); if (status.IsNotFound()) { NOTREACHED() << "IsNotFound() but writing?!"; - return ""; + return std::string(); } - return status.ok() ? "" : status.ToString(); + return status.ok() ? std::string() : status.ToString(); } bool LeveldbValueStore::IsEmpty() { diff --git a/chrome/browser/web_applications/web_app_unittest.cc b/chrome/browser/web_applications/web_app_unittest.cc index 0bd1c01..149f62b 100644 --- a/chrome/browser/web_applications/web_app_unittest.cc +++ b/chrome/browser/web_applications/web_app_unittest.cc @@ -71,9 +71,8 @@ TEST_F(WebApplicationTest, AppDirWithId) { TEST_F(WebApplicationTest, AppDirWithUrl) { base::FilePath profile_path(FILE_PATH_LITERAL("profile")); base::FilePath result(web_app::GetWebAppDataDirectory( - profile_path, "", GURL("http://example.com"))); + profile_path, std::string(), GURL("http://example.com"))); base::FilePath expected = profile_path.AppendASCII("Web Applications") - .AppendASCII("example.com") - .AppendASCII("http_80"); + .AppendASCII("example.com").AppendASCII("http_80"); EXPECT_EQ(expected, result); } diff --git a/chrome/browser/webdata/keyword_table.cc b/chrome/browser/webdata/keyword_table.cc index 956d60b..10d224e 100644 --- a/chrome/browser/webdata/keyword_table.cc +++ b/chrome/browser/webdata/keyword_table.cc @@ -388,7 +388,7 @@ bool KeywordTable::MigrateToVersion45RemoveLogoIDAndAutogenerateColumns() { // Migrate the keywords backup table as well. if (!MigrateKeywordsTableForVersion45("keywords_backup") || !meta_table_->SetValue("Default Search Provider ID Backup Signature", - "")) + std::string())) return false; return transaction.Commit(); @@ -409,7 +409,7 @@ bool KeywordTable::MigrateToVersion47AddAlternateURLsColumn() { if (!db_->Execute("ALTER TABLE keywords_backup ADD COLUMN " "alternate_urls VARCHAR DEFAULT ''") || !meta_table_->SetValue("Default Search Provider ID Backup Signature", - "")) + std::string())) return false; return transaction.Commit(); diff --git a/chrome/browser/webdata/token_service_table_unittest.cc b/chrome/browser/webdata/token_service_table_unittest.cc index db409f8..3c60ccf 100644 --- a/chrome/browser/webdata/token_service_table_unittest.cc +++ b/chrome/browser/webdata/token_service_table_unittest.cc @@ -89,7 +89,7 @@ TEST_F(TokenServiceTableTest, MAYBE_TokenServiceGetSet) { out_map.clear(); // try blanking it - won't remove it from the db though! - EXPECT_TRUE(table_->SetTokenForService(service, "")); + EXPECT_TRUE(table_->SetTokenForService(service, std::string())); EXPECT_TRUE(table_->GetAllTokens(&out_map)); EXPECT_EQ(out_map.find(service)->second, ""); out_map.clear(); |