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

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

Issue 10264023: Revert 134625 - Transmit a X-Chrome-UMA-Enabled bit to Google domains from clients that have UMA en… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_io_data.h" 5 #include "chrome/browser/profiles/profile_io_data.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 } 153 }
154 154
155 } // namespace 155 } // namespace
156 156
157 void ProfileIOData::InitializeOnUIThread(Profile* profile) { 157 void ProfileIOData::InitializeOnUIThread(Profile* profile) {
158 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 158 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
159 PrefService* pref_service = profile->GetPrefs(); 159 PrefService* pref_service = profile->GetPrefs();
160 160
161 scoped_ptr<ProfileParams> params(new ProfileParams); 161 scoped_ptr<ProfileParams> params(new ProfileParams);
162 params->path = profile->GetPath(); 162 params->path = profile->GetPath();
163 params->is_incognito = profile->IsOffTheRecord();
163 params->clear_local_state_on_exit = 164 params->clear_local_state_on_exit =
164 pref_service->GetBoolean(prefs::kClearSiteDataOnExit); 165 pref_service->GetBoolean(prefs::kClearSiteDataOnExit);
165 166
166 // Set up Accept-Language and Accept-Charset header values 167 // Set up Accept-Language and Accept-Charset header values
167 params->accept_language = net::HttpUtil::GenerateAcceptLanguageHeader( 168 params->accept_language = net::HttpUtil::GenerateAcceptLanguageHeader(
168 pref_service->GetString(prefs::kAcceptLanguages)); 169 pref_service->GetString(prefs::kAcceptLanguages));
169 std::string default_charset = 170 std::string default_charset =
170 pref_service->GetString(prefs::kGlobalDefaultCharset); 171 pref_service->GetString(prefs::kGlobalDefaultCharset);
171 params->accept_charset = 172 params->accept_charset =
172 net::HttpUtil::GenerateAcceptCharsetHeader(default_charset); 173 net::HttpUtil::GenerateAcceptCharsetHeader(default_charset);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 240
240 void ProfileIOData::AppRequestContext::SetHttpTransactionFactory( 241 void ProfileIOData::AppRequestContext::SetHttpTransactionFactory(
241 net::HttpTransactionFactory* http_factory) { 242 net::HttpTransactionFactory* http_factory) {
242 http_factory_.reset(http_factory); 243 http_factory_.reset(http_factory);
243 set_http_transaction_factory(http_factory); 244 set_http_transaction_factory(http_factory);
244 } 245 }
245 246
246 ProfileIOData::AppRequestContext::~AppRequestContext() {} 247 ProfileIOData::AppRequestContext::~AppRequestContext() {}
247 248
248 ProfileIOData::ProfileParams::ProfileParams() 249 ProfileIOData::ProfileParams::ProfileParams()
249 : clear_local_state_on_exit(false), 250 : is_incognito(false),
251 clear_local_state_on_exit(false),
250 io_thread(NULL), 252 io_thread(NULL),
251 #if defined(ENABLE_NOTIFICATIONS) 253 #if defined(ENABLE_NOTIFICATIONS)
252 notification_service(NULL), 254 notification_service(NULL),
253 #endif 255 #endif
254 profile(NULL) { 256 profile(NULL) {
255 } 257 }
256 258
257 ProfileIOData::ProfileParams::~ProfileParams() {} 259 ProfileIOData::ProfileParams::~ProfileParams() {}
258 260
259 ProfileIOData::ProfileIOData(bool is_incognito) 261 ProfileIOData::ProfileIOData(bool is_incognito)
260 : initialized_(false), 262 : initialized_(false),
261 ALLOW_THIS_IN_INITIALIZER_LIST( 263 ALLOW_THIS_IN_INITIALIZER_LIST(
262 resource_context_(new ResourceContext(this))), 264 resource_context_(new ResourceContext(this))),
263 initialized_on_UI_thread_(false), 265 initialized_on_UI_thread_(false) {
264 is_incognito_(is_incognito) {
265 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 266 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
266 } 267 }
267 268
268 ProfileIOData::~ProfileIOData() { 269 ProfileIOData::~ProfileIOData() {
269 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO)) 270 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO))
270 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 271 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
271 272
272 if (main_request_context_) 273 if (main_request_context_)
273 main_request_context_->AssertNoURLRequests(); 274 main_request_context_->AssertNoURLRequests();
274 if (extensions_request_context_) 275 if (extensions_request_context_)
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 io_thread->net_log(), 458 io_thread->net_log(),
458 io_thread_globals->proxy_script_fetcher_context.get(), 459 io_thread_globals->proxy_script_fetcher_context.get(),
459 profile_params_->proxy_config_service.release(), 460 profile_params_->proxy_config_service.release(),
460 command_line)); 461 command_line));
461 462
462 transport_security_state_.reset(new net::TransportSecurityState( 463 transport_security_state_.reset(new net::TransportSecurityState(
463 command_line.GetSwitchValueASCII(switches::kHstsHosts))); 464 command_line.GetSwitchValueASCII(switches::kHstsHosts)));
464 transport_security_persister_.reset( 465 transport_security_persister_.reset(
465 new TransportSecurityPersister(transport_security_state_.get(), 466 new TransportSecurityPersister(transport_security_state_.get(),
466 profile_params_->path, 467 profile_params_->path,
467 is_incognito())); 468 profile_params_->is_incognito));
468 469
469 // NOTE(willchan): Keep these protocol handlers in sync with 470 // NOTE(willchan): Keep these protocol handlers in sync with
470 // ProfileIOData::IsHandledProtocol(). 471 // ProfileIOData::IsHandledProtocol().
471 job_factory_.reset(new net::URLRequestJobFactory); 472 job_factory_.reset(new net::URLRequestJobFactory);
472 if (profile_params_->protocol_handler_registry) { 473 if (profile_params_->protocol_handler_registry) {
473 job_factory_->AddInterceptor( 474 job_factory_->AddInterceptor(
474 new ProtocolHandlerRegistryInterceptor( 475 new ProtocolHandlerRegistryInterceptor(
475 profile_params_->protocol_handler_registry)); 476 profile_params_->protocol_handler_registry));
476 } 477 }
477 bool set_protocol = job_factory_->SetProtocolHandler( 478 bool set_protocol = job_factory_->SetProtocolHandler(
478 chrome::kExtensionScheme, 479 chrome::kExtensionScheme,
479 CreateExtensionProtocolHandler(is_incognito(), 480 CreateExtensionProtocolHandler(profile_params_->is_incognito,
480 profile_params_->extension_info_map)); 481 profile_params_->extension_info_map));
481 DCHECK(set_protocol); 482 DCHECK(set_protocol);
482 set_protocol = job_factory_->SetProtocolHandler( 483 set_protocol = job_factory_->SetProtocolHandler(
483 chrome::kChromeUIScheme, 484 chrome::kChromeUIScheme,
484 ChromeURLDataManagerBackend::CreateProtocolHandler( 485 ChromeURLDataManagerBackend::CreateProtocolHandler(
485 chrome_url_data_manager_backend_.get())); 486 chrome_url_data_manager_backend_.get()));
486 DCHECK(set_protocol); 487 DCHECK(set_protocol);
487 set_protocol = job_factory_->SetProtocolHandler( 488 set_protocol = job_factory_->SetProtocolHandler(
488 chrome::kChromeDevToolsScheme, 489 chrome::kChromeDevToolsScheme,
489 CreateDevToolsProtocolHandler(chrome_url_data_manager_backend_.get())); 490 CreateDevToolsProtocolHandler(chrome_url_data_manager_backend_.get()));
(...skipping 17 matching lines...) Expand all
507 resource_context_->request_context_ = main_request_context_; 508 resource_context_->request_context_ = main_request_context_;
508 509
509 LazyInitializeInternal(profile_params_.get()); 510 LazyInitializeInternal(profile_params_.get());
510 511
511 profile_params_.reset(); 512 profile_params_.reset();
512 initialized_ = true; 513 initialized_ = true;
513 } 514 }
514 515
515 void ProfileIOData::ApplyProfileParamsToContext( 516 void ProfileIOData::ApplyProfileParamsToContext(
516 ChromeURLRequestContext* context) const { 517 ChromeURLRequestContext* context) const {
517 context->set_is_incognito(is_incognito()); 518 context->set_is_incognito(profile_params_->is_incognito);
518 context->set_accept_language(profile_params_->accept_language); 519 context->set_accept_language(profile_params_->accept_language);
519 context->set_accept_charset(profile_params_->accept_charset); 520 context->set_accept_charset(profile_params_->accept_charset);
520 context->set_referrer_charset(profile_params_->referrer_charset); 521 context->set_referrer_charset(profile_params_->referrer_charset);
521 context->set_ssl_config_service(profile_params_->ssl_config_service); 522 context->set_ssl_config_service(profile_params_->ssl_config_service);
522 } 523 }
523 524
524 void ProfileIOData::ShutdownOnUIThread() { 525 void ProfileIOData::ShutdownOnUIThread() {
525 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 526 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
526 enable_referrers_.Destroy(); 527 enable_referrers_.Destroy();
527 enable_metrics_.Destroy();
528 clear_local_state_on_exit_.Destroy(); 528 clear_local_state_on_exit_.Destroy();
529 safe_browsing_enabled_.Destroy(); 529 safe_browsing_enabled_.Destroy();
530 session_startup_pref_.Destroy(); 530 session_startup_pref_.Destroy();
531 #if defined(ENABLE_CONFIGURATION_POLICY) 531 #if defined(ENABLE_CONFIGURATION_POLICY)
532 if (url_blacklist_manager_.get()) 532 if (url_blacklist_manager_.get())
533 url_blacklist_manager_->ShutdownOnUIThread(); 533 url_blacklist_manager_->ShutdownOnUIThread();
534 #endif 534 #endif
535 bool posted = BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this); 535 bool posted = BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this);
536 if (!posted) 536 if (!posted)
537 delete this; 537 delete this;
538 } 538 }
539 539
540 void ProfileIOData::set_server_bound_cert_service( 540 void ProfileIOData::set_server_bound_cert_service(
541 net::ServerBoundCertService* server_bound_cert_service) const { 541 net::ServerBoundCertService* server_bound_cert_service) const {
542 server_bound_cert_service_.reset(server_bound_cert_service); 542 server_bound_cert_service_.reset(server_bound_cert_service);
543 } 543 }
544 544
545 void ProfileIOData::DestroyResourceContext() { 545 void ProfileIOData::DestroyResourceContext() {
546 resource_context_.reset(); 546 resource_context_.reset();
547 } 547 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_io_data.h ('k') | chrome/browser/protector/protector_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698