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

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

Issue 382313003: Add data reduction functionality to all platforms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync to head Created 6 years, 3 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 24 matching lines...) Expand all
35 #include "chrome/browser/io_thread.h" 35 #include "chrome/browser/io_thread.h"
36 #include "chrome/browser/media/media_device_id_salt.h" 36 #include "chrome/browser/media/media_device_id_salt.h"
37 #include "chrome/browser/net/about_protocol_handler.h" 37 #include "chrome/browser/net/about_protocol_handler.h"
38 #include "chrome/browser/net/chrome_fraudulent_certificate_reporter.h" 38 #include "chrome/browser/net/chrome_fraudulent_certificate_reporter.h"
39 #include "chrome/browser/net/chrome_http_user_agent_settings.h" 39 #include "chrome/browser/net/chrome_http_user_agent_settings.h"
40 #include "chrome/browser/net/chrome_net_log.h" 40 #include "chrome/browser/net/chrome_net_log.h"
41 #include "chrome/browser/net/chrome_network_delegate.h" 41 #include "chrome/browser/net/chrome_network_delegate.h"
42 #include "chrome/browser/net/chrome_url_request_context_getter.h" 42 #include "chrome/browser/net/chrome_url_request_context_getter.h"
43 #include "chrome/browser/net/cookie_store_util.h" 43 #include "chrome/browser/net/cookie_store_util.h"
44 #include "chrome/browser/net/proxy_service_factory.h" 44 #include "chrome/browser/net/proxy_service_factory.h"
45 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator. h"
45 #include "chrome/browser/profiles/profile.h" 46 #include "chrome/browser/profiles/profile.h"
46 #include "chrome/browser/profiles/profile_manager.h" 47 #include "chrome/browser/profiles/profile_manager.h"
47 #include "chrome/browser/signin/signin_names_io_thread.h" 48 #include "chrome/browser/signin/signin_names_io_thread.h"
48 #include "chrome/common/chrome_paths.h" 49 #include "chrome/common/chrome_paths.h"
49 #include "chrome/common/chrome_switches.h" 50 #include "chrome/common/chrome_switches.h"
50 #include "chrome/common/pref_names.h" 51 #include "chrome/common/pref_names.h"
51 #include "chrome/common/url_constants.h" 52 #include "chrome/common/url_constants.h"
53 #include "components/data_reduction_proxy/browser/data_reduction_proxy_config_se rvice.h"
54 #include "components/data_reduction_proxy/browser/data_reduction_proxy_configura tor.h"
55 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings. h"
56 #include "components/data_reduction_proxy/common/data_reduction_proxy_switches.h "
52 #include "components/dom_distiller/core/url_constants.h" 57 #include "components/dom_distiller/core/url_constants.h"
53 #include "components/startup_metric_utils/startup_metric_utils.h" 58 #include "components/startup_metric_utils/startup_metric_utils.h"
54 #include "components/sync_driver/pref_names.h" 59 #include "components/sync_driver/pref_names.h"
55 #include "components/url_fixer/url_fixer.h" 60 #include "components/url_fixer/url_fixer.h"
56 #include "content/public/browser/browser_thread.h" 61 #include "content/public/browser/browser_thread.h"
57 #include "content/public/browser/host_zoom_map.h" 62 #include "content/public/browser/host_zoom_map.h"
58 #include "content/public/browser/notification_service.h" 63 #include "content/public/browser/notification_service.h"
59 #include "content/public/browser/resource_context.h" 64 #include "content/public/browser/resource_context.h"
60 #include "net/base/keygen_handler.h" 65 #include "net/base/keygen_handler.h"
61 #include "net/cookies/canonical_cookie.h" 66 #include "net/cookies/canonical_cookie.h"
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 846
842 bool ProfileIOData::GetMetricsEnabledStateOnIOThread() const { 847 bool ProfileIOData::GetMetricsEnabledStateOnIOThread() const {
843 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 848 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
844 #if defined(OS_CHROMEOS) 849 #if defined(OS_CHROMEOS)
845 return enable_metrics_; 850 return enable_metrics_;
846 #else 851 #else
847 return enable_metrics_.GetValue(); 852 return enable_metrics_.GetValue();
848 #endif // defined(OS_CHROMEOS) 853 #endif // defined(OS_CHROMEOS)
849 } 854 }
850 855
851 #if defined(OS_ANDROID)
852 bool ProfileIOData::IsDataReductionProxyEnabled() const { 856 bool ProfileIOData::IsDataReductionProxyEnabled() const {
853 #if defined(SPDY_PROXY_AUTH_ORIGIN)
854 return data_reduction_proxy_enabled_.GetValue() || 857 return data_reduction_proxy_enabled_.GetValue() ||
855 CommandLine::ForCurrentProcess()->HasSwitch( 858 CommandLine::ForCurrentProcess()->HasSwitch(
856 data_reduction_proxy::switches::kEnableDataReductionProxy); 859 data_reduction_proxy::switches::kEnableDataReductionProxy);
857 #else
858 return false;
859 #endif // defined(SPDY_PROXY_AUTH_ORIGIN)
860 } 860 }
861 #endif
862 861
863 base::WeakPtr<net::HttpServerProperties> 862 base::WeakPtr<net::HttpServerProperties>
864 ProfileIOData::http_server_properties() const { 863 ProfileIOData::http_server_properties() const {
865 return http_server_properties_->GetWeakPtr(); 864 return http_server_properties_->GetWeakPtr();
866 } 865 }
867 866
868 void ProfileIOData::set_http_server_properties( 867 void ProfileIOData::set_http_server_properties(
869 scoped_ptr<net::HttpServerProperties> http_server_properties) const { 868 scoped_ptr<net::HttpServerProperties> http_server_properties) const {
870 http_server_properties_ = http_server_properties.Pass(); 869 http_server_properties_ = http_server_properties.Pass();
871 } 870 }
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1024 profile_params_->extension_info_map.get()); 1023 profile_params_->extension_info_map.get());
1025 #endif 1024 #endif
1026 #if defined(ENABLE_CONFIGURATION_POLICY) 1025 #if defined(ENABLE_CONFIGURATION_POLICY)
1027 network_delegate->set_url_blacklist_manager(url_blacklist_manager_.get()); 1026 network_delegate->set_url_blacklist_manager(url_blacklist_manager_.get());
1028 #endif 1027 #endif
1029 network_delegate->set_profile(profile_params_->profile); 1028 network_delegate->set_profile(profile_params_->profile);
1030 network_delegate->set_profile_path(profile_params_->path); 1029 network_delegate->set_profile_path(profile_params_->path);
1031 network_delegate->set_cookie_settings(profile_params_->cookie_settings.get()); 1030 network_delegate->set_cookie_settings(profile_params_->cookie_settings.get());
1032 network_delegate->set_enable_do_not_track(&enable_do_not_track_); 1031 network_delegate->set_enable_do_not_track(&enable_do_not_track_);
1033 network_delegate->set_force_google_safe_search(&force_safesearch_); 1032 network_delegate->set_force_google_safe_search(&force_safesearch_);
1034 #if defined(SPDY_PROXY_AUTH_ORIGIN)
1035 network_delegate->set_data_reduction_proxy_enabled_pref( 1033 network_delegate->set_data_reduction_proxy_enabled_pref(
1036 &data_reduction_proxy_enabled_); 1034 &data_reduction_proxy_enabled_);
1037 #endif
1038 network_delegate->set_prerender_tracker(profile_params_->prerender_tracker); 1035 network_delegate->set_prerender_tracker(profile_params_->prerender_tracker);
1039 network_delegate_.reset(network_delegate); 1036 network_delegate_.reset(network_delegate);
1040 1037
1041 fraudulent_certificate_reporter_.reset( 1038 fraudulent_certificate_reporter_.reset(
1042 new chrome_browser_net::ChromeFraudulentCertificateReporter( 1039 new chrome_browser_net::ChromeFraudulentCertificateReporter(
1043 main_request_context_.get())); 1040 main_request_context_.get()));
1044 1041
1045 // NOTE: Proxy service uses the default io thread network delegate, not the 1042 // NOTE: Proxy service uses the default io thread network delegate, not the
1046 // delegate just created. 1043 // delegate just created.
1047 proxy_service_.reset( 1044 proxy_service_.reset(
1048 ProxyServiceFactory::CreateProxyService( 1045 ProxyServiceFactory::CreateProxyService(
1049 io_thread->net_log(), 1046 io_thread->net_log(),
1050 io_thread_globals->proxy_script_fetcher_context.get(), 1047 io_thread_globals->proxy_script_fetcher_context.get(),
1051 io_thread_globals->system_network_delegate.get(), 1048 io_thread_globals->system_network_delegate.get(),
1052 profile_params_->proxy_config_service.release(), 1049 profile_params_->proxy_config_service.release(),
1053 command_line, 1050 command_line,
1054 quick_check_enabled_.GetValue())); 1051 quick_check_enabled_.GetValue()));
1055
1056 transport_security_state_.reset(new net::TransportSecurityState()); 1052 transport_security_state_.reset(new net::TransportSecurityState());
1057 transport_security_persister_.reset( 1053 transport_security_persister_.reset(
1058 new net::TransportSecurityPersister( 1054 new net::TransportSecurityPersister(
1059 transport_security_state_.get(), 1055 transport_security_state_.get(),
1060 profile_params_->path, 1056 profile_params_->path,
1061 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), 1057 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE),
1062 IsOffTheRecord())); 1058 IsOffTheRecord()));
1063 1059
1064 // Take ownership over these parameters. 1060 // Take ownership over these parameters.
1065 cookie_settings_ = profile_params_->cookie_settings; 1061 cookie_settings_ = profile_params_->cookie_settings;
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 google_services_username_pattern_.Destroy(); 1197 google_services_username_pattern_.Destroy();
1202 reverse_autologin_enabled_.Destroy(); 1198 reverse_autologin_enabled_.Destroy();
1203 one_click_signin_rejected_email_list_.Destroy(); 1199 one_click_signin_rejected_email_list_.Destroy();
1204 enable_referrers_.Destroy(); 1200 enable_referrers_.Destroy();
1205 enable_do_not_track_.Destroy(); 1201 enable_do_not_track_.Destroy();
1206 force_safesearch_.Destroy(); 1202 force_safesearch_.Destroy();
1207 #if !defined(OS_CHROMEOS) 1203 #if !defined(OS_CHROMEOS)
1208 enable_metrics_.Destroy(); 1204 enable_metrics_.Destroy();
1209 #endif 1205 #endif
1210 safe_browsing_enabled_.Destroy(); 1206 safe_browsing_enabled_.Destroy();
1211 #if defined(SPDY_PROXY_AUTH_ORIGIN)
1212 data_reduction_proxy_enabled_.Destroy(); 1207 data_reduction_proxy_enabled_.Destroy();
1213 #endif
1214 printing_enabled_.Destroy(); 1208 printing_enabled_.Destroy();
1215 sync_disabled_.Destroy(); 1209 sync_disabled_.Destroy();
1216 signin_allowed_.Destroy(); 1210 signin_allowed_.Destroy();
1217 // TODO(bnc): remove per https://crbug.com/334602. 1211 // TODO(bnc): remove per https://crbug.com/334602.
1218 network_prediction_enabled_.Destroy(); 1212 network_prediction_enabled_.Destroy();
1219 network_prediction_options_.Destroy(); 1213 network_prediction_options_.Destroy();
1220 quick_check_enabled_.Destroy(); 1214 quick_check_enabled_.Destroy();
1221 if (media_device_id_salt_.get()) 1215 if (media_device_id_salt_.get())
1222 media_device_id_salt_->ShutdownOnUIThread(); 1216 media_device_id_salt_->ShutdownOnUIThread();
1223 session_startup_pref_.Destroy(); 1217 session_startup_pref_.Destroy();
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1295 void ProfileIOData::SetCookieSettingsForTesting( 1289 void ProfileIOData::SetCookieSettingsForTesting(
1296 CookieSettings* cookie_settings) { 1290 CookieSettings* cookie_settings) {
1297 DCHECK(!cookie_settings_.get()); 1291 DCHECK(!cookie_settings_.get());
1298 cookie_settings_ = cookie_settings; 1292 cookie_settings_ = cookie_settings;
1299 } 1293 }
1300 1294
1301 void ProfileIOData::set_signin_names_for_testing( 1295 void ProfileIOData::set_signin_names_for_testing(
1302 SigninNamesOnIOThread* signin_names) { 1296 SigninNamesOnIOThread* signin_names) {
1303 signin_names_.reset(signin_names); 1297 signin_names_.reset(signin_names);
1304 } 1298 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698