diff options
Diffstat (limited to 'chrome/browser/extensions')
71 files changed, 455 insertions, 392 deletions
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( |