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

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"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/debug/trace_event.h" 13 #include "base/debug/trace_event.h"
14 #include "base/environment.h" 14 #include "base/environment.h"
15 #include "base/files/file_path.h" 15 #include "base/files/file_path.h"
16 #include "base/files/file_util.h" 16 #include "base/files/file_util.h"
17 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
18 #include "base/path_service.h" 18 #include "base/path_service.h"
19 #include "base/prefs/json_pref_store.h" 19 #include "base/prefs/json_pref_store.h"
20 #include "base/prefs/scoped_user_pref_update.h" 20 #include "base/prefs/scoped_user_pref_update.h"
21 #include "base/strings/string_number_conversions.h" 21 #include "base/strings/string_number_conversions.h"
22 #include "base/strings/string_util.h" 22 #include "base/strings/string_util.h"
23 #include "base/strings/stringprintf.h" 23 #include "base/strings/stringprintf.h"
24 #include "base/strings/utf_string_conversions.h" 24 #include "base/strings/utf_string_conversions.h"
25 #include "base/synchronization/waitable_event.h" 25 #include "base/synchronization/waitable_event.h"
26 #include "base/threading/sequenced_worker_pool.h" 26 #include "base/threading/sequenced_worker_pool.h"
27 #include "base/version.h" 27 #include "base/version.h"
28
Alexei Svitkine (slow) 2014/08/27 20:18:47 Nit: Remove empty line.
Not at Google. Contact bengr 2014/08/28 18:59:28 Done.
28 #include "chrome/browser/autocomplete/autocomplete_classifier.h" 29 #include "chrome/browser/autocomplete/autocomplete_classifier.h"
29 #include "chrome/browser/autocomplete/shortcuts_backend.h" 30 #include "chrome/browser/autocomplete/shortcuts_backend.h"
30 #include "chrome/browser/background/background_contents_service_factory.h" 31 #include "chrome/browser/background/background_contents_service_factory.h"
31 #include "chrome/browser/background/background_mode_manager.h" 32 #include "chrome/browser/background/background_mode_manager.h"
32 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 33 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
33 #include "chrome/browser/browser_process.h" 34 #include "chrome/browser/browser_process.h"
34 #include "chrome/browser/chrome_notification_types.h" 35 #include "chrome/browser/chrome_notification_types.h"
35 #include "chrome/browser/content_settings/cookie_settings.h" 36 #include "chrome/browser/content_settings/cookie_settings.h"
36 #include "chrome/browser/content_settings/host_content_settings_map.h" 37 #include "chrome/browser/content_settings/host_content_settings_map.h"
37 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" 38 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h"
38 #include "chrome/browser/dom_distiller/lazy_dom_distiller_service.h" 39 #include "chrome/browser/dom_distiller/lazy_dom_distiller_service.h"
39 #include "chrome/browser/domain_reliability/service_factory.h" 40 #include "chrome/browser/domain_reliability/service_factory.h"
40 #include "chrome/browser/download/chrome_download_manager_delegate.h" 41 #include "chrome/browser/download/chrome_download_manager_delegate.h"
41 #include "chrome/browser/download/download_service.h" 42 #include "chrome/browser/download/download_service.h"
42 #include "chrome/browser/download/download_service_factory.h" 43 #include "chrome/browser/download/download_service_factory.h"
43 #include "chrome/browser/history/top_sites.h" 44 #include "chrome/browser/history/top_sites.h"
44 #include "chrome/browser/net/net_pref_observer.h" 45 #include "chrome/browser/net/net_pref_observer.h"
45 #include "chrome/browser/net/predictor.h" 46 #include "chrome/browser/net/predictor.h"
46 #include "chrome/browser/net/pref_proxy_config_tracker.h" 47 #include "chrome/browser/net/pref_proxy_config_tracker.h"
47 #include "chrome/browser/net/proxy_service_factory.h" 48 #include "chrome/browser/net/proxy_service_factory.h"
48 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator. h" 49 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator. h"
49 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" 50 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h"
51 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h"
50 #include "chrome/browser/net/ssl_config_service_manager.h" 52 #include "chrome/browser/net/ssl_config_service_manager.h"
51 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" 53 #include "chrome/browser/plugins/chrome_plugin_service_filter.h"
52 #include "chrome/browser/plugins/plugin_prefs.h" 54 #include "chrome/browser/plugins/plugin_prefs.h"
53 #include "chrome/browser/policy/profile_policy_connector.h" 55 #include "chrome/browser/policy/profile_policy_connector.h"
54 #include "chrome/browser/policy/profile_policy_connector_factory.h" 56 #include "chrome/browser/policy/profile_policy_connector_factory.h"
55 #include "chrome/browser/prefs/browser_prefs.h" 57 #include "chrome/browser/prefs/browser_prefs.h"
56 #include "chrome/browser/prefs/chrome_pref_service_factory.h" 58 #include "chrome/browser/prefs/chrome_pref_service_factory.h"
57 #include "chrome/browser/prefs/pref_service_syncable.h" 59 #include "chrome/browser/prefs/pref_service_syncable.h"
58 #include "chrome/browser/prefs/tracked/tracked_preference_validation_delegate.h" 60 #include "chrome/browser/prefs/tracked/tracked_preference_validation_delegate.h"
59 #include "chrome/browser/prerender/prerender_manager_factory.h" 61 #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" 76 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.h"
75 #include "chrome/browser/ui/startup/startup_browser_creator.h" 77 #include "chrome/browser/ui/startup/startup_browser_creator.h"
76 #include "chrome/common/chrome_constants.h" 78 #include "chrome/common/chrome_constants.h"
77 #include "chrome/common/chrome_paths_internal.h" 79 #include "chrome/common/chrome_paths_internal.h"
78 #include "chrome/common/chrome_switches.h" 80 #include "chrome/common/chrome_switches.h"
79 #include "chrome/common/chrome_version_info.h" 81 #include "chrome/common/chrome_version_info.h"
80 #include "chrome/common/pref_names.h" 82 #include "chrome/common/pref_names.h"
81 #include "chrome/common/url_constants.h" 83 #include "chrome/common/url_constants.h"
82 #include "chrome/grit/chromium_strings.h" 84 #include "chrome/grit/chromium_strings.h"
83 #include "components/bookmarks/browser/bookmark_model.h" 85 #include "components/bookmarks/browser/bookmark_model.h"
86 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h"
87 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings. h"
84 #include "components/dom_distiller/content/dom_distiller_viewer_source.h" 88 #include "components/dom_distiller/content/dom_distiller_viewer_source.h"
85 #include "components/dom_distiller/core/url_constants.h" 89 #include "components/dom_distiller/core/url_constants.h"
86 #include "components/domain_reliability/monitor.h" 90 #include "components/domain_reliability/monitor.h"
87 #include "components/domain_reliability/service.h" 91 #include "components/domain_reliability/service.h"
88 #include "components/keyed_service/content/browser_context_dependency_manager.h" 92 #include "components/keyed_service/content/browser_context_dependency_manager.h"
89 #include "components/metrics/metrics_service.h" 93 #include "components/metrics/metrics_service.h"
90 #include "components/pref_registry/pref_registry_syncable.h" 94 #include "components/pref_registry/pref_registry_syncable.h"
91 #include "components/startup_metric_utils/startup_metric_utils.h" 95 #include "components/startup_metric_utils/startup_metric_utils.h"
92 #include "components/url_fixer/url_fixer.h" 96 #include "components/url_fixer/url_fixer.h"
93 #include "components/user_prefs/user_prefs.h" 97 #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" 112 #include "chrome/browser/media/protected_media_identifier_permission_context_fac tory.h"
109 #endif 113 #endif
110 114
111 #if defined(OS_CHROMEOS) 115 #if defined(OS_CHROMEOS)
112 #include "chrome/browser/chromeos/locale_change_guard.h" 116 #include "chrome/browser/chromeos/locale_change_guard.h"
113 #include "chrome/browser/chromeos/preferences.h" 117 #include "chrome/browser/chromeos/preferences.h"
114 #include "chrome/browser/chromeos/profiles/profile_helper.h" 118 #include "chrome/browser/chromeos/profiles/profile_helper.h"
115 #include "components/user_manager/user_manager.h" 119 #include "components/user_manager/user_manager.h"
116 #endif 120 #endif
117 121
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) 122 #if defined(ENABLE_CONFIGURATION_POLICY)
125 #include "chrome/browser/policy/schema_registry_service.h" 123 #include "chrome/browser/policy/schema_registry_service.h"
126 #include "chrome/browser/policy/schema_registry_service_factory.h" 124 #include "chrome/browser/policy/schema_registry_service_factory.h"
127 #include "components/policy/core/browser/browser_policy_connector.h" 125 #include "components/policy/core/browser/browser_policy_connector.h"
128 #if defined(OS_CHROMEOS) 126 #if defined(OS_CHROMEOS)
129 #include "chrome/browser/chromeos/login/login_utils.h" 127 #include "chrome/browser/chromeos/login/login_utils.h"
130 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" 128 #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" 129 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom eos.h"
132 #else 130 #else
133 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" 131 #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) { 652 startup_pref_type == SessionStartupPref::LAST) {
655 session_cookie_mode = content::CookieStoreConfig::RESTORED_SESSION_COOKIES; 653 session_cookie_mode = content::CookieStoreConfig::RESTORED_SESSION_COOKIES;
656 } 654 }
657 655
658 InitHostZoomMap(); 656 InitHostZoomMap();
659 657
660 base::Callback<void(bool)> data_reduction_proxy_unavailable; 658 base::Callback<void(bool)> data_reduction_proxy_unavailable;
661 scoped_ptr<data_reduction_proxy::DataReductionProxyParams> 659 scoped_ptr<data_reduction_proxy::DataReductionProxyParams>
662 data_reduction_proxy_params; 660 data_reduction_proxy_params;
663 scoped_ptr<DataReductionProxyChromeConfigurator> chrome_configurator; 661 scoped_ptr<DataReductionProxyChromeConfigurator> chrome_configurator;
664 #if defined(SPDY_PROXY_AUTH_ORIGIN)
665 DataReductionProxyChromeSettings* data_reduction_proxy_chrome_settings = 662 DataReductionProxyChromeSettings* data_reduction_proxy_chrome_settings =
666 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(this); 663 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(this);
667 data_reduction_proxy_params = 664 data_reduction_proxy_params =
668 data_reduction_proxy_chrome_settings->params()->Clone(); 665 data_reduction_proxy_chrome_settings->params()->Clone();
669 data_reduction_proxy_unavailable = 666 data_reduction_proxy_unavailable =
670 base::Bind( 667 base::Bind(
671 &data_reduction_proxy::DataReductionProxySettings::SetUnreachable, 668 &data_reduction_proxy::DataReductionProxySettings::SetUnreachable,
672 base::Unretained(data_reduction_proxy_chrome_settings)); 669 base::Unretained(data_reduction_proxy_chrome_settings));
673 // The configurator is used by DataReductionProxyChromeSettings and 670 // The configurator is used by DataReductionProxyChromeSettings and
674 // ProfileIOData. Ownership is passed to the latter via ProfileIOData::Handle, 671 // ProfileIOData. Ownership is passed to the latter via ProfileIOData::Handle,
675 // which is only destroyed after BrowserContextKeyedServices, 672 // which is only destroyed after BrowserContextKeyedServices,
676 // including DataReductionProxyChromeSettings. 673 // including DataReductionProxyChromeSettings.
677 chrome_configurator.reset( 674 chrome_configurator.reset(
678 new DataReductionProxyChromeConfigurator( 675 new DataReductionProxyChromeConfigurator(
679 prefs_.get(), 676 prefs_.get(),
680 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); 677 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)));
681 // Retain a raw pointer to use for initialization of data reduction proxy 678 // Retain a raw pointer to use for initialization of data reduction proxy
682 // settings after ownership is passed. 679 // settings after ownership is passed.
683 DataReductionProxyChromeConfigurator* 680 DataReductionProxyChromeConfigurator*
684 data_reduction_proxy_chrome_configurator = chrome_configurator.get(); 681 data_reduction_proxy_chrome_configurator = chrome_configurator.get();
685 #endif
686 682
687 // Make sure we initialize the ProfileIOData after everything else has been 683 // Make sure we initialize the ProfileIOData after everything else has been
688 // initialized that we might be reading from the IO thread. 684 // initialized that we might be reading from the IO thread.
689 685
690 io_data_.Init(cookie_path, channel_id_path, cache_path, 686 io_data_.Init(cookie_path, channel_id_path, cache_path,
691 cache_max_size, media_cache_path, media_cache_max_size, 687 cache_max_size, media_cache_path, media_cache_max_size,
692 extensions_cookie_path, GetPath(), infinite_cache_path, 688 extensions_cookie_path, GetPath(), infinite_cache_path,
693 predictor_, session_cookie_mode, GetSpecialStoragePolicy(), 689 predictor_, session_cookie_mode, GetSpecialStoragePolicy(),
694 CreateDomainReliabilityMonitor(local_state), 690 CreateDomainReliabilityMonitor(local_state),
695 data_reduction_proxy_unavailable, 691 data_reduction_proxy_unavailable,
696 chrome_configurator.Pass(), 692 chrome_configurator.Pass(),
697 data_reduction_proxy_params.Pass()); 693 data_reduction_proxy_params.Pass());
698
699 #if defined(SPDY_PROXY_AUTH_ORIGIN)
700 data_reduction_proxy_chrome_settings->InitDataReductionProxySettings( 694 data_reduction_proxy_chrome_settings->InitDataReductionProxySettings(
701 data_reduction_proxy_chrome_configurator, 695 data_reduction_proxy_chrome_configurator,
702 prefs_.get(), 696 prefs_.get(),
703 g_browser_process->local_state(), 697 g_browser_process->local_state(),
704 GetRequestContext()); 698 GetRequestContext());
705 #endif
706 699
707 #if defined(ENABLE_PLUGINS) 700 #if defined(ENABLE_PLUGINS)
708 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( 701 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext(
709 PluginPrefs::GetForProfile(this).get(), 702 PluginPrefs::GetForProfile(this).get(),
710 io_data_.GetResourceContextNoInit()); 703 io_data_.GetResourceContextNoInit());
711 #endif 704 #endif
712 705
713 // Delay README creation to not impact startup performance. 706 // Delay README creation to not impact startup performance.
714 BrowserThread::PostDelayedTask( 707 BrowserThread::PostDelayedTask(
715 BrowserThread::FILE, FROM_HERE, 708 BrowserThread::FILE, FROM_HERE,
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
1455 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> 1448 domain_reliability::DomainReliabilityServiceFactory::GetInstance()->
1456 GetForBrowserContext(this); 1449 GetForBrowserContext(this);
1457 if (!service) 1450 if (!service)
1458 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>(); 1451 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>();
1459 1452
1460 return service->CreateMonitor( 1453 return service->CreateMonitor(
1461 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), 1454 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
1462 local_state, 1455 local_state,
1463 prefs::kMetricsReportingEnabled); 1456 prefs::kMetricsReportingEnabled);
1464 } 1457 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698