summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/api/cookies/cookies_api.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/extensions/api/cookies/cookies_api.cc')
-rw-r--r--chrome/browser/extensions/api/cookies/cookies_api.cc55
1 files changed, 24 insertions, 31 deletions
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;