Commit 9abc0f76 authored by Nick Harper's avatar Nick Harper Committed by Commit Bot

Remove Channel ID from iOS

Bug: 875053, 903642
Change-Id: Iee68cbac625abddff00ef4ec9099c4894af52143
Reviewed-on: https://chromium-review.googlesource.com/c/1405887
Commit-Queue: Nick Harper <nharper@chromium.org>
Reviewed-by: default avatarSylvain Defresne <sdefresne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#625758}
parent 74d8ada0
......@@ -68,6 +68,9 @@ base::FilePath GetCachePath(const base::FilePath& base) {
return base.Append(kIOSChromeCacheDirname);
}
const base::FilePath::CharType kIOSChromeChannelIDFilename[] =
FILE_PATH_LITERAL("Origin Bound Certs");
} // namespace
ChromeBrowserStateImpl::ChromeBrowserStateImpl(
......@@ -109,15 +112,20 @@ ChromeBrowserStateImpl::ChromeBrowserStateImpl(
this);
base::FilePath cookie_path = state_path_.Append(kIOSChromeCookieFilename);
base::FilePath channel_id_path =
state_path_.Append(kIOSChromeChannelIDFilename);
base::FilePath cache_path = GetCachePath(base_cache_path);
int cache_max_size = 0;
// TODO(crbug.com/903642): Remove the following when no longer needed.
base::FilePath channel_id_path =
state_path_.Append(kIOSChromeChannelIDFilename);
base::DeleteFile(channel_id_path, false);
base::DeleteFile(
base::FilePath(channel_id_path.value() + FILE_PATH_LITERAL("-journal")),
false);
// Make sure we initialize the io_data_ after everything else has been
// initialized that we might be reading from the IO thread.
io_data_->Init(cookie_path, channel_id_path, cache_path, cache_max_size,
state_path_);
io_data_->Init(cookie_path, cache_path, cache_max_size, state_path_);
// Listen for bookmark model load, to bootstrap the sync service.
bookmarks::BookmarkModel* model =
......
......@@ -34,7 +34,6 @@ class ChromeBrowserStateImplIOData : public ChromeBrowserStateIOData {
// Init() must be called before ~Handle(). It records most of the
// parameters needed to construct a ChromeURLRequestContextGetter.
void Init(const base::FilePath& cookie_path,
const base::FilePath& channel_id_path,
const base::FilePath& cache_path,
int cache_max_size,
const base::FilePath& profile_path);
......
......@@ -35,12 +35,9 @@
#include "ios/web/public/web_thread.h"
#include "net/base/cache_type.h"
#include "net/cookies/cookie_store.h"
#include "net/extras/sqlite/sqlite_channel_id_store.h"
#include "net/http/http_cache.h"
#include "net/http/http_network_session.h"
#include "net/http/http_server_properties_manager.h"
#include "net/ssl/channel_id_service.h"
#include "net/ssl/default_channel_id_store.h"
#include "net/url_request/url_request_intercepting_job_factory.h"
#include "net/url_request/url_request_job_factory_impl.h"
......@@ -65,7 +62,6 @@ ChromeBrowserStateImplIOData::Handle::~Handle() {
void ChromeBrowserStateImplIOData::Handle::Init(
const base::FilePath& cookie_path,
const base::FilePath& channel_id_path,
const base::FilePath& cache_path,
int cache_max_size,
const base::FilePath& profile_path) {
......@@ -75,7 +71,6 @@ void ChromeBrowserStateImplIOData::Handle::Init(
LazyParams* lazy_params = new LazyParams();
lazy_params->cookie_path = cookie_path;
lazy_params->channel_id_path = channel_id_path;
lazy_params->cache_path = cache_path;
lazy_params->cache_max_size = cache_max_size;
io_data_->lazy_params_.reset(lazy_params);
......@@ -223,8 +218,6 @@ void ChromeBrowserStateImplIOData::InitializeInternal(
main_context->set_proxy_resolution_service(proxy_resolution_service());
net::ChannelIDService* channel_id_service = NULL;
DCHECK(!lazy_params_->cookie_path.empty());
cookie_util::CookieStoreConfig ios_cookie_config(
lazy_params_->cookie_path,
......@@ -244,23 +237,6 @@ void ChromeBrowserStateImplIOData::InitializeInternal(
main_context->set_cookie_store(main_cookie_store_.get());
// Set up server bound cert service.
if (!channel_id_service) {
DCHECK(!lazy_params_->channel_id_path.empty());
scoped_refptr<net::SQLiteChannelIDStore> channel_id_db =
new net::SQLiteChannelIDStore(
lazy_params_->channel_id_path,
base::CreateSequencedTaskRunnerWithTraits(
{base::MayBlock(), base::TaskPriority::BEST_EFFORT}));
channel_id_service = new net::ChannelIDService(
new net::DefaultChannelIDStore(channel_id_db.get()));
}
set_channel_id_service(channel_id_service);
main_context->set_channel_id_service(channel_id_service);
main_cookie_store_->SetChannelIDServiceID(channel_id_service->GetUniqueID());
std::unique_ptr<net::HttpCache::BackendFactory> main_backend(
new net::HttpCache::DefaultBackend(
net::DISK_CACHE, net::CACHE_BACKEND_BLOCKFILE,
......@@ -288,14 +264,9 @@ ChromeBrowserStateImplIOData::InitializeAppRequestContext(
AppRequestContext* context = new AppRequestContext();
context->CopyFrom(main_context);
// Use a separate ChannelIDService.
std::unique_ptr<net::ChannelIDService> channel_id_service(
new net::ChannelIDService(new net::DefaultChannelIDStore(nullptr)));
// Build a new HttpNetworkSession that uses the new ChannelIDService.
// Build a new HttpNetworkSession.
net::HttpNetworkSession::Context session_context =
http_network_session_->context();
session_context.channel_id_service = channel_id_service.get();
std::unique_ptr<net::HttpNetworkSession> http_network_session(
new net::HttpNetworkSession(http_network_session_->params(),
session_context));
......@@ -316,9 +287,8 @@ ChromeBrowserStateImplIOData::InitializeAppRequestContext(
ios_cookie_config, std::make_unique<net::NSHTTPSystemCookieStore>(),
main_context->net_log());
// Transfer ownership of the ChannelIDStore, HttpNetworkSession, cookies, and
// Transfer ownership of the HttpNetworkSession, cookies, and
// cache to AppRequestContext.
context->SetChannelIDService(std::move(channel_id_service));
context->SetHttpNetworkSession(std::move(http_network_session));
context->SetCookieStore(std::move(cookie_store));
context->SetHttpTransactionFactory(std::move(app_http_cache));
......
......@@ -27,13 +27,10 @@
#include "ios/web/public/web_thread.h"
#include "net/cookies/cookie_store.h"
#include "net/disk_cache/disk_cache.h"
#include "net/extras/sqlite/sqlite_channel_id_store.h"
#include "net/ftp/ftp_network_layer.h"
#include "net/http/http_cache.h"
#include "net/http/http_network_session.h"
#include "net/http/http_server_properties_impl.h"
#include "net/ssl/channel_id_service.h"
#include "net/ssl/default_channel_id_store.h"
#include "net/url_request/url_request_job_factory_impl.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
......@@ -80,8 +77,6 @@ OffTheRecordChromeBrowserStateIOData::Handle::Handle(
DCHECK(browser_state);
io_data_->cookie_path_ =
browser_state->GetStatePath().Append(kIOSChromeCookieFilename);
io_data_->channel_id_path_ =
browser_state->GetStatePath().Append(kIOSChromeChannelIDFilename);
}
OffTheRecordChromeBrowserStateIOData::Handle::~Handle() {
......@@ -177,20 +172,6 @@ void OffTheRecordChromeBrowserStateIOData::InitializeInternal(
new net::HttpServerPropertiesImpl()));
main_context->set_http_server_properties(http_server_properties());
// For incognito, we use a non-persistent channel ID store.
scoped_refptr<net::DefaultChannelIDStore::PersistentStore> channel_id_store;
// On iOS, certificates are persisted to the disk in incognito.
DCHECK(!channel_id_path_.empty());
channel_id_store = new net::SQLiteChannelIDStore(
channel_id_path_,
base::CreateSequencedTaskRunnerWithTraits(
{base::MayBlock(), base::TaskPriority::BEST_EFFORT}));
net::ChannelIDService* channel_id_service = new net::ChannelIDService(
new net::DefaultChannelIDStore(channel_id_store.get()));
set_channel_id_service(channel_id_service);
main_context->set_channel_id_service(channel_id_service);
main_cookie_store_ = cookie_util::CreateCookieStore(
cookie_util::CookieStoreConfig(
cookie_path_,
......@@ -198,7 +179,6 @@ void OffTheRecordChromeBrowserStateIOData::InitializeInternal(
cookie_util::CookieStoreConfig::COOKIE_STORE_IOS, nullptr),
std::move(profile_params->system_cookie_store), io_thread->net_log());
main_context->set_cookie_store(main_cookie_store_.get());
main_cookie_store_->SetChannelIDServiceID(channel_id_service->GetUniqueID());
http_network_session_ = CreateHttpNetworkSession(*profile_params);
main_http_factory_ = CreateMainHttpFactory(
......
......@@ -9,8 +9,6 @@ const char kIOSChromeMultiBrowserStatePrefix[] = "Profile ";
const base::FilePath::CharType kIOSChromeCacheDirname[] =
FILE_PATH_LITERAL("Cache");
const base::FilePath::CharType kIOSChromeChannelIDFilename[] =
FILE_PATH_LITERAL("Origin Bound Certs");
const base::FilePath::CharType kIOSChromeCookieFilename[] =
FILE_PATH_LITERAL("Cookies");
const base::FilePath::CharType kIOSChromeCRLSetFilename[] =
......
......@@ -13,7 +13,6 @@ extern const char kIOSChromeInitialBrowserState[];
extern const char kIOSChromeMultiBrowserStatePrefix[];
extern const base::FilePath::CharType kIOSChromeCacheDirname[];
extern const base::FilePath::CharType kIOSChromeChannelIDFilename[];
extern const base::FilePath::CharType kIOSChromeCookieFilename[];
extern const base::FilePath::CharType kIOSChromeCRLSetFilename[];
extern const base::FilePath::CharType
......
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