Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1394)

Unified Diff: chrome/browser/extensions/api/cookies/cookies_api.cc

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/cookies/cookies_api.cc
diff --git a/chrome/browser/extensions/api/cookies/cookies_api.cc b/chrome/browser/extensions/api/cookies/cookies_api.cc
index f3a4a359a6669ae37ed795592fa6ecf06b505be0..c35b830497a05db03a96af7a2d21cc4a0c908149 100644
--- a/chrome/browser/extensions/api/cookies/cookies_api.cc
+++ b/chrome/browser/extensions/api/cookies/cookies_api.cc
@@ -203,8 +203,9 @@ bool CookiesGetFunction::RunImpl() {
if (!ParseUrl(parsed_args_->details.url, &url_, true))
return false;
- std::string store_id = parsed_args_->details.store_id.get() ?
- *parsed_args_->details.store_id : "";
+ std::string store_id =
+ parsed_args_->details.store_id.get() ? *parsed_args_->details.store_id
+ : std::string();
net::URLRequestContextGetter* store_context = NULL;
if (!ParseStoreContext(&store_id, &store_context))
return false;
@@ -276,8 +277,9 @@ bool CookiesGetAllFunction::RunImpl() {
return false;
}
- std::string store_id = parsed_args_->details.store_id.get() ?
- *parsed_args_->details.store_id : "";
+ std::string store_id =
+ parsed_args_->details.store_id.get() ? *parsed_args_->details.store_id
+ : std::string();
net::URLRequestContextGetter* store_context = NULL;
if (!ParseStoreContext(&store_id, &store_context))
return false;
@@ -339,8 +341,9 @@ bool CookiesSetFunction::RunImpl() {
if (!ParseUrl(parsed_args_->details.url, &url_, true))
return false;
- std::string store_id = parsed_args_->details.store_id.get() ?
- *parsed_args_->details.store_id : "";
+ std::string store_id =
+ parsed_args_->details.store_id.get() ? *parsed_args_->details.store_id
+ : std::string();
net::URLRequestContextGetter* store_context = NULL;
if (!ParseStoreContext(&store_id, &store_context))
return false;
@@ -374,17 +377,19 @@ void CookiesSetFunction::SetCookieOnIOThread() {
cookie_monster->SetCookieWithDetailsAsync(
url_,
- parsed_args_->details.name.get() ? *parsed_args_->details.name : "",
- parsed_args_->details.value.get() ? *parsed_args_->details.value : "",
- parsed_args_->details.domain.get() ? *parsed_args_->details.domain : "",
- parsed_args_->details.path.get() ? *parsed_args_->details.path : "",
+ parsed_args_->details.name.get() ? *parsed_args_->details.name
+ : std::string(),
+ parsed_args_->details.value.get() ? *parsed_args_->details.value
+ : std::string(),
+ parsed_args_->details.domain.get() ? *parsed_args_->details.domain
+ : std::string(),
+ parsed_args_->details.path.get() ? *parsed_args_->details.path
+ : std::string(),
expiration_time,
- parsed_args_->details.secure.get() ?
- *parsed_args_->details.secure.get() :
- false,
- parsed_args_->details.http_only.get() ?
- *parsed_args_->details.http_only :
- false,
+ parsed_args_->details.secure.get() ? *parsed_args_->details.secure.get()
+ : false,
+ parsed_args_->details.http_only.get() ? *parsed_args_->details.http_only
+ : false,
base::Bind(&CookiesSetFunction::PullCookie, this));
}
@@ -406,8 +411,9 @@ void CookiesSetFunction::PullCookieCallback(
// Return the first matching cookie. Relies on the fact that the
// CookieMonster returns them in canonical order (longest path, then
// earliest creation time).
- std::string name = parsed_args_->details.name.get() ?
- *parsed_args_->details.name : "";
+ std::string name =
+ parsed_args_->details.name.get() ? *parsed_args_->details.name
+ : std::string();
if (it->Name() == name) {
scoped_ptr<Cookie> cookie(
cookies_helpers::CreateCookie(*it, *parsed_args_->details.store_id));
@@ -425,10 +431,10 @@ void CookiesSetFunction::PullCookieCallback(
void CookiesSetFunction::RespondOnUIThread() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
if (!success_) {
- std::string name = parsed_args_->details.name.get() ?
- *parsed_args_->details.name : "";
- error_ = ErrorUtils::FormatErrorMessage(
- keys::kCookieSetFailedError, name);
+ std::string name =
+ parsed_args_->details.name.get() ? *parsed_args_->details.name
+ : std::string();
+ error_ = ErrorUtils::FormatErrorMessage(keys::kCookieSetFailedError, name);
}
SendResponse(success_);
}
@@ -447,8 +453,9 @@ bool CookiesRemoveFunction::RunImpl() {
if (!ParseUrl(parsed_args_->details.url, &url_, true))
return false;
- std::string store_id = parsed_args_->details.store_id.get() ?
- *parsed_args_->details.store_id : "";
+ std::string store_id =
+ parsed_args_->details.store_id.get() ? *parsed_args_->details.store_id
+ : std::string();
net::URLRequestContextGetter* store_context = NULL;
if (!ParseStoreContext(&store_id, &store_context))
return false;

Powered by Google App Engine
This is Rietveld 408576698