diff options
author | dcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-09 06:41:12 +0000 |
---|---|---|
committer | dcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-09 06:41:12 +0000 |
commit | 69d7f89d6a93e0fbce451960287066195c6d4ea0 (patch) | |
tree | 51c8c1f971d39d652ec38ed76070539bb33e85c7 /chrome/browser/extensions | |
parent | e3748a79b523a8d365d4a33ef986eebb4186fa78 (diff) | |
download | chromium_src-69d7f89d6a93e0fbce451960287066195c6d4ea0.zip chromium_src-69d7f89d6a93e0fbce451960287066195c6d4ea0.tar.gz chromium_src-69d7f89d6a93e0fbce451960287066195c6d4ea0.tar.bz2 |
Revert "Rewrite std::string("") to std::string(), Linux edition."
This reverts commit e59558b78e8c6a1b0bd916a724724b638c3c91b6.
Revert "Fix build after r193020."
This reverts commit 558a35897f6b3ffbcaefde927c1f150b815d140a.
Revert "Really fix build after r193020."
This reverts commit e3748a79b523a8d365d4a33ef986eebb4186fa78.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@193030 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions')
71 files changed, 392 insertions, 455 deletions
diff --git a/chrome/browser/extensions/activity_log.cc b/chrome/browser/extensions/activity_log.cc index dcf8e8f..34f820b 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,10 +395,9 @@ 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 += " "; } @@ -407,9 +406,9 @@ void ActivityLog::OnScriptsExecuted( LogDOMActionInternal(extension, on_url, web_contents->GetTitle(), - std::string(), // no api call here + "", // no api call here script_names.get(), - std::string(), // no extras either + "", // no extras either DOMAction::INSERTED); } } diff --git a/chrome/browser/extensions/activity_log_unittest.cc b/chrome/browser/extensions/activity_log_unittest.cc index a5ecc95..f678d7b 100644 --- a/chrome/browser/extensions/activity_log_unittest.cc +++ b/chrome/browser/extensions/activity_log_unittest.cc @@ -93,8 +93,10 @@ 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(), std::string()); + activity_log->LogAPIAction(extension, + std::string("tabs.testMethod"), + args.get(), + ""); } TEST_F(ActivityLogTest, LogAndFetchActions) { @@ -111,8 +113,10 @@ TEST_F(ActivityLogTest, LogAndFetchActions) { ASSERT_TRUE(ActivityLog::IsLogEnabled()); // Write some API calls - activity_log->LogAPIAction( - extension, std::string("tabs.testMethod"), args.get(), std::string()); + activity_log->LogAPIAction(extension, + std::string("tabs.testMethod"), + args.get(), + ""); activity_log->LogDOMAction(extension, GURL("http://www.google.com"), string16(), @@ -140,10 +144,14 @@ 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(), std::string()); + activity_log->LogAPIAction(extension, + std::string("tabs.testMethod"), + args.get(), + ""); activity_log->GetActions( - extension->id(), 0, base::Bind(ActivityLogTest::Arguments_Missing)); + extension->id(), + 0, + base::Bind(ActivityLogTest::Arguments_Missing)); } TEST_F(ActivityLogTest, LogWithArguments) { @@ -161,10 +169,14 @@ 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(), std::string()); + activity_log->LogAPIAction(extension, + std::string("extension.connect"), + args.get(), + ""); 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 34b4187..60c367a 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(), std::string()); + alarm_manager_->GetAlarm(extension_->id(), ""); 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(), std::string()); + alarm_manager_->GetAlarm(extension_->id(), ""); 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(), std::string()); + alarm_manager_->GetAlarm(extension_->id(), ""); 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(), std::string())); + ASSERT_FALSE(alarm_manager_->GetAlarm(extension_->id(), "")); 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(), std::string()); + alarm_manager_->GetAlarm(extension_->id(), ""); 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(), std::string())); + ASSERT_TRUE(alarm_manager_->GetAlarm(extension_->id(), "")); 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(), std::string())); + ASSERT_TRUE(alarm_manager_->GetAlarm(extension_->id(), "")); 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 754eeee..0470b78 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, - base::FilePath::StringType(), + FILE_PATH_LITERAL(""), 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 dd20fba1..a424f83 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, std::string())); + url, url, CONTENT_SETTINGS_TYPE_IMAGES, "")); EXPECT_EQ(CONTENT_SETTING_BLOCK, map->GetContentSetting( - url, url, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string())); + url, url, CONTENT_SETTINGS_TYPE_JAVASCRIPT, "")); EXPECT_EQ(CONTENT_SETTING_BLOCK, map->GetContentSetting( - url, url, CONTENT_SETTINGS_TYPE_PLUGINS, std::string())); + url, url, CONTENT_SETTINGS_TYPE_PLUGINS, "")); EXPECT_EQ(CONTENT_SETTING_ALLOW, map->GetContentSetting( - url, url, CONTENT_SETTINGS_TYPE_POPUPS, std::string())); + url, url, CONTENT_SETTINGS_TYPE_POPUPS, "")); #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, std::string())); + url, url, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, "")); } // 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 537d08f..8ee0fbf 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 std::string(); + return ""; } } // 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 bedd2ea..5e13633 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,76 +101,73 @@ TEST_F(ContentSettingsStoreTest, RegisterUnregister) { GURL url("http://www.youtube.com"); EXPECT_EQ(CONTENT_SETTING_DEFAULT, - GetContentSettingFromStore(store(), - url, - url, - CONTENT_SETTINGS_TYPE_COOKIES, - std::string(), - false)); + GetContentSettingFromStore( + store(), url, url, CONTENT_SETTINGS_TYPE_COOKIES, "", 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, - std::string(), - false)); + GetContentSettingFromStore( + store(), url, url, CONTENT_SETTINGS_TYPE_COOKIES, "", 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, - std::string(), - CONTENT_SETTING_ALLOW, - kExtensionPrefsScopeRegular); + store()->SetExtensionContentSetting( + ext_id, + pattern, + pattern, + CONTENT_SETTINGS_TYPE_COOKIES, + "", + CONTENT_SETTING_ALLOW, + kExtensionPrefsScopeRegular); Mock::VerifyAndClear(&observer); EXPECT_EQ(CONTENT_SETTING_ALLOW, - GetContentSettingFromStore(store(), - url, - url, - CONTENT_SETTINGS_TYPE_COOKIES, - std::string(), - false)); + GetContentSettingFromStore( + store(), + url, + url, + CONTENT_SETTINGS_TYPE_COOKIES, + "", + 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, - std::string(), - CONTENT_SETTING_BLOCK, - kExtensionPrefsScopeRegular); + store()->SetExtensionContentSetting( + ext_id_2, + pattern, + pattern, + CONTENT_SETTINGS_TYPE_COOKIES, + "", + CONTENT_SETTING_BLOCK, + kExtensionPrefsScopeRegular); EXPECT_EQ(CONTENT_SETTING_BLOCK, - GetContentSettingFromStore(store(), - url, - url, - CONTENT_SETTINGS_TYPE_COOKIES, - std::string(), - false)); + GetContentSettingFromStore( + store(), + url, + url, + CONTENT_SETTINGS_TYPE_COOKIES, + "", + 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, - std::string(), - false)); + GetContentSettingFromStore( + store(), + url, + url, + CONTENT_SETTINGS_TYPE_COOKIES, + "", + false)); Mock::VerifyAndClear(&observer); // Unregister second extension. This should reset the setting to its default @@ -178,12 +175,13 @@ 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, - std::string(), - false)); + GetContentSettingFromStore( + store(), + url, + url, + CONTENT_SETTINGS_TYPE_COOKIES, + "", + false)); store()->RemoveObserver(&observer); } @@ -192,7 +190,7 @@ TEST_F(ContentSettingsStoreTest, GetAllSettings) { bool incognito = false; std::vector<content_settings::Rule> rules; GetSettingsForOneTypeFromStore( - store(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(), incognito, &rules); + store(), CONTENT_SETTINGS_TYPE_COOKIES, "", incognito, &rules); ASSERT_EQ(0u, rules.size()); // Register first extension. @@ -200,16 +198,17 @@ 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, - std::string(), - CONTENT_SETTING_ALLOW, - kExtensionPrefsScopeRegular); + store()->SetExtensionContentSetting( + ext_id, + pattern, + pattern, + CONTENT_SETTINGS_TYPE_COOKIES, + "", + CONTENT_SETTING_ALLOW, + kExtensionPrefsScopeRegular); GetSettingsForOneTypeFromStore( - store(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(), incognito, &rules); + store(), CONTENT_SETTINGS_TYPE_COOKIES, "", incognito, &rules); ASSERT_EQ(1u, rules.size()); CheckRule(rules[0], pattern, pattern, CONTENT_SETTING_ALLOW); @@ -218,16 +217,20 @@ 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, - std::string(), - CONTENT_SETTING_BLOCK, - kExtensionPrefsScopeRegular); - - GetSettingsForOneTypeFromStore( - store(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(), incognito, &rules); + 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); 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); @@ -237,7 +240,7 @@ TEST_F(ContentSettingsStoreTest, GetAllSettings) { store()->SetExtensionState(ext_id, false); GetSettingsForOneTypeFromStore( - store(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(), incognito, &rules); + store(), CONTENT_SETTINGS_TYPE_COOKIES, "", incognito, &rules); ASSERT_EQ(1u, rules.size()); CheckRule(rules[0], pattern_2, pattern_2, CONTENT_SETTING_BLOCK); @@ -245,7 +248,7 @@ TEST_F(ContentSettingsStoreTest, GetAllSettings) { store()->UnregisterExtension(ext_id_2); GetSettingsForOneTypeFromStore( - store(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(), incognito, &rules); + store(), CONTENT_SETTINGS_TYPE_COOKIES, "", 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 c35b830..f3a4a35 100644 --- a/chrome/browser/extensions/api/cookies/cookies_api.cc +++ b/chrome/browser/extensions/api/cookies/cookies_api.cc @@ -203,9 +203,8 @@ 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(); + std::string store_id = parsed_args_->details.store_id.get() ? + *parsed_args_->details.store_id : ""; net::URLRequestContextGetter* store_context = NULL; if (!ParseStoreContext(&store_id, &store_context)) return false; @@ -277,9 +276,8 @@ bool CookiesGetAllFunction::RunImpl() { return false; } - std::string store_id = - parsed_args_->details.store_id.get() ? *parsed_args_->details.store_id - : std::string(); + std::string store_id = parsed_args_->details.store_id.get() ? + *parsed_args_->details.store_id : ""; net::URLRequestContextGetter* store_context = NULL; if (!ParseStoreContext(&store_id, &store_context)) return false; @@ -341,9 +339,8 @@ 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(); + std::string store_id = parsed_args_->details.store_id.get() ? + *parsed_args_->details.store_id : ""; net::URLRequestContextGetter* store_context = NULL; if (!ParseStoreContext(&store_id, &store_context)) return false; @@ -377,19 +374,17 @@ void CookiesSetFunction::SetCookieOnIOThread() { cookie_monster->SetCookieWithDetailsAsync( url_, - 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(), + 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 : "", 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)); } @@ -411,9 +406,8 @@ 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(); + std::string name = parsed_args_->details.name.get() ? + *parsed_args_->details.name : ""; if (it->Name() == name) { scoped_ptr<Cookie> cookie( cookies_helpers::CreateCookie(*it, *parsed_args_->details.store_id)); @@ -431,10 +425,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 - : std::string(); - error_ = ErrorUtils::FormatErrorMessage(keys::kCookieSetFailedError, name); + std::string name = parsed_args_->details.name.get() ? + *parsed_args_->details.name : ""; + error_ = ErrorUtils::FormatErrorMessage( + keys::kCookieSetFailedError, name); } SendResponse(success_); } @@ -453,9 +447,8 @@ 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(); + std::string store_id = parsed_args_->details.store_id.get() ? + *parsed_args_->details.store_id : ""; 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 c61e729..d9866f2 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() - : std::string(); + cookie->path = IsStringUTF8(canonical_cookie.Path()) ? + canonical_cookie.Path() : ""; 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 0844b83..f1bd93d 100644 --- a/chrome/browser/extensions/api/cookies/cookies_unittest.cc +++ b/chrome/browser/extensions/api/cookies/cookies_unittest.cc @@ -195,36 +195,22 @@ TEST_F(ExtensionCookiesTest, DomainMatching) { scoped_ptr<GetAll::Params> params(GetAll::Params::Create(args)); cookies_helpers::MatchFilter filter(¶ms->details); - net::CanonicalCookie cookie(GURL(), - std::string(), - std::string(), - tests[i].domain, - std::string(), - base::Time(), - base::Time(), - base::Time(), - false, - false); + net::CanonicalCookie cookie(GURL(), "", "", tests[i].domain,"", + 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(), - std::string(), - "011Q255bNX_1!yd\203e+", - "test.com", - "/path\203", - base::Time(), - base::Time(), - base::Time(), - false, - false); + net::CanonicalCookie canonical_cookie( + GURL(), "", "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 d209bed..0074233 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 std::string(); + return ""; } std::string InitializingRulesRegistry::RemoveAllRules( @@ -48,7 +48,7 @@ std::string InitializingRulesRegistry::RemoveAllRules( if (!error.empty()) return error; RemoveAllUsedRuleIdentifiers(extension_id); - return std::string(); + return ""; } std::string InitializingRulesRegistry::GetRules( @@ -122,7 +122,7 @@ std::string InitializingRulesRegistry::CheckAndFillInOptionalRules( used_rule_identifiers_[extension_id].insert(*(rule->id)); } } - return std::string(); + return ""; } 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 1be1983..4f49f36 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(std::string()); + registry_->SetResult(""); // 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(std::string()); + registry_->SetResult(""); // 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(std::string()); + registry_->SetResult(""); // 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 6c00b80..4a88e17 100644 --- a/chrome/browser/extensions/api/declarative_content/content_condition.cc +++ b/chrome/browser/extensions/api/declarative_content/content_condition.cc @@ -129,8 +129,7 @@ scoped_ptr<ContentCondition> ContentCondition::Create( if (!url_matcher_condition_set) { URLMatcherConditionSet::Conditions url_matcher_conditions; url_matcher_conditions.insert( - url_matcher_condition_factory->CreateHostPrefixCondition( - std::string())); + url_matcher_condition_factory->CreateHostPrefixCondition("")); 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 eb95b47..c9ed31e 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 std::string(); + return ""; } std::string ContentRulesRegistry::RemoveRulesImpl( @@ -221,7 +221,7 @@ std::string ContentRulesRegistry::RemoveRulesImpl( UpdateConditionCache(); - return std::string(); + return ""; } 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 dc3bead..813b6b9 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, std::string())); + ASSERT_TRUE(content::ExecuteScript(tab, "")); 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, std::string())); + ASSERT_TRUE(content::ExecuteScript(tab, "")); 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 695edac..c8cae51 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 std::string(); + return ""; } std::string WebRequestRulesRegistry::RemoveRulesImpl( @@ -223,7 +223,7 @@ std::string WebRequestRulesRegistry::RemoveRulesImpl( ClearCacheOnNavigation(); - return std::string(); + return ""; } 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 12a2994..c2b3d78 100644 --- a/chrome/browser/extensions/api/developer_private/entry_picker.cc +++ b/chrome/browser/extensions/api/developer_private/entry_picker.cc @@ -64,9 +64,8 @@ EntryPicker::EntryPicker(EntryPickerClient* client, last_directory, &info, file_type_index, - base::FilePath::StringType(), - owning_window, - NULL); + FILE_PATH_LITERAL(""), + 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 4ccc470..447efca 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(std::string()))); - EXPECT_FALSE( - DialDeviceData::IsDeviceDescriptionUrl(GURL("file://path/to/file"))); + EXPECT_FALSE(DialDeviceData::IsDeviceDescriptionUrl(GURL(""))); + 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 b378589..da1cc7b 100644 --- a/chrome/browser/extensions/api/dial/dial_service_unittest.cc +++ b/chrome/browser/extensions/api/dial/dial_service_unittest.cc @@ -116,7 +116,9 @@ TEST_F(DialServiceTest, TestResponseParsing) { DialDeviceData not_parsed; // Empty, garbage - EXPECT_FALSE(DialServiceImpl::ParseResponse(std::string(), now, ¬_parsed)); + EXPECT_FALSE(DialServiceImpl::ParseResponse( + "", + 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 6a126aa..44e7f29 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() : std::string())); - json->SetString(kFilenameKey, - download_item->GetFullPath().LossyDisplayName()); + json->SetString(kUrlKey, (url.is_valid() ? url.spec() : "")); + 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 e403cd5..23a1131 100644 --- a/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc +++ b/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc @@ -737,8 +737,7 @@ class HTML5FileWriter { ~HTML5FileWriter() { CHECK(BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind( &HTML5FileWriter::TearDownURLRequestContext, base::Unretained(this)))); - events_listener_->WaitFor( - profile_, kURLRequestContextToreDown, std::string()); + events_listener_->WaitFor(profile_, kURLRequestContextToreDown, ""); } bool WriteFile() { @@ -1072,10 +1071,8 @@ 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()), + std::string error = RunFunctionAndReturnError(MockedGetFileIconFunction( + download_item->GetTargetFilePath(), IconLoader::NORMAL, ""), 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 07845e4..0a5497f 100644 --- a/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc +++ b/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc @@ -692,9 +692,11 @@ 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 cad5250..232280a 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, std::string(), 0); + browser()->profile(), *action, tab_id, "", 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, std::string(), 1); + browser()->profile(), *page_action, tab_id, "", 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, std::string(), 1); + browser()->profile(), *page_action, tab_id, "", 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, std::string(), 0); + browser()->profile(), *page_action, tab_id, "", 0); EXPECT_TRUE(catcher.GetNextResult()); } @@ -273,9 +273,11 @@ 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 ff7fae7..fd32e96 100644 --- a/chrome/browser/extensions/api/extension_action/script_badge_apitest.cc +++ b/chrome/browser/extensions/api/extension_action/script_badge_apitest.cc @@ -88,8 +88,7 @@ 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(std::string())); + ui_test_utils::NavigateToURL(browser(), test_server()->GetURL("")); 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 e849e3cc..3bb588a 100644 --- a/chrome/browser/extensions/api/file_system/file_system_api.cc +++ b/chrome/browser/extensions/api/file_system/file_system_api.cc @@ -435,11 +435,8 @@ class FileSystemChooseEntryFunction::FilePicker select_file_dialog_->SelectFile(picker_type, string16(), suggested_name, - &file_type_info, - 0, - base::FilePath::StringType(), - owning_window, - NULL); + &file_type_info, 0, FILE_PATH_LITERAL(""), + 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 570c0fb..96da293 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( - std::string(), "application/x-chrome-extension", "jso"))); + options.push_back(linked_ptr<AcceptOption>( + BuildAcceptOption("", "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(std::string(), std::string(), "unrelated"))); + BuildAcceptOption("", "", "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(std::string(), std::string(), "jso,js"))); + BuildAcceptOption("", "", "jso,js"))); options.push_back(linked_ptr<AcceptOption>( - BuildAcceptOption(std::string(), std::string(), "cpp,cc"))); + BuildAcceptOption("", "", "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(std::string(), "image/*", "html"))); + BuildAcceptOption("", "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( - std::string(), "image/*,audio/*,video/*", std::string()))); + options.push_back(linked_ptr<AcceptOption>( + BuildAcceptOption("", "image/*,audio/*,video/*", ""))); 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", std::string()))); + BuildAcceptOption("File Types 101", "image/jpeg", ""))); 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 174f922..b6fec79d 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(std::string(), 0, 0, 0, 0); + RunAndCheckBounds("", 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 5b6b04d..f475e81 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, std::string()); + SetEnabled(true, true, ""); // 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, std::string()); - SetEnabled(true, true, std::string()); - const Extension* extension = ExtensionSystem::Get(browser()->profile()) - ->extension_service()->GetExtensionById(kId, false); + SetEnabled(false, true, ""); + SetEnabled(true, true, ""); + 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 e3075f9..aae6a25 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, std::string()); + ExtensionMessagePort port(source, MSG_ROUTING_CONTROL, ""); 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, std::string()); + ExtensionMessagePort port(source, MSG_ROUTING_CONTROL, ""); port.DispatchOnDisconnect(GET_OPPOSITE_PORT_ID(receiver_port_id), kReceivingEndDoesntExistError); return; @@ -320,8 +320,7 @@ 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, std::string()); + ExtensionMessagePort port(params->source, MSG_ROUTING_CONTROL, ""); 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 5e811bd..ff945d3 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, std::string()); + dict->SetString(keys::kProxyEventDetails, ""); 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 ff3cd32..116f85a 100644 --- a/chrome/browser/extensions/api/proxy/proxy_api_helpers_unittest.cc +++ b/chrome/browser/extensions/api/proxy/proxy_api_helpers_unittest.cc @@ -222,71 +222,41 @@ TEST(ExtensionProxyApiHelpers, CreateProxyConfigDict) { std::string error; scoped_ptr<DictionaryValue> exp_direct(ProxyConfigDictionary::CreateDirect()); scoped_ptr<DictionaryValue> out_direct( - CreateProxyConfigDict(ProxyPrefs::MODE_DIRECT, - false, - std::string(), - std::string(), - std::string(), - std::string(), + CreateProxyConfigDict(ProxyPrefs::MODE_DIRECT, false, "", "", "", "", &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, - std::string(), - std::string(), - std::string(), - std::string(), + CreateProxyConfigDict(ProxyPrefs::MODE_AUTO_DETECT, false, "", "", "", "", &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, - std::string(), - std::string(), - std::string(), - &error)); + CreateProxyConfigDict(ProxyPrefs::MODE_PAC_SCRIPT, false, + kSamplePacScriptUrl, "", "", "", &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, - std::string(), - kSamplePacScript, - std::string(), - std::string(), - &error)); + CreateProxyConfigDict(ProxyPrefs::MODE_PAC_SCRIPT, false, "", + kSamplePacScript, "", "", &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, - std::string(), - std::string(), - "foo:80", - "localhost", - &error)); + CreateProxyConfigDict(ProxyPrefs::MODE_FIXED_SERVERS, false, "", "", + "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, - std::string(), - std::string(), - std::string(), - std::string(), + CreateProxyConfigDict(ProxyPrefs::MODE_SYSTEM, false, "", "", "", "", &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 b9a804c..a2b5f97 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, std::string(), 0); + callback.Run(net::ERR_IO_PENDING, NULL, "", 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 fcfcdc8..ec530e8 100644 --- a/chrome/browser/extensions/api/storage/settings_sync_unittest.cc +++ b/chrome/browser/extensions/api/storage/settings_sync_unittest.cc @@ -130,10 +130,9 @@ 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, - std::string(), - std::string(), - scoped_ptr<Value>(new DictionaryValue())); + return SettingSyncData( + syncer::SyncChange::ACTION_INVALID, "", "", + 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 56a8403..a17684e 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() : std::string()); + return new StringValue(headers ? headers->GetStatusLine() : ""); } 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 0d2a3d6..a9f1319 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 std::string(); + return ""; } // 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 std::string(); + return ""; } void MergeOnBeforeSendHeadersResponses( @@ -816,26 +816,22 @@ 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(); + std::string actual_value = cookie->HasExpires() ? cookie->Expires() : ""; if (actual_value != *filter->expires) return false; } if (filter->max_age.get()) { - std::string actual_value = - cookie->HasMaxAge() ? cookie->MaxAge() : std::string(); + std::string actual_value = cookie->HasMaxAge() ? cookie->MaxAge() : ""; if (actual_value != base::IntToString(*filter->max_age)) return false; } if (filter->domain.get()) { - std::string actual_value = - cookie->HasDomain() ? cookie->Domain() : std::string(); + std::string actual_value = cookie->HasDomain() ? cookie->Domain() : ""; if (actual_value != *filter->domain) return false; } if (filter->path.get()) { - std::string actual_value = - cookie->HasPath() ? cookie->Path() : std::string(); + std::string actual_value = cookie->HasPath() ? cookie->Path() : ""; if (actual_value != *filter->path) return false; } @@ -884,8 +880,7 @@ 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(std::string())); + linked_ptr<net::ParsedCookie> cookie(new net::ParsedCookie("")); ApplyResponseCookieModification((*mod)->modification.get(), cookie.get()); cookies->push_back(cookie); modified = true; @@ -1013,7 +1008,7 @@ static std::string FindRemoveResponseHeader( return (*delta)->extension_id; } } - return std::string(); + return ""; } 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 fc78860..91e3dd9 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,10 +574,9 @@ TEST_F(ExtensionWebRequestTest, AccessRequestBodyData) { keys::kRequestBodyRawBytesKey, BinaryValue::CreateWithCopiedBuffer(kPlainBlock1, kPlainBlock1Length), &raw); - extensions::subtle::AppendKeyValuePair( - keys::kRequestBodyRawFileKey, - Value::CreateStringValue(std::string()), - &raw); + extensions::subtle::AppendKeyValuePair(keys::kRequestBodyRawFileKey, + Value::CreateStringValue(""), + &raw); extensions::subtle::AppendKeyValuePair( keys::kRequestBodyRawBytesKey, BinaryValue::CreateWithCopiedBuffer(kPlainBlock2, kPlainBlock2Length), @@ -963,7 +962,7 @@ void TestInitFromValue(const std::string& values, bool expected_return_code, } TEST_F(ExtensionWebRequestTest, InitFromValue) { - TestInitFromValue(std::string(), true, 0); + TestInitFromValue("", 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 91483c5..237941c 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(std::string())); + SetResult(Value::CreateStringValue("")); #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 8cb59aa..0264c36 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(std::string())); + SetResult(Value::CreateStringValue("")); 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 1a39317..81a63d1 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 7cf66d3..97005be 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, std::string(), GURL(), NULL); + this, i->first, i->second.manifest, "", GURL(), NULL); helper->Start(); } } diff --git a/chrome/browser/extensions/component_loader.cc b/chrome/browser/extensions/component_loader.cc index 82a6883..58c53b7 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 std::string(); + return ""; } 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 4b2b52a..bedcfee 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(std::string())); + manifest.reset(component_loader_.ParseManifest("")); 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 72e0f52..4a75636 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(), std::string()); + extension, event_name, event_args.get(), ""); } } } @@ -243,8 +243,10 @@ 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(), std::string()); + activity_log_->LogAPIAction(extension, + event_name + ".addListener", + args.get(), + ""); } } @@ -269,8 +271,10 @@ 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(), std::string()); + activity_log_->LogAPIAction(extension, + event_name + ".removeListener", + args.get(), + ""); } } @@ -380,7 +384,7 @@ bool EventRouter::HasEventListenerImpl(const ListenerMap& listener_map, } void EventRouter::BroadcastEvent(scoped_ptr<Event> event) { - DispatchEventImpl(std::string(), linked_ptr<Event>(event.release())); + DispatchEventImpl("", 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 f094608..15b7e97 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(std::string(), event_name, event_args.Pass(), 0, true, event_url); + HandleEvent("", event_name, event_args.Pass(), 0, true, event_url); } void EventRouterForwarder::DispatchEventToRenderers( @@ -37,12 +37,8 @@ void EventRouterForwarder::DispatchEventToRenderers( const GURL& event_url) { if (!profile) return; - HandleEvent(std::string(), - event_name, - event_args.Pass(), - profile, - use_profile_to_restrict_events, - event_url); + HandleEvent("", 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 6c2ca63..9a5c3ff 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(std::string(), ActionInfo::TYPE_PAGE, action_info); + ExtensionAction action("", ActionInfo::TYPE_PAGE, action_info); ASSERT_EQ("Initial Title", action.GetTitle(1)); action.SetTitle(ExtensionAction::kDefaultTabId, "foo"); @@ -31,7 +31,8 @@ TEST(ExtensionActionTest, Title) { } TEST(ExtensionActionTest, Visibility) { - ExtensionAction action(std::string(), ActionInfo::TYPE_PAGE, ActionInfo()); + ExtensionAction action("", ActionInfo::TYPE_PAGE, + ActionInfo()); ASSERT_FALSE(action.GetIsVisible(1)); action.SetAppearance(ExtensionAction::kDefaultTabId, ExtensionAction::ACTIVE); @@ -52,8 +53,8 @@ TEST(ExtensionActionTest, Visibility) { ASSERT_FALSE(action.GetIsVisible(1)); ASSERT_FALSE(action.GetIsVisible(100)); - ExtensionAction browser_action( - std::string(), ActionInfo::TYPE_BROWSER, ActionInfo()); + ExtensionAction browser_action("", ActionInfo::TYPE_BROWSER, + ActionInfo()); ASSERT_TRUE(browser_action.GetIsVisible(1)); } @@ -61,8 +62,8 @@ TEST(ExtensionActionTest, ScriptBadgeAnimation) { // Supports the icon animation. MessageLoop message_loop; - ExtensionAction script_badge( - std::string(), ActionInfo::TYPE_SCRIPT_BADGE, ActionInfo()); + ExtensionAction script_badge("", ActionInfo::TYPE_SCRIPT_BADGE, + ActionInfo()); EXPECT_FALSE(script_badge.GetIconAnimation(ExtensionAction::kDefaultTabId)); script_badge.SetAppearance(ExtensionAction::kDefaultTabId, ExtensionAction::ACTIVE); @@ -85,8 +86,8 @@ TEST(ExtensionActionTest, GetAttention) { // Supports the icon animation. scoped_ptr<MessageLoop> message_loop(new MessageLoop); - ExtensionAction script_badge( - std::string(), ActionInfo::TYPE_SCRIPT_BADGE, ActionInfo()); + ExtensionAction script_badge("", ActionInfo::TYPE_SCRIPT_BADGE, + ActionInfo()); EXPECT_FALSE(script_badge.GetIsVisible(1)); EXPECT_FALSE(script_badge.GetIconAnimation(1)); script_badge.SetAppearance(1, ExtensionAction::WANTS_ATTENTION); @@ -106,8 +107,8 @@ TEST(ExtensionActionTest, GetAttention) { TEST(ExtensionActionTest, Icon) { ActionInfo action_info; action_info.default_icon.Add(16, "icon16.png"); - ExtensionAction page_action( - std::string(), ActionInfo::TYPE_PAGE, action_info); + ExtensionAction page_action("", ActionInfo::TYPE_PAGE, + action_info); ASSERT_TRUE(page_action.default_icon()); EXPECT_EQ("icon16.png", page_action.default_icon()->Get( @@ -118,7 +119,8 @@ TEST(ExtensionActionTest, Icon) { } TEST(ExtensionActionTest, Badge) { - ExtensionAction action(std::string(), ActionInfo::TYPE_PAGE, ActionInfo()); + ExtensionAction action("", ActionInfo::TYPE_PAGE, + ActionInfo()); ASSERT_EQ("", action.GetBadgeText(1)); action.SetBadgeText(ExtensionAction::kDefaultTabId, "foo"); ASSERT_EQ("foo", action.GetBadgeText(1)); @@ -133,7 +135,8 @@ TEST(ExtensionActionTest, Badge) { } TEST(ExtensionActionTest, BadgeTextColor) { - ExtensionAction action(std::string(), ActionInfo::TYPE_PAGE, ActionInfo()); + ExtensionAction action("", ActionInfo::TYPE_PAGE, + ActionInfo()); ASSERT_EQ(0x00000000u, action.GetBadgeTextColor(1)); action.SetBadgeTextColor(ExtensionAction::kDefaultTabId, 0xFFFF0000u); ASSERT_EQ(0xFFFF0000u, action.GetBadgeTextColor(1)); @@ -148,7 +151,8 @@ TEST(ExtensionActionTest, BadgeTextColor) { } TEST(ExtensionActionTest, BadgeBackgroundColor) { - ExtensionAction action(std::string(), ActionInfo::TYPE_PAGE, ActionInfo()); + ExtensionAction action("", ActionInfo::TYPE_PAGE, + ActionInfo()); ASSERT_EQ(0x00000000u, action.GetBadgeBackgroundColor(1)); action.SetBadgeBackgroundColor(ExtensionAction::kDefaultTabId, 0xFFFF0000u); @@ -172,7 +176,7 @@ TEST(ExtensionActionTest, PopupUrl) { ActionInfo action_info; action_info.default_popup_url = url_foo; - ExtensionAction action(std::string(), ActionInfo::TYPE_PAGE, action_info); + ExtensionAction action("", 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 8d072ae..e3534e4 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(std::string()); + messages_.push_back(""); if (waiting_) MessageLoopForUI::current()->Quit(); break; @@ -114,45 +114,41 @@ void ExtensionApiTest::TearDownInProcessBrowserTestFixture() { } bool ExtensionApiTest::RunExtensionTest(const char* extension_name) { - return RunExtensionTestImpl( - extension_name, std::string(), kFlagEnableFileAccess); + return RunExtensionTestImpl(extension_name, "", kFlagEnableFileAccess); } bool ExtensionApiTest::RunExtensionTestIncognito(const char* extension_name) { - return RunExtensionTestImpl(extension_name, - std::string(), - kFlagEnableIncognito | kFlagEnableFileAccess); + return RunExtensionTestImpl( + extension_name, "", kFlagEnableIncognito | kFlagEnableFileAccess); } bool ExtensionApiTest::RunExtensionTestIgnoreManifestWarnings( const char* extension_name) { return RunExtensionTestImpl( - extension_name, std::string(), kFlagIgnoreManifestWarnings); + extension_name, "", 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, - std::string(), - kFlagEnableFileAccess | kFlagLoadAsComponent); + return RunExtensionTestImpl( + extension_name, "", kFlagEnableFileAccess | kFlagLoadAsComponent); } bool ExtensionApiTest::RunExtensionTestNoFileAccess( const char* extension_name) { - return RunExtensionTestImpl(extension_name, std::string(), kFlagNone); + return RunExtensionTestImpl(extension_name, "", kFlagNone); } bool ExtensionApiTest::RunExtensionTestIncognitoNoFileAccess( const char* extension_name) { - return RunExtensionTestImpl( - extension_name, std::string(), kFlagEnableIncognito); + return RunExtensionTestImpl(extension_name, "", kFlagEnableIncognito); } bool ExtensionApiTest::RunExtensionSubtest(const char* extension_name, @@ -178,8 +174,7 @@ bool ExtensionApiTest::RunPageTest(const std::string& page_url, } bool ExtensionApiTest::RunPlatformAppTest(const char* extension_name) { - return RunExtensionTestImpl( - extension_name, std::string(), kFlagLaunchPlatformApp); + return RunExtensionTestImpl(extension_name, "", 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 cfad60e..b051df9 100644 --- a/chrome/browser/extensions/extension_browsertest.cc +++ b/chrome/browser/extensions/extension_browsertest.cc @@ -337,13 +337,9 @@ class MockAutoConfirmExtensionInstallPrompt : public ExtensionInstallPrompt { const Extension* ExtensionBrowserTest::InstallExtensionFromWebstore( const base::FilePath& path, int expected_change) { - return InstallOrUpdateExtension(std::string(), - path, - INSTALL_UI_TYPE_NONE, - expected_change, - Manifest::INTERNAL, - browser(), - true); + return InstallOrUpdateExtension("", 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 9d79f56..9d1203c 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( - std::string(), path, INSTALL_UI_TYPE_NONE, expected_change); + return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_NONE, + expected_change); } // Same as above, but an install source other than Manifest::INTERNAL can be @@ -122,11 +122,8 @@ class ExtensionBrowserTest : virtual public InProcessBrowserTest, const base::FilePath& path, int expected_change, extensions::Manifest::Location install_source) { - return InstallOrUpdateExtension(std::string(), - path, - INSTALL_UI_TYPE_NONE, - expected_change, - install_source); + return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_NONE, + expected_change, install_source); } // Installs extension as if it came from the Chrome Webstore. @@ -147,27 +144,22 @@ class ExtensionBrowserTest : virtual public InProcessBrowserTest, const extensions::Extension* InstallExtensionWithUI( const base::FilePath& path, int expected_change) { - return InstallOrUpdateExtension( - std::string(), path, INSTALL_UI_TYPE_NORMAL, expected_change); + return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_NORMAL, + expected_change); } const extensions::Extension* InstallExtensionWithUIAutoConfirm( const base::FilePath& path, int expected_change, Browser* browser) { - return InstallOrUpdateExtension(std::string(), - path, - INSTALL_UI_TYPE_AUTO_CONFIRM, - expected_change, - browser, - false); + return InstallOrUpdateExtension("", 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( - std::string(), path, INSTALL_UI_TYPE_CANCEL, 0); + return InstallOrUpdateExtension("", 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 c15ba6f..00a1f39 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(), std::string()); + activity_log->LogAPIAction(extension, api_name, args.get(), ""); } } @@ -86,8 +86,11 @@ void LogFailure(const Extension* extension, } else { extensions::ActivityLog* activity_log = extensions::ActivityLog::GetInstance(profile); - activity_log->LogBlockedAction( - extension, api_name, args.get(), reason, std::string()); + activity_log->LogBlockedAction(extension, + api_name, + args.get(), + reason, + ""); } } diff --git a/chrome/browser/extensions/extension_pref_value_map_unittest.cc b/chrome/browser/extensions/extension_pref_value_map_unittest.cc index 7f1b2d5..bfa573f 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 b24e0e7..0f1d743 100644 --- a/chrome/browser/extensions/extension_prefs.cc +++ b/chrome/browser/extensions/extension_prefs.cc @@ -1670,8 +1670,7 @@ void ExtensionPrefs::SetDelayedInstallInfo( if (extension->RequiresSortOrdinal()) { extension_dict->SetString( kPrefSuggestedPageOrdinal, - page_ordinal.IsValid() ? page_ordinal.ToInternalValue() - : std::string()); + page_ordinal.IsValid() ? page_ordinal.ToInternalValue() : ""); } 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 09fc245..a4cb67f 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 std::string(); + return ""; return render_view_host->GetSiteInstance()->GetSiteURL().host(); } diff --git a/chrome/browser/extensions/extension_protocols.cc b/chrome/browser/extensions/extension_protocols.cc index 503b2ad..049d813 100644 --- a/chrome/browser/extensions/extension_protocols.cc +++ b/chrome/browser/extensions/extension_protocols.cc @@ -320,8 +320,7 @@ 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() ? std::string() - : request->url().path().substr(1); + request->url().path().empty() ? "" : 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 368d048..a6068b5 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, std::string(), path, Manifest::UNPACKED); + extensions::ExtensionInfo extension_info(&manifest, "", 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 e892ba1..90aa01a 100644 --- a/chrome/browser/extensions/extension_test_message_listener.cc +++ b/chrome/browser/extensions/extension_test_message_listener.cc @@ -17,6 +17,7 @@ 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()); @@ -58,7 +59,7 @@ void ExtensionTestMessageListener::Observe( satisfied_ = true; registrar_.RemoveAll(); // Stop listening for more messages. if (!will_reply_) { - function_->Reply(std::string()); + function_->Reply(""); function_ = NULL; } if (waiting_) { diff --git a/chrome/browser/extensions/extensions_quota_service.cc b/chrome/browser/extensions/extensions_quota_service.cc index 6b267a5..c01b9e3 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 std::string(); + return ""; // 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 std::string(); // No heuristic implies no limit. + return ""; // 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 std::string(); + return ""; 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 75bd788..5f8943c 100644 --- a/chrome/browser/extensions/external_policy_loader_unittest.cc +++ b/chrome/browser/extensions/external_policy_loader_unittest.cc @@ -139,8 +139,7 @@ TEST_F(ExternalPolicyLoaderTest, InvalidEntriesIgnored) { // Add invalid entries. forced_extensions.SetString("invalid", "http://www.example.com/crx"); - forced_extensions.SetString("dddddddddddddddddddddddddddddddd", - std::string()); + forced_extensions.SetString("dddddddddddddddddddddddddddddddd", ""); 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 ec55a4c..b7717bb 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(std::string()); + GURL root_url = test_server()->GetURL(""); 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 4256c61..0335866 100644 --- a/chrome/browser/extensions/menu_manager.cc +++ b/chrome/browser/extensions/menu_manager.cc @@ -833,10 +833,14 @@ void MenuManager::RemoveAllIncognitoContextItems() { RemoveContextMenuItem(*remove_iter); } -MenuItem::Id::Id() : incognito(false), uid(0) {} +MenuItem::Id::Id() + : incognito(false), extension_id(""), uid(0), string_uid("") { +} MenuItem::Id::Id(bool incognito, const std::string& extension_id) - : incognito(incognito), extension_id(extension_id), uid(0) {} + : incognito(incognito), extension_id(extension_id), uid(0), + string_uid("") { +} MenuItem::Id::~Id() { } diff --git a/chrome/browser/extensions/pending_extension_info.cc b/chrome/browser/extensions/pending_extension_info.cc index a1e93d8..6fc0adc 100644 --- a/chrome/browser/extensions/pending_extension_info.cc +++ b/chrome/browser/extensions/pending_extension_info.cc @@ -25,7 +25,8 @@ PendingExtensionInfo::PendingExtensionInfo( install_source_(install_source) {} PendingExtensionInfo::PendingExtensionInfo() - : update_url_(), + : id_(""), + 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 58c2548..62f8545 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(std::string()), params); + browser()->profile(), extension, GURL(""), params); } ShellWindow* PlatformAppBrowserTest::CreateShellWindowFromParams( const Extension* extension, const ShellWindow::CreateParams& params) { return ShellWindow::Create( - browser()->profile(), extension, GURL(std::string()), params); + browser()->profile(), extension, GURL(""), 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 46daa89..a883e66 100644 --- a/chrome/browser/extensions/platform_app_launcher.cc +++ b/chrome/browser/extensions/platform_app_launcher.cc @@ -107,7 +107,10 @@ class PlatformAppPathLauncher PlatformAppPathLauncher(Profile* profile, const Extension* extension, const base::FilePath& file_path) - : profile_(profile), extension_(extension), file_path_(file_path) {} + : profile_(profile), + extension_(extension), + file_path_(file_path), + handler_id_("") {} 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 cb773f8..d2cf6bc 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(std::string())); + GURL("")); 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(std::string())); + GURL("")); 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 b35b776..c5ed09f 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(std::string()), val); + callback_.Run(kRendererDestroyed, -1, GURL(""), val); delete this; } diff --git a/chrome/browser/extensions/subscribe_page_action_browsertest.cc b/chrome/browser/extensions/subscribe_page_action_browsertest.cc index 02449a1..471ad5c 100644 --- a/chrome/browser/extensions/subscribe_page_action_browsertest.cc +++ b/chrome/browser/extensions/subscribe_page_action_browsertest.cc @@ -114,8 +114,10 @@ void NavigateToFeedAndValidate(net::TestServer* server, GetFeedUrl(server, url, true, extension_id)); WebContents* tab = browser->tab_strip_model()->GetActiveWebContents(); - ASSERT_TRUE(ValidatePageElement( - tab, std::string(), kScriptFeedTitle, expected_feed_title)); + ASSERT_TRUE(ValidatePageElement(tab, + "", + 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 cd420ad..cdcec02 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, std::string())); + return_route_id, install_id, true, "")); } 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 f165732..0c04a89 100644 --- a/chrome/browser/extensions/updater/extension_downloader.cc +++ b/chrome/browser/extensions/updater/extension_downloader.cc @@ -153,7 +153,12 @@ UpdateDetails::UpdateDetails(const std::string& id, const Version& version) UpdateDetails::~UpdateDetails() {} -ExtensionDownloader::ExtensionFetch::ExtensionFetch() : url() {} + +ExtensionDownloader::ExtensionFetch::ExtensionFetch() + : id(""), + url(), + package_hash(""), + version("") {} ExtensionDownloader::ExtensionFetch::ExtensionFetch( const std::string& id, @@ -215,11 +220,7 @@ 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, - std::string(), + return AddExtensionData(id, version, Manifest::TYPE_UNKNOWN, update_url, "", request_id); } @@ -248,10 +249,7 @@ void ExtensionDownloader::StartBlacklistUpdate( new ManifestFetchData(extension_urls::GetWebstoreUpdateUrl(), request_id)); DCHECK(blacklist_fetch->base_url().SchemeIsSecure()); - blacklist_fetch->AddExtension(kBlacklistAppID, - version, - &ping_data, - std::string(), + blacklist_fetch->AddExtension(kBlacklistAppID, version, &ping_data, "", kDefaultInstallSource); StartUpdateCheck(blacklist_fetch.Pass()); } diff --git a/chrome/browser/extensions/updater/extension_updater.cc b/chrome/browser/extensions/updater/extension_updater.cc index 130da8f..feadf5a 100644 --- a/chrome/browser/extensions/updater/extension_updater.cc +++ b/chrome/browser/extensions/updater/extension_updater.cc @@ -106,7 +106,10 @@ ExtensionUpdater::FetchedCRXFile::FetchedCRXFile( download_url(u), request_ids(request_ids) {} -ExtensionUpdater::FetchedCRXFile::FetchedCRXFile() : path(), download_url() {} +ExtensionUpdater::FetchedCRXFile::FetchedCRXFile() + : extension_id(""), + 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 3481c0c..4921d9e 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] : std::string(); + (*result)[key] = (key_val.size() == 2) ? key_val[1] : ""; } else { NOTREACHED(); } @@ -637,8 +637,7 @@ 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, std::string(), std::string()); + fetch_data.AddExtension(id, version, &kNeverPingedData, "", ""); std::map<std::string, std::string> params; VerifyQueryAndExtractParameters(fetch_data.full_url().query(), ¶ms); @@ -654,8 +653,7 @@ 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", std::string()); + fetch_data.AddExtension(id, version, &kNeverPingedData, "bar", ""); std::map<std::string, std::string> params; VerifyQueryAndExtractParameters(fetch_data.full_url().query(), ¶ms); EXPECT_EQ(id, params["id"]); @@ -670,8 +668,7 @@ 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", std::string()); + fetch_data.AddExtension(id, version, &kNeverPingedData, "a=1&b=2&c", ""); std::map<std::string, std::string> params; VerifyQueryAndExtractParameters(fetch_data.full_url().query(), ¶ms); EXPECT_EQ(id, params["id"]); @@ -741,12 +738,14 @@ 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, 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); + 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); EXPECT_CALL(delegate, IsExtensionPending(_)).WillRepeatedly(Return(false)); EXPECT_CALL(delegate, GetExtensionExistingVersion(id1, _)) @@ -783,11 +782,8 @@ 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, - std::string()); + fetch_data.AddExtension(*it, "1.0.0.0", + &kNeverPingedData, kEmptyUpdateUrlData, ""); AddParseResult(*it, "1.1", "http://localhost/e1_1.1.crx", &updates); } @@ -820,14 +816,10 @@ 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, 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()); + 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, ""); // This will start the first fetcher and queue the others. The next in queue // is started as each fetcher receives its response. @@ -935,8 +927,7 @@ 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, std::string()); + fetch->AddExtension("1111", "1.0", &zeroDays, kEmptyUpdateUrlData, ""); // This will start the first fetcher. downloader.StartUpdateCheck(fetch.Pass()); @@ -963,8 +954,7 @@ 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, std::string()); + fetch->AddExtension("1111", "1.0", &zeroDays, kEmptyUpdateUrlData, ""); // This will start the first fetcher. downloader.StartUpdateCheck(fetch.Pass()); @@ -1016,7 +1006,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); @@ -1152,8 +1142,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"; @@ -1367,7 +1357,7 @@ class ExtensionUpdaterTest : public testing::Test { fetcher->set_url(fetched_urls[0]); fetcher->set_status(net::URLRequestStatus()); fetcher->set_response_code(500); - fetcher->SetResponseString(std::string()); + fetcher->SetResponseString(""); fetcher->delegate()->OnURLFetchComplete(fetcher); fetcher = factory.GetFetcherByID(ExtensionDownloader::kManifestFetcherId); @@ -1452,11 +1442,8 @@ 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, - std::string()); + fetch_data.AddExtension(extension->id(), extension->VersionString(), + &kNeverPingedData, kEmptyUpdateUrlData, ""); UpdateManifest::Results results; results.daystart_elapsed_seconds = 750; @@ -1660,7 +1647,7 @@ TEST_F(ExtensionUpdaterTest, TestManifestFetchesBuilderAddExtension) { EXPECT_EQ(1u, ManifestFetchersCount(downloader.get())); // Extensions with empty IDs should be rejected. - EXPECT_FALSE(downloader->AddPendingExtension(std::string(), GURL(), 0)); + EXPECT_FALSE(downloader->AddPendingExtension("", 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 09b7f8e..81db7ed 100644 --- a/chrome/browser/extensions/webstore_installer.cc +++ b/chrome/browser/extensions/webstore_installer.cc @@ -125,8 +125,7 @@ void GetDownloadFilePath( base::FilePath file = directory.AppendASCII(id + "_" + random_number + ".crx"); - int uniquifier = - file_util::GetUniquePathNumber(file, base::FilePath::StringType()); + int uniquifier = file_util::GetUniquePathNumber(file, FILE_PATH_LITERAL("")); 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 7df550f..cadce50 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(std::string()); + CompleteInstall(""); 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, - std::string(), // We don't have any icon data. - icon_url, - profile_->GetRequestContext()); + scoped_refptr<WebstoreInstallHelper> helper = new WebstoreInstallHelper( + this, + id_, + manifest, + "", // 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(std::string()); + CompleteInstall(""); return; } @@ -190,7 +190,7 @@ void WebstoreStandaloneInstaller::OnWebstoreParseFailure( void WebstoreStandaloneInstaller::InstallUIProceed() { if (!CheckRequestorAlive()) { - CompleteInstall(std::string()); + CompleteInstall(""); return; } @@ -219,7 +219,7 @@ void WebstoreStandaloneInstaller::InstallUIAbort(bool user_initiated) { void WebstoreStandaloneInstaller::OnExtensionInstallSuccess( const std::string& id) { CHECK_EQ(id_, id); - CompleteInstall(std::string()); + CompleteInstall(""); } void WebstoreStandaloneInstaller::OnExtensionInstallFailure( |