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

Side by Side Diff: chrome/browser/profiles/profile_impl_io_data.cc

Issue 7493025: Instantiate OriginBoundCertService in relevant places and do plumbing to pass it down to HttpNetw... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/profiles/profile_impl_io_data.h" 5 #include "chrome/browser/profiles/profile_impl_io_data.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/stl_util.h" 11 #include "base/stl_util.h"
12 #include "chrome/browser/io_thread.h" 12 #include "chrome/browser/io_thread.h"
13 #include "chrome/browser/net/chrome_net_log.h" 13 #include "chrome/browser/net/chrome_net_log.h"
14 #include "chrome/browser/net/chrome_network_delegate.h" 14 #include "chrome/browser/net/chrome_network_delegate.h"
15 #include "chrome/browser/net/sqlite_origin_bound_cert_store.h"
15 #include "chrome/browser/net/sqlite_persistent_cookie_store.h" 16 #include "chrome/browser/net/sqlite_persistent_cookie_store.h"
16 #include "chrome/browser/prefs/pref_member.h" 17 #include "chrome/browser/prefs/pref_member.h"
17 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/common/chrome_constants.h" 19 #include "chrome/common/chrome_constants.h"
19 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
20 #include "chrome/common/pref_names.h" 21 #include "chrome/common/pref_names.h"
21 #include "chrome/common/url_constants.h" 22 #include "chrome/common/url_constants.h"
22 #include "content/browser/browser_thread.h" 23 #include "content/browser/browser_thread.h"
23 #include "content/browser/resource_context.h" 24 #include "content/browser/resource_context.h"
25 #include "net/base/origin_bound_cert_service.h"
24 #include "net/ftp/ftp_network_layer.h" 26 #include "net/ftp/ftp_network_layer.h"
25 #include "net/http/http_cache.h" 27 #include "net/http/http_cache.h"
26 28
27 ProfileImplIOData::Handle::Handle(Profile* profile) 29 ProfileImplIOData::Handle::Handle(Profile* profile)
28 : io_data_(new ProfileImplIOData), 30 : io_data_(new ProfileImplIOData),
29 profile_(profile), 31 profile_(profile),
30 initialized_(false) { 32 initialized_(false) {
31 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 33 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
32 DCHECK(profile); 34 DCHECK(profile);
33 } 35 }
(...skipping 11 matching lines...) Expand all
45 for (ChromeURLRequestContextGetterMap::iterator iter = 47 for (ChromeURLRequestContextGetterMap::iterator iter =
46 app_request_context_getter_map_.begin(); 48 app_request_context_getter_map_.begin();
47 iter != app_request_context_getter_map_.end(); 49 iter != app_request_context_getter_map_.end();
48 ++iter) { 50 ++iter) {
49 iter->second->CleanupOnUIThread(); 51 iter->second->CleanupOnUIThread();
50 } 52 }
51 53
52 io_data_.release()->ShutdownOnUIThread(); 54 io_data_.release()->ShutdownOnUIThread();
53 } 55 }
54 56
55 void ProfileImplIOData::Handle::Init(const FilePath& cookie_path, 57 void ProfileImplIOData::Handle::Init(
56 const FilePath& cache_path, 58 const FilePath& cookie_path,
57 int cache_max_size, 59 const FilePath& origin_bound_cert_path,
58 const FilePath& media_cache_path, 60 const FilePath& cache_path,
59 int media_cache_max_size, 61 int cache_max_size,
60 const FilePath& extensions_cookie_path, 62 const FilePath& media_cache_path,
61 const FilePath& app_path) { 63 int media_cache_max_size,
64 const FilePath& extensions_cookie_path,
65 const FilePath& extensions_origin_bound_cert_path,
66 const FilePath& app_path) {
62 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 67 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
63 DCHECK(!io_data_->lazy_params_.get()); 68 DCHECK(!io_data_->lazy_params_.get());
64 LazyParams* lazy_params = new LazyParams; 69 LazyParams* lazy_params = new LazyParams;
65 70
66 lazy_params->cookie_path = cookie_path; 71 lazy_params->cookie_path = cookie_path;
72 lazy_params->origin_bound_cert_path = origin_bound_cert_path;
67 lazy_params->cache_path = cache_path; 73 lazy_params->cache_path = cache_path;
68 lazy_params->cache_max_size = cache_max_size; 74 lazy_params->cache_max_size = cache_max_size;
69 lazy_params->media_cache_path = media_cache_path; 75 lazy_params->media_cache_path = media_cache_path;
70 lazy_params->media_cache_max_size = media_cache_max_size; 76 lazy_params->media_cache_max_size = media_cache_max_size;
71 lazy_params->extensions_cookie_path = extensions_cookie_path; 77 lazy_params->extensions_cookie_path = extensions_cookie_path;
78 lazy_params->extensions_origin_bound_cert_path =
79 extensions_origin_bound_cert_path;
72 80
73 io_data_->lazy_params_.reset(lazy_params); 81 io_data_->lazy_params_.reset(lazy_params);
74 82
75 // Keep track of isolated app path separately so we can use it on demand. 83 // Keep track of isolated app path separately so we can use it on demand.
76 io_data_->app_path_ = app_path; 84 io_data_->app_path_ = app_path;
77 } 85 }
78 86
79 base::Callback<ChromeURLDataManagerBackend*(void)> 87 base::Callback<ChromeURLDataManagerBackend*(void)>
80 ProfileImplIOData::Handle::GetChromeURLDataManagerBackendGetter() const { 88 ProfileImplIOData::Handle::GetChromeURLDataManagerBackendGetter() const {
81 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 89 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 io_thread_globals->http_auth_handler_factory.get()); 231 io_thread_globals->http_auth_handler_factory.get());
224 media_request_context_->set_http_auth_handler_factory( 232 media_request_context_->set_http_auth_handler_factory(
225 io_thread_globals->http_auth_handler_factory.get()); 233 io_thread_globals->http_auth_handler_factory.get());
226 234
227 main_context->set_dns_cert_checker(dns_cert_checker()); 235 main_context->set_dns_cert_checker(dns_cert_checker());
228 media_request_context_->set_dns_cert_checker(dns_cert_checker()); 236 media_request_context_->set_dns_cert_checker(dns_cert_checker());
229 237
230 main_context->set_proxy_service(proxy_service()); 238 main_context->set_proxy_service(proxy_service());
231 media_request_context_->set_proxy_service(proxy_service()); 239 media_request_context_->set_proxy_service(proxy_service());
232 240
241 // BEGIN(rkn)
wtc 2011/08/01 18:21:24 Remove the "BEGIN(rkn)" and "END(rkn)" comments.
242 scoped_refptr<net::OriginBoundCertService> origin_bound_cert_service = NULL;
243 if (record_mode || playback_mode) {
244 // Don't use existing cookies and use an in-memory store.
245 origin_bound_cert_service= new net::OriginBoundCertService(
246 new net::DefaultOriginBoundCertStore(NULL));
247 }
248
249 // Setup origin bound cert service.
250 if (!origin_bound_cert_service) {
251 DCHECK(!lazy_params_->origin_bound_cert_path.empty());
252
253 scoped_refptr<SQLiteOriginBoundCertStore> origin_bound_cert_db =
254 new SQLiteOriginBoundCertStore(lazy_params_->origin_bound_cert_path);
255 origin_bound_cert_db->SetClearLocalStateOnExit(
256 profile_params->clear_local_state_on_exit);
257 origin_bound_cert_service =
258 new net::OriginBoundCertService(
259 new net::DefaultOriginBoundCertStore(origin_bound_cert_db.get()));
260 }
261
262 net::OriginBoundCertService* extensions_origin_bound_cert_service =
wtc 2011/08/01 18:21:24 Store this in a scoped_refptr. As a general rule,
263 new net::OriginBoundCertService(
264 new net::DefaultOriginBoundCertStore(
265 new SQLiteOriginBoundCertStore(
266 lazy_params_->extensions_origin_bound_cert_path)));
267
268 main_context->set_origin_bound_cert_service(origin_bound_cert_service);
269 media_request_context_->set_origin_bound_cert_service(
270 origin_bound_cert_service);
271 extensions_context->set_origin_bound_cert_service(
272 extensions_origin_bound_cert_service);
273 // END(rkn)
wtc 2011/08/01 18:21:24 Is it OK to put this code next to the code that se
274
233 net::HttpCache::DefaultBackend* main_backend = 275 net::HttpCache::DefaultBackend* main_backend =
234 new net::HttpCache::DefaultBackend( 276 new net::HttpCache::DefaultBackend(
235 net::DISK_CACHE, 277 net::DISK_CACHE,
236 lazy_params_->cache_path, 278 lazy_params_->cache_path,
237 lazy_params_->cache_max_size, 279 lazy_params_->cache_max_size,
238 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)); 280 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE));
239 net::HttpCache* main_cache = new net::HttpCache( 281 net::HttpCache* main_cache = new net::HttpCache(
240 main_context->host_resolver(), 282 main_context->host_resolver(),
241 main_context->cert_verifier(), 283 main_context->cert_verifier(),
284 main_context->origin_bound_cert_service(),
242 main_context->dnsrr_resolver(), 285 main_context->dnsrr_resolver(),
243 main_context->dns_cert_checker(), 286 main_context->dns_cert_checker(),
244 main_context->proxy_service(), 287 main_context->proxy_service(),
245 main_context->ssl_config_service(), 288 main_context->ssl_config_service(),
246 main_context->http_auth_handler_factory(), 289 main_context->http_auth_handler_factory(),
247 main_context->network_delegate(), 290 main_context->network_delegate(),
248 main_context->net_log(), 291 main_context->net_log(),
249 main_backend); 292 main_backend);
250 293
251 net::HttpCache::DefaultBackend* media_backend = 294 net::HttpCache::DefaultBackend* media_backend =
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 scoped_refptr<ProfileIOData::RequestContext> 428 scoped_refptr<ProfileIOData::RequestContext>
386 ProfileImplIOData::AcquireIsolatedAppRequestContext( 429 ProfileImplIOData::AcquireIsolatedAppRequestContext(
387 scoped_refptr<ChromeURLRequestContext> main_context, 430 scoped_refptr<ChromeURLRequestContext> main_context,
388 const std::string& app_id) const { 431 const std::string& app_id) const {
389 // We create per-app contexts on demand, unlike the others above. 432 // We create per-app contexts on demand, unlike the others above.
390 scoped_refptr<RequestContext> app_request_context = 433 scoped_refptr<RequestContext> app_request_context =
391 InitializeAppRequestContext(main_context, app_id); 434 InitializeAppRequestContext(main_context, app_id);
392 DCHECK(app_request_context); 435 DCHECK(app_request_context);
393 return app_request_context; 436 return app_request_context;
394 } 437 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698