summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authormmenke <mmenke@chromium.org>2016-02-01 20:03:10 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-02 04:04:13 +0000
commitea4cd40b48a06cc3912fd758f90cd76bf1e77716 (patch)
treed9954e89d31d93431abc8a2afffd06e278b05555 /chrome/browser
parentae456a6296d23510271580a112a0898515046d48 (diff)
downloadchromium_src-ea4cd40b48a06cc3912fd758f90cd76bf1e77716.zip
chromium_src-ea4cd40b48a06cc3912fd758f90cd76bf1e77716.tar.gz
chromium_src-ea4cd40b48a06cc3912fd758f90cd76bf1e77716.tar.bz2
Promote SetCookieWithDetailsAsync from CookieMonster to CookieStore.
This means that more classes can just use the CookieStore interface, rather than depending on a particular implementation of it. Also remove an argument from SetCookieWithDetailsAsync that was no longer being used, and add an argument to set the creation time, so that a followup CL can replace ImportCookies calls with SetCookieWithDetailsAsync. TBR=tedchoc@chromium.org BUG=579653 Review URL: https://codereview.chromium.org/1644163002 Cr-Commit-Position: refs/heads/master@{#372883}
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/android/cookies/cookies_fetcher.cc12
-rw-r--r--chrome/browser/extensions/api/cookies/cookies_api.cc20
2 files changed, 13 insertions, 19 deletions
diff --git a/chrome/browser/android/cookies/cookies_fetcher.cc b/chrome/browser/android/cookies/cookies_fetcher.cc
index abc62c6..0a65042 100644
--- a/chrome/browser/android/cookies/cookies_fetcher.cc
+++ b/chrome/browser/android/cookies/cookies_fetcher.cc
@@ -12,7 +12,6 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/common/content_switches.h"
#include "jni/CookiesFetcher_jni.h"
-#include "net/cookies/cookie_monster.h"
#include "net/cookies/cookie_store.h"
#include "net/url_request/url_request_context.h"
@@ -63,9 +62,7 @@ void CookiesFetcher::PersistCookiesInternal(
return;
}
- net::CookieMonster* monster = store->GetCookieMonster();
-
- monster->GetAllCookiesAsync(base::Bind(
+ store->GetAllCookiesAsync(base::Bind(
&CookiesFetcher::OnCookiesFetchFinished, base::Unretained(this)));
}
@@ -154,7 +151,6 @@ void CookiesFetcher::RestoreToCookieJarInternal(
return;
}
- net::CookieMonster* monster = store->GetCookieMonster();
base::Callback<void(bool success)> cb;
// TODO(estark): Remove kEnableExperimentalWebPlatformFeatures check
@@ -163,11 +159,11 @@ void CookiesFetcher::RestoreToCookieJarInternal(
bool experimental_features_enabled =
base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableExperimentalWebPlatformFeatures);
- monster->SetCookieWithDetailsAsync(
+ store->SetCookieWithDetailsAsync(
cookie.Source(), cookie.Name(), cookie.Value(), cookie.Domain(),
- cookie.Path(), cookie.ExpiryDate(), cookie.IsSecure(),
+ cookie.Path(), base::Time(), cookie.ExpiryDate(), cookie.IsSecure(),
cookie.IsHttpOnly(), cookie.IsSameSite(), experimental_features_enabled,
- experimental_features_enabled, cookie.Priority(), cb);
+ cookie.Priority(), cb);
}
// JNI functions
diff --git a/chrome/browser/extensions/api/cookies/cookies_api.cc b/chrome/browser/extensions/api/cookies/cookies_api.cc
index c3dfe74..2742ba29 100644
--- a/chrome/browser/extensions/api/cookies/cookies_api.cc
+++ b/chrome/browser/extensions/api/cookies/cookies_api.cc
@@ -32,6 +32,7 @@
#include "net/cookies/canonical_cookie.h"
#include "net/cookies/cookie_constants.h"
#include "net/cookies/cookie_monster.h"
+#include "net/cookies/cookie_store.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_getter.h"
@@ -368,10 +369,8 @@ bool CookiesSetFunction::RunAsync() {
void CookiesSetFunction::SetCookieOnIOThread() {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
- net::CookieMonster* cookie_monster =
- store_browser_context_->GetURLRequestContext()
- ->cookie_store()
- ->GetCookieMonster();
+ net::CookieStore* cookie_store =
+ store_browser_context_->GetURLRequestContext()->cookie_store();
base::Time expiration_time;
if (parsed_args_->details.expiration_date.get()) {
@@ -387,7 +386,7 @@ void CookiesSetFunction::SetCookieOnIOThread() {
->network_delegate()
->AreExperimentalCookieFeaturesEnabled();
- cookie_monster->SetCookieWithDetailsAsync(
+ cookie_store->SetCookieWithDetailsAsync(
url_, parsed_args_->details.name.get() ? *parsed_args_->details.name
: std::string(),
parsed_args_->details.value.get() ? *parsed_args_->details.value
@@ -396,6 +395,7 @@ void CookiesSetFunction::SetCookieOnIOThread() {
: std::string(),
parsed_args_->details.path.get() ? *parsed_args_->details.path
: std::string(),
+ base::Time(),
expiration_time,
parsed_args_->details.secure.get() ? *parsed_args_->details.secure.get()
: false,
@@ -405,19 +405,17 @@ void CookiesSetFunction::SetCookieOnIOThread() {
// to extend the extension API to support them. For the moment, we'll set
// all cookies as non-First-party-only.
false, are_experimental_cookie_features_enabled,
- are_experimental_cookie_features_enabled, net::COOKIE_PRIORITY_DEFAULT,
+ net::COOKIE_PRIORITY_DEFAULT,
base::Bind(&CookiesSetFunction::PullCookie, this));
}
void CookiesSetFunction::PullCookie(bool set_cookie_result) {
// Pull the newly set cookie.
- net::CookieMonster* cookie_monster =
- store_browser_context_->GetURLRequestContext()
- ->cookie_store()
- ->GetCookieMonster();
+ net::CookieStore* cookie_store =
+ store_browser_context_->GetURLRequestContext()->cookie_store();
success_ = set_cookie_result;
cookies_helpers::GetCookieListFromStore(
- cookie_monster, url_,
+ cookie_store, url_,
base::Bind(&CookiesSetFunction::PullCookieCallback, this));
}