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

Unified Diff: chrome/browser/profiles/profile_impl_io_data.cc

Issue 2874973002: Flush Channel IDs when Cookies get saved to a persistent backend (Closed)
Patch Set: clean up a few things Created 3 years, 7 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/profiles/profile_impl_io_data.cc
diff --git a/chrome/browser/profiles/profile_impl_io_data.cc b/chrome/browser/profiles/profile_impl_io_data.cc
index 8eb31578fc4518f17fc7f0bbfd1de7c74d4e5643..3e805b897d2a5a30a744de844ab1237816a08a89 100644
--- a/chrome/browser/profiles/profile_impl_io_data.cc
+++ b/chrome/browser/profiles/profile_impl_io_data.cc
@@ -490,17 +490,6 @@ void ProfileImplIOData::InitializeInternal(
main_context->set_proxy_service(proxy_service());
- // Set up cookie store.
- DCHECK(!lazy_params_->cookie_path.empty());
-
- content::CookieStoreConfig cookie_config(
- lazy_params_->cookie_path, lazy_params_->session_cookie_mode,
- lazy_params_->special_storage_policy.get(),
- profile_params->cookie_monster_delegate.get());
- cookie_config.crypto_delegate = cookie_config::GetCookieCryptoDelegate();
- main_context_storage->set_cookie_store(
- content::CreateCookieStore(cookie_config));
-
// Set up server bound cert service.
DCHECK(!lazy_params_->channel_id_path.empty());
scoped_refptr<QuotaPolicyChannelIDStore> channel_id_db =
@@ -513,6 +502,18 @@ void ProfileImplIOData::InitializeInternal(
base::MakeUnique<net::ChannelIDService>(
new net::DefaultChannelIDStore(channel_id_db.get())));
+ // Set up cookie store.
+ DCHECK(!lazy_params_->cookie_path.empty());
+
+ content::CookieStoreConfig cookie_config(
+ lazy_params_->cookie_path, lazy_params_->session_cookie_mode,
+ lazy_params_->special_storage_policy.get(),
+ profile_params->cookie_monster_delegate.get());
+ cookie_config.crypto_delegate = cookie_config::GetCookieCryptoDelegate();
+ cookie_config.channel_id_service = main_context->channel_id_service();
+ main_context_storage->set_cookie_store(
+ content::CreateCookieStore(cookie_config));
+
main_context->cookie_store()->SetChannelIDServiceID(
main_context->channel_id_service()->GetUniqueID());
@@ -585,6 +586,7 @@ void ProfileImplIOData::
cookie_config.crypto_delegate = cookie_config::GetCookieCryptoDelegate();
// Enable cookies for chrome-extension URLs.
cookie_config.cookieable_schemes.push_back(extensions::kExtensionScheme);
+ cookie_config.channel_id_service = extensions_context->channel_id_service();
extensions_cookie_store_ = content::CreateCookieStore(cookie_config);
extensions_context->set_cookie_store(extensions_cookie_store_.get());
if (extensions_context->channel_id_service()) {
@@ -640,19 +642,19 @@ net::URLRequestContext* ProfileImplIOData::InitializeAppRequestContext(
std::unique_ptr<net::CookieStore> cookie_store;
scoped_refptr<net::SQLiteChannelIDStore> channel_id_db;
if (partition_descriptor.in_memory) {
- cookie_store = content::CreateCookieStore(content::CookieStoreConfig());
- } else {
+ cookie_path = base::FilePath();
+ }
+ content::CookieStoreConfig cookie_config(
+ cookie_path, content::CookieStoreConfig::EPHEMERAL_SESSION_COOKIES,
+ nullptr, nullptr);
+ if (!partition_descriptor.in_memory) {
// Use an app-specific cookie store.
DCHECK(!cookie_path.empty());
// TODO(creis): We should have a cookie delegate for notifying the cookie
// extensions API, but we need to update it to understand isolated apps
// first.
- content::CookieStoreConfig cookie_config(
- cookie_path, content::CookieStoreConfig::EPHEMERAL_SESSION_COOKIES,
- nullptr, nullptr);
cookie_config.crypto_delegate = cookie_config::GetCookieCryptoDelegate();
- cookie_store = content::CreateCookieStore(cookie_config);
channel_id_db = new net::SQLiteChannelIDStore(
channel_id_path,
base::CreateSequencedTaskRunnerWithTraits(
@@ -661,6 +663,8 @@ net::URLRequestContext* ProfileImplIOData::InitializeAppRequestContext(
std::unique_ptr<net::ChannelIDService> channel_id_service(
new net::ChannelIDService(
new net::DefaultChannelIDStore(channel_id_db.get())));
+ cookie_config.channel_id_service = channel_id_service.get();
+ cookie_store = content::CreateCookieStore(cookie_config);
cookie_store->SetChannelIDServiceID(channel_id_service->GetUniqueID());
// Build a new HttpNetworkSession that uses the new ChannelIDService.

Powered by Google App Engine
This is Rietveld 408576698