Commit 141dfc70 authored by Nick Harper's avatar Nick Harper Committed by Commit Bot

Don't restrict creation of ChannelIDService to only when features::kChannelID is enabled

This is a revert of http://crrev.com/1e5757d just for the two files here.

Bug: 841685
Change-Id: I4d6b211d45e2b2104b440daa8c8f6715fb6c5ab2
Reviewed-on: https://chromium-review.googlesource.com/1055678Reviewed-by: default avatarRyan Hamilton <rch@chromium.org>
Commit-Queue: Nick Harper <nharper@chromium.org>
Cr-Commit-Position: refs/heads/master@{#557967}
parent c657d45e
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include "chrome/common/chrome_content_client.h" #include "chrome/common/chrome_content_client.h"
#include "chrome/common/chrome_paths_internal.h" #include "chrome/common/chrome_paths_internal.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
#include "components/network_session_configurator/common/network_features.h"
#include "components/pref_registry/pref_registry_syncable.h" #include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_context.h"
...@@ -189,15 +188,9 @@ ProfileNetworkContextService::CreateNetworkContextParams( ...@@ -189,15 +188,9 @@ ProfileNetworkContextService::CreateNetworkContextParams(
cookie_path = cookie_path.Append(chrome::kCookieFilename); cookie_path = cookie_path.Append(chrome::kCookieFilename);
network_context_params->cookie_path = cookie_path; network_context_params->cookie_path = cookie_path;
// The same ChannelID store is used for both Channel ID and Token Binding, base::FilePath channel_id_path = path;
// so if either are enabled the path must be set. If neither is enabled, the channel_id_path = channel_id_path.Append(chrome::kChannelIDFilename);
// path must not be set. network_context_params->channel_id_path = channel_id_path;
if (base::FeatureList::IsEnabled(features::kTokenBinding) ||
base::FeatureList::IsEnabled(features::kChannelID)) {
base::FilePath channel_id_path = path;
channel_id_path = channel_id_path.Append(chrome::kChannelIDFilename);
network_context_params->channel_id_path = channel_id_path;
}
if (relative_partition_path.empty()) { if (relative_partition_path.empty()) {
network_context_params->restore_old_session_cookies = network_context_params->restore_old_session_cookies =
......
...@@ -66,6 +66,8 @@ ...@@ -66,6 +66,8 @@
#include "net/cookies/cookie_store.h" #include "net/cookies/cookie_store.h"
#include "net/http/http_cache.h" #include "net/http/http_cache.h"
#include "net/http/http_network_session.h" #include "net/http/http_network_session.h"
#include "net/http/http_server_properties.h"
#include "net/http/http_server_properties_manager.h"
#include "net/net_buildflags.h" #include "net/net_buildflags.h"
#include "net/ssl/channel_id_service.h" #include "net/ssl/channel_id_service.h"
#include "net/url_request/url_request_context_builder.h" #include "net/url_request/url_request_context_builder.h"
...@@ -460,18 +462,17 @@ void ProfileImplIOData::InitializeInternal( ...@@ -460,18 +462,17 @@ void ProfileImplIOData::InitializeInternal(
base::TaskShutdownBehavior::BLOCK_SHUTDOWN}); base::TaskShutdownBehavior::BLOCK_SHUTDOWN});
// Set up server bound cert service. // Set up server bound cert service.
std::unique_ptr<net::ChannelIDService> channel_id_service; DCHECK(!profile_params->main_network_context_params->channel_id_path.value()
if (profile_params->main_network_context_params->channel_id_path .empty());
.has_value()) { scoped_refptr<QuotaPolicyChannelIDStore> channel_id_db =
scoped_refptr<QuotaPolicyChannelIDStore> channel_id_db = new QuotaPolicyChannelIDStore(
new QuotaPolicyChannelIDStore( profile_params->main_network_context_params->channel_id_path
profile_params->main_network_context_params->channel_id_path .value(),
.value(), cookie_background_task_runner,
cookie_background_task_runner, lazy_params_->special_storage_policy.get());
lazy_params_->special_storage_policy.get()); std::unique_ptr<net::ChannelIDService> channel_id_service(
channel_id_service = std::make_unique<net::ChannelIDService>( std::make_unique<net::ChannelIDService>(
new net::DefaultChannelIDStore(channel_id_db.get())); new net::DefaultChannelIDStore(channel_id_db.get())));
}
// Set up cookie store. // Set up cookie store.
content::CookieStoreConfig cookie_config( content::CookieStoreConfig cookie_config(
...@@ -486,9 +487,7 @@ void ProfileImplIOData::InitializeInternal( ...@@ -486,9 +487,7 @@ void ProfileImplIOData::InitializeInternal(
std::unique_ptr<net::CookieStore> cookie_store( std::unique_ptr<net::CookieStore> cookie_store(
content::CreateCookieStore(cookie_config)); content::CreateCookieStore(cookie_config));
if (channel_id_service) { cookie_store->SetChannelIDServiceID(channel_id_service->GetUniqueID());
cookie_store->SetChannelIDServiceID(channel_id_service->GetUniqueID());
}
builder->SetCookieAndChannelIdStores(std::move(cookie_store), builder->SetCookieAndChannelIdStores(std::move(cookie_store),
std::move(channel_id_service)); std::move(channel_id_service));
...@@ -601,20 +600,13 @@ net::URLRequestContext* ProfileImplIOData::InitializeAppRequestContext( ...@@ -601,20 +600,13 @@ net::URLRequestContext* ProfileImplIOData::InitializeAppRequestContext(
channel_id_db = new net::SQLiteChannelIDStore( channel_id_db = new net::SQLiteChannelIDStore(
channel_id_path, cookie_background_task_runner); channel_id_path, cookie_background_task_runner);
} }
std::unique_ptr<net::ChannelIDService> channel_id_service; std::unique_ptr<net::ChannelIDService> channel_id_service(
new net::ChannelIDService(
// If |main_context| has Channel ID disabled, do not enable it for the App's new net::DefaultChannelIDStore(channel_id_db.get())));
// context. cookie_config.channel_id_service = channel_id_service.get();
if (main_context->channel_id_service()) {
channel_id_service.reset(new net::ChannelIDService(
new net::DefaultChannelIDStore(channel_id_db.get())));
cookie_config.channel_id_service = channel_id_service.get();
}
cookie_config.background_task_runner = cookie_background_task_runner; cookie_config.background_task_runner = cookie_background_task_runner;
cookie_store = content::CreateCookieStore(cookie_config); cookie_store = content::CreateCookieStore(cookie_config);
if (channel_id_service) { cookie_store->SetChannelIDServiceID(channel_id_service->GetUniqueID());
cookie_store->SetChannelIDServiceID(channel_id_service->GetUniqueID());
}
// Build a new HttpNetworkSession that uses the new ChannelIDService. // Build a new HttpNetworkSession that uses the new ChannelIDService.
// TODO(mmenke): It's weird to combine state from // TODO(mmenke): It's weird to combine state from
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment