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

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

Issue 412143009: Moved data reduction proxy initialization logic to ProfileImplIOData (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments from willchan and sgurun Created 6 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
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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 #include "net/ssl/client_cert_store_win.h" 132 #include "net/ssl/client_cert_store_win.h"
133 #endif 133 #endif
134 134
135 #if defined(OS_MACOSX) 135 #if defined(OS_MACOSX)
136 #include "net/ssl/client_cert_store_mac.h" 136 #include "net/ssl/client_cert_store_mac.h"
137 #endif 137 #endif
138 138
139 using content::BrowserContext; 139 using content::BrowserContext;
140 using content::BrowserThread; 140 using content::BrowserThread;
141 using content::ResourceContext; 141 using content::ResourceContext;
142 using data_reduction_proxy::DataReductionProxyUsageStats;
143 142
144 namespace { 143 namespace {
145 144
146 #if defined(DEBUG_DEVTOOLS) 145 #if defined(DEBUG_DEVTOOLS)
147 bool IsSupportedDevToolsURL(const GURL& url, base::FilePath* path) { 146 bool IsSupportedDevToolsURL(const GURL& url, base::FilePath* path) {
148 std::string bundled_path_prefix(chrome::kChromeUIDevToolsBundledPath); 147 std::string bundled_path_prefix(chrome::kChromeUIDevToolsBundledPath);
149 bundled_path_prefix = "/" + bundled_path_prefix + "/"; 148 bundled_path_prefix = "/" + bundled_path_prefix + "/";
150 149
151 if (!url.SchemeIs(content::kChromeDevToolsScheme) || 150 if (!url.SchemeIs(content::kChromeDevToolsScheme) ||
152 url.host() != chrome::kChromeUIDevToolsHost || 151 url.host() != chrome::kChromeUIDevToolsHost ||
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 } 484 }
486 } 485 }
487 #endif 486 #endif
488 487
489 incognito_availibility_pref_.Init( 488 incognito_availibility_pref_.Init(
490 prefs::kIncognitoModeAvailability, pref_service); 489 prefs::kIncognitoModeAvailability, pref_service);
491 incognito_availibility_pref_.MoveToThread(io_message_loop_proxy); 490 incognito_availibility_pref_.MoveToThread(io_message_loop_proxy);
492 491
493 initialized_on_UI_thread_ = true; 492 initialized_on_UI_thread_ = true;
494 493
495 #if defined(OS_ANDROID)
496 #if defined(SPDY_PROXY_AUTH_ORIGIN)
497 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
498 base::Bind(&ProfileIOData::SetDataReductionProxyUsageStatsOnIOThread,
499 base::Unretained(this), g_browser_process->io_thread(), profile));
500 #endif
501 #endif
502
503 // We need to make sure that content initializes its own data structures that 494 // We need to make sure that content initializes its own data structures that
504 // are associated with each ResourceContext because we might post this 495 // are associated with each ResourceContext because we might post this
505 // object to the IO thread after this function. 496 // object to the IO thread after this function.
506 BrowserContext::EnsureResourceContextInitialized(profile); 497 BrowserContext::EnsureResourceContextInitialized(profile);
507 } 498 }
508 499
509 #if defined(OS_ANDROID)
510 #if defined(SPDY_PROXY_AUTH_ORIGIN)
511 void ProfileIOData::SetDataReductionProxyUsageStatsOnIOThread(
512 IOThread* io_thread, Profile* profile) {
513 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
514 IOThread::Globals* globals = io_thread->globals();
515 DataReductionProxyUsageStats* usage_stats =
516 globals->data_reduction_proxy_usage_stats.get();
517 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
518 base::Bind(&ProfileIOData::SetDataReductionProxyUsageStatsOnUIThread,
519 base::Unretained(this), profile, usage_stats));
520 }
521
522 void ProfileIOData::SetDataReductionProxyUsageStatsOnUIThread(
523 Profile* profile,
524 DataReductionProxyUsageStats* usage_stats) {
525 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
526 if (g_browser_process->profile_manager()->IsValidProfile(profile)) {
527 DataReductionProxyChromeSettings* data_reduction_proxy_chrome_settings =
528 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(profile);
529 if (data_reduction_proxy_chrome_settings) {
530 data_reduction_proxy_chrome_settings->SetDataReductionProxyUsageStats(
531 usage_stats);
532 }
533 }
534 }
535 #endif
536 #endif
537
538 ProfileIOData::MediaRequestContext::MediaRequestContext() { 500 ProfileIOData::MediaRequestContext::MediaRequestContext() {
539 } 501 }
540 502
541 void ProfileIOData::MediaRequestContext::SetHttpTransactionFactory( 503 void ProfileIOData::MediaRequestContext::SetHttpTransactionFactory(
542 scoped_ptr<net::HttpTransactionFactory> http_factory) { 504 scoped_ptr<net::HttpTransactionFactory> http_factory) {
543 http_factory_ = http_factory.Pass(); 505 http_factory_ = http_factory.Pass();
544 set_http_transaction_factory(http_factory_.get()); 506 set_http_transaction_factory(http_factory_.get());
545 } 507 }
546 508
547 ProfileIOData::MediaRequestContext::~MediaRequestContext() { 509 ProfileIOData::MediaRequestContext::~MediaRequestContext() {
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 extensions_request_context_.reset(new ChromeURLRequestContext()); 976 extensions_request_context_.reset(new ChromeURLRequestContext());
1015 977
1016 ChromeNetworkDelegate* network_delegate = 978 ChromeNetworkDelegate* network_delegate =
1017 new ChromeNetworkDelegate( 979 new ChromeNetworkDelegate(
1018 #if defined(ENABLE_EXTENSIONS) 980 #if defined(ENABLE_EXTENSIONS)
1019 io_thread_globals->extension_event_router_forwarder.get(), 981 io_thread_globals->extension_event_router_forwarder.get(),
1020 #else 982 #else
1021 NULL, 983 NULL,
1022 #endif 984 #endif
1023 &enable_referrers_); 985 &enable_referrers_);
1024 network_delegate->set_data_reduction_proxy_params(
1025 io_thread_globals->data_reduction_proxy_params.get());
1026 network_delegate->set_data_reduction_proxy_usage_stats(
1027 io_thread_globals->data_reduction_proxy_usage_stats.get());
1028 network_delegate->set_data_reduction_proxy_auth_request_handler(
1029 io_thread_globals->data_reduction_proxy_auth_request_handler.get());
1030 network_delegate->set_on_resolve_proxy_handler(
1031 io_thread_globals->on_resolve_proxy_handler);
1032 if (command_line.HasSwitch(switches::kEnableClientHints)) 986 if (command_line.HasSwitch(switches::kEnableClientHints))
1033 network_delegate->SetEnableClientHints(); 987 network_delegate->SetEnableClientHints();
1034 #if defined(ENABLE_EXTENSIONS) 988 #if defined(ENABLE_EXTENSIONS)
1035 network_delegate->set_extension_info_map( 989 network_delegate->set_extension_info_map(
1036 profile_params_->extension_info_map.get()); 990 profile_params_->extension_info_map.get());
1037 #endif 991 #endif
1038 #if defined(ENABLE_CONFIGURATION_POLICY) 992 #if defined(ENABLE_CONFIGURATION_POLICY)
1039 network_delegate->set_url_blacklist_manager(url_blacklist_manager_.get()); 993 network_delegate->set_url_blacklist_manager(url_blacklist_manager_.get());
1040 #endif 994 #endif
1041 network_delegate->set_profile(profile_params_->profile); 995 network_delegate->set_profile(profile_params_->profile);
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
1292 void ProfileIOData::SetCookieSettingsForTesting( 1246 void ProfileIOData::SetCookieSettingsForTesting(
1293 CookieSettings* cookie_settings) { 1247 CookieSettings* cookie_settings) {
1294 DCHECK(!cookie_settings_.get()); 1248 DCHECK(!cookie_settings_.get());
1295 cookie_settings_ = cookie_settings; 1249 cookie_settings_ = cookie_settings;
1296 } 1250 }
1297 1251
1298 void ProfileIOData::set_signin_names_for_testing( 1252 void ProfileIOData::set_signin_names_for_testing(
1299 SigninNamesOnIOThread* signin_names) { 1253 SigninNamesOnIOThread* signin_names) {
1300 signin_names_.reset(signin_names); 1254 signin_names_.reset(signin_names);
1301 } 1255 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698