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

Side by Side Diff: chrome/browser/profiles/profile_impl.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_impl.h" 5 #include "chrome/browser/profiles/profile_impl.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 29 matching lines...) Expand all
40 #include "chrome/browser/download/chrome_download_manager_delegate.h" 40 #include "chrome/browser/download/chrome_download_manager_delegate.h"
41 #include "chrome/browser/download/download_service.h" 41 #include "chrome/browser/download/download_service.h"
42 #include "chrome/browser/download/download_service_factory.h" 42 #include "chrome/browser/download/download_service_factory.h"
43 #include "chrome/browser/history/top_sites.h" 43 #include "chrome/browser/history/top_sites.h"
44 #include "chrome/browser/net/net_pref_observer.h" 44 #include "chrome/browser/net/net_pref_observer.h"
45 #include "chrome/browser/net/predictor.h" 45 #include "chrome/browser/net/predictor.h"
46 #include "chrome/browser/net/pref_proxy_config_tracker.h" 46 #include "chrome/browser/net/pref_proxy_config_tracker.h"
47 #include "chrome/browser/net/proxy_service_factory.h" 47 #include "chrome/browser/net/proxy_service_factory.h"
48 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator. h" 48 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator. h"
49 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" 49 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h"
50 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h"
50 #include "chrome/browser/net/ssl_config_service_manager.h" 51 #include "chrome/browser/net/ssl_config_service_manager.h"
51 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" 52 #include "chrome/browser/plugins/chrome_plugin_service_filter.h"
52 #include "chrome/browser/plugins/plugin_prefs.h" 53 #include "chrome/browser/plugins/plugin_prefs.h"
53 #include "chrome/browser/policy/profile_policy_connector.h" 54 #include "chrome/browser/policy/profile_policy_connector.h"
54 #include "chrome/browser/policy/profile_policy_connector_factory.h" 55 #include "chrome/browser/policy/profile_policy_connector_factory.h"
55 #include "chrome/browser/prefs/browser_prefs.h" 56 #include "chrome/browser/prefs/browser_prefs.h"
56 #include "chrome/browser/prefs/chrome_pref_service_factory.h" 57 #include "chrome/browser/prefs/chrome_pref_service_factory.h"
57 #include "chrome/browser/prefs/pref_service_syncable.h" 58 #include "chrome/browser/prefs/pref_service_syncable.h"
58 #include "chrome/browser/prefs/tracked/tracked_preference_validation_delegate.h" 59 #include "chrome/browser/prefs/tracked/tracked_preference_validation_delegate.h"
59 #include "chrome/browser/prerender/prerender_manager_factory.h" 60 #include "chrome/browser/prerender/prerender_manager_factory.h"
(...skipping 14 matching lines...) Expand all
74 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.h" 75 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.h"
75 #include "chrome/browser/ui/startup/startup_browser_creator.h" 76 #include "chrome/browser/ui/startup/startup_browser_creator.h"
76 #include "chrome/common/chrome_constants.h" 77 #include "chrome/common/chrome_constants.h"
77 #include "chrome/common/chrome_paths_internal.h" 78 #include "chrome/common/chrome_paths_internal.h"
78 #include "chrome/common/chrome_switches.h" 79 #include "chrome/common/chrome_switches.h"
79 #include "chrome/common/chrome_version_info.h" 80 #include "chrome/common/chrome_version_info.h"
80 #include "chrome/common/pref_names.h" 81 #include "chrome/common/pref_names.h"
81 #include "chrome/common/url_constants.h" 82 #include "chrome/common/url_constants.h"
82 #include "chrome/grit/chromium_strings.h" 83 #include "chrome/grit/chromium_strings.h"
83 #include "components/bookmarks/browser/bookmark_model.h" 84 #include "components/bookmarks/browser/bookmark_model.h"
85 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h"
86 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings. h"
84 #include "components/dom_distiller/content/dom_distiller_viewer_source.h" 87 #include "components/dom_distiller/content/dom_distiller_viewer_source.h"
85 #include "components/dom_distiller/core/url_constants.h" 88 #include "components/dom_distiller/core/url_constants.h"
86 #include "components/domain_reliability/monitor.h" 89 #include "components/domain_reliability/monitor.h"
87 #include "components/domain_reliability/service.h" 90 #include "components/domain_reliability/service.h"
88 #include "components/keyed_service/content/browser_context_dependency_manager.h" 91 #include "components/keyed_service/content/browser_context_dependency_manager.h"
89 #include "components/metrics/metrics_service.h" 92 #include "components/metrics/metrics_service.h"
90 #include "components/pref_registry/pref_registry_syncable.h" 93 #include "components/pref_registry/pref_registry_syncable.h"
91 #include "components/startup_metric_utils/startup_metric_utils.h" 94 #include "components/startup_metric_utils/startup_metric_utils.h"
92 #include "components/url_fixer/url_fixer.h" 95 #include "components/url_fixer/url_fixer.h"
93 #include "components/user_prefs/user_prefs.h" 96 #include "components/user_prefs/user_prefs.h"
(...skipping 14 matching lines...) Expand all
108 #include "chrome/browser/media/protected_media_identifier_permission_context_fac tory.h" 111 #include "chrome/browser/media/protected_media_identifier_permission_context_fac tory.h"
109 #endif 112 #endif
110 113
111 #if defined(OS_CHROMEOS) 114 #if defined(OS_CHROMEOS)
112 #include "chrome/browser/chromeos/locale_change_guard.h" 115 #include "chrome/browser/chromeos/locale_change_guard.h"
113 #include "chrome/browser/chromeos/preferences.h" 116 #include "chrome/browser/chromeos/preferences.h"
114 #include "chrome/browser/chromeos/profiles/profile_helper.h" 117 #include "chrome/browser/chromeos/profiles/profile_helper.h"
115 #include "components/user_manager/user_manager.h" 118 #include "components/user_manager/user_manager.h"
116 #endif 119 #endif
117 120
118 #if defined(SPDY_PROXY_AUTH_ORIGIN)
119 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h"
120 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h"
121 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings. h"
122 #endif
123
124 #if defined(ENABLE_CONFIGURATION_POLICY) 121 #if defined(ENABLE_CONFIGURATION_POLICY)
125 #include "chrome/browser/policy/schema_registry_service.h" 122 #include "chrome/browser/policy/schema_registry_service.h"
126 #include "chrome/browser/policy/schema_registry_service_factory.h" 123 #include "chrome/browser/policy/schema_registry_service_factory.h"
127 #include "components/policy/core/browser/browser_policy_connector.h" 124 #include "components/policy/core/browser/browser_policy_connector.h"
128 #if defined(OS_CHROMEOS) 125 #if defined(OS_CHROMEOS)
129 #include "chrome/browser/chromeos/login/login_utils.h" 126 #include "chrome/browser/chromeos/login/login_utils.h"
130 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" 127 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h"
131 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom eos.h" 128 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom eos.h"
132 #else 129 #else
133 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" 130 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h"
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 startup_pref_type == SessionStartupPref::LAST) { 651 startup_pref_type == SessionStartupPref::LAST) {
655 session_cookie_mode = content::CookieStoreConfig::RESTORED_SESSION_COOKIES; 652 session_cookie_mode = content::CookieStoreConfig::RESTORED_SESSION_COOKIES;
656 } 653 }
657 654
658 InitHostZoomMap(); 655 InitHostZoomMap();
659 656
660 base::Callback<void(bool)> data_reduction_proxy_unavailable; 657 base::Callback<void(bool)> data_reduction_proxy_unavailable;
661 scoped_ptr<data_reduction_proxy::DataReductionProxyParams> 658 scoped_ptr<data_reduction_proxy::DataReductionProxyParams>
662 data_reduction_proxy_params; 659 data_reduction_proxy_params;
663 scoped_ptr<DataReductionProxyChromeConfigurator> chrome_configurator; 660 scoped_ptr<DataReductionProxyChromeConfigurator> chrome_configurator;
664 #if defined(SPDY_PROXY_AUTH_ORIGIN)
665 DataReductionProxyChromeSettings* data_reduction_proxy_chrome_settings = 661 DataReductionProxyChromeSettings* data_reduction_proxy_chrome_settings =
666 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(this); 662 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(this);
667 data_reduction_proxy_params = 663 data_reduction_proxy_params =
668 data_reduction_proxy_chrome_settings->params()->Clone(); 664 data_reduction_proxy_chrome_settings->params()->Clone();
669 data_reduction_proxy_unavailable = 665 data_reduction_proxy_unavailable =
670 base::Bind( 666 base::Bind(
671 &data_reduction_proxy::DataReductionProxySettings::SetUnreachable, 667 &data_reduction_proxy::DataReductionProxySettings::SetUnreachable,
672 base::Unretained(data_reduction_proxy_chrome_settings)); 668 base::Unretained(data_reduction_proxy_chrome_settings));
673 // The configurator is used by DataReductionProxyChromeSettings and 669 // The configurator is used by DataReductionProxyChromeSettings and
674 // ProfileIOData. Ownership is passed to the latter via ProfileIOData::Handle, 670 // ProfileIOData. Ownership is passed to the latter via ProfileIOData::Handle,
675 // which is only destroyed after BrowserContextKeyedServices, 671 // which is only destroyed after BrowserContextKeyedServices,
676 // including DataReductionProxyChromeSettings. 672 // including DataReductionProxyChromeSettings.
677 chrome_configurator.reset( 673 chrome_configurator.reset(
678 new DataReductionProxyChromeConfigurator( 674 new DataReductionProxyChromeConfigurator(
679 prefs_.get(), 675 prefs_.get(),
680 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); 676 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)));
681 // Retain a raw pointer to use for initialization of data reduction proxy 677 // Retain a raw pointer to use for initialization of data reduction proxy
682 // settings after ownership is passed. 678 // settings after ownership is passed.
683 DataReductionProxyChromeConfigurator* 679 DataReductionProxyChromeConfigurator*
684 data_reduction_proxy_chrome_configurator = chrome_configurator.get(); 680 data_reduction_proxy_chrome_configurator = chrome_configurator.get();
685 #endif
686 681
687 // Make sure we initialize the ProfileIOData after everything else has been 682 // Make sure we initialize the ProfileIOData after everything else has been
688 // initialized that we might be reading from the IO thread. 683 // initialized that we might be reading from the IO thread.
689 684
690 io_data_.Init(cookie_path, channel_id_path, cache_path, 685 io_data_.Init(cookie_path, channel_id_path, cache_path,
691 cache_max_size, media_cache_path, media_cache_max_size, 686 cache_max_size, media_cache_path, media_cache_max_size,
692 extensions_cookie_path, GetPath(), infinite_cache_path, 687 extensions_cookie_path, GetPath(), infinite_cache_path,
693 predictor_, session_cookie_mode, GetSpecialStoragePolicy(), 688 predictor_, session_cookie_mode, GetSpecialStoragePolicy(),
694 CreateDomainReliabilityMonitor(local_state), 689 CreateDomainReliabilityMonitor(local_state),
695 data_reduction_proxy_unavailable, 690 data_reduction_proxy_unavailable,
696 chrome_configurator.Pass(), 691 chrome_configurator.Pass(),
697 data_reduction_proxy_params.Pass()); 692 data_reduction_proxy_params.Pass());
698
699 #if defined(SPDY_PROXY_AUTH_ORIGIN)
700 data_reduction_proxy_chrome_settings->InitDataReductionProxySettings( 693 data_reduction_proxy_chrome_settings->InitDataReductionProxySettings(
701 data_reduction_proxy_chrome_configurator, 694 data_reduction_proxy_chrome_configurator,
702 prefs_.get(), 695 prefs_.get(),
703 g_browser_process->local_state(), 696 g_browser_process->local_state(),
704 GetRequestContext()); 697 GetRequestContext());
705 #endif
706 698
707 #if defined(ENABLE_PLUGINS) 699 #if defined(ENABLE_PLUGINS)
708 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( 700 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext(
709 PluginPrefs::GetForProfile(this).get(), 701 PluginPrefs::GetForProfile(this).get(),
710 io_data_.GetResourceContextNoInit()); 702 io_data_.GetResourceContextNoInit());
711 #endif 703 #endif
712 704
713 // Delay README creation to not impact startup performance. 705 // Delay README creation to not impact startup performance.
714 BrowserThread::PostDelayedTask( 706 BrowserThread::PostDelayedTask(
715 BrowserThread::FILE, FROM_HERE, 707 BrowserThread::FILE, FROM_HERE,
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after
1452 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> 1444 domain_reliability::DomainReliabilityServiceFactory::GetInstance()->
1453 GetForBrowserContext(this); 1445 GetForBrowserContext(this);
1454 if (!service) 1446 if (!service)
1455 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>(); 1447 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>();
1456 1448
1457 return service->CreateMonitor( 1449 return service->CreateMonitor(
1458 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), 1450 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
1459 local_state, 1451 local_state,
1460 prefs::kMetricsReportingEnabled); 1452 prefs::kMetricsReportingEnabled);
1461 } 1453 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698