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

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

Issue 449973002: Use data reduction proxy when managed proxy config returns direct (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@no-uma-in-proxy-service
Patch Set: Addressed comment and nit 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_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 27 matching lines...) Expand all
38 #include "chrome/browser/dom_distiller/lazy_dom_distiller_service.h" 38 #include "chrome/browser/dom_distiller/lazy_dom_distiller_service.h"
39 #include "chrome/browser/domain_reliability/service_factory.h" 39 #include "chrome/browser/domain_reliability/service_factory.h"
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_settings.h" 49 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h"
49 #include "chrome/browser/net/ssl_config_service_manager.h" 50 #include "chrome/browser/net/ssl_config_service_manager.h"
50 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" 51 #include "chrome/browser/plugins/chrome_plugin_service_filter.h"
51 #include "chrome/browser/plugins/plugin_prefs.h" 52 #include "chrome/browser/plugins/plugin_prefs.h"
52 #include "chrome/browser/policy/profile_policy_connector.h" 53 #include "chrome/browser/policy/profile_policy_connector.h"
53 #include "chrome/browser/policy/profile_policy_connector_factory.h" 54 #include "chrome/browser/policy/profile_policy_connector_factory.h"
54 #include "chrome/browser/prefs/browser_prefs.h" 55 #include "chrome/browser/prefs/browser_prefs.h"
55 #include "chrome/browser/prefs/chrome_pref_service_factory.h" 56 #include "chrome/browser/prefs/chrome_pref_service_factory.h"
56 #include "chrome/browser/prefs/pref_service_syncable.h" 57 #include "chrome/browser/prefs/pref_service_syncable.h"
57 #include "chrome/browser/prefs/tracked/tracked_preference_validation_delegate.h" 58 #include "chrome/browser/prefs/tracked/tracked_preference_validation_delegate.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 #endif 109 #endif
109 110
110 #if defined(OS_CHROMEOS) 111 #if defined(OS_CHROMEOS)
111 #include "chrome/browser/chromeos/locale_change_guard.h" 112 #include "chrome/browser/chromeos/locale_change_guard.h"
112 #include "chrome/browser/chromeos/login/users/user_manager.h" 113 #include "chrome/browser/chromeos/login/users/user_manager.h"
113 #include "chrome/browser/chromeos/preferences.h" 114 #include "chrome/browser/chromeos/preferences.h"
114 #include "chrome/browser/chromeos/profiles/profile_helper.h" 115 #include "chrome/browser/chromeos/profiles/profile_helper.h"
115 #endif 116 #endif
116 117
117 #if defined(SPDY_PROXY_AUTH_ORIGIN) 118 #if defined(SPDY_PROXY_AUTH_ORIGIN)
118 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator. h"
119 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h" 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" 120 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h"
121 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings. h" 121 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings. h"
122 #endif 122 #endif
123 123
124 #if defined(ENABLE_CONFIGURATION_POLICY) 124 #if defined(ENABLE_CONFIGURATION_POLICY)
125 #include "chrome/browser/policy/schema_registry_service.h" 125 #include "chrome/browser/policy/schema_registry_service.h"
126 #include "chrome/browser/policy/schema_registry_service_factory.h" 126 #include "chrome/browser/policy/schema_registry_service_factory.h"
127 #include "components/policy/core/browser/browser_policy_connector.h" 127 #include "components/policy/core/browser/browser_policy_connector.h"
128 #if defined(OS_CHROMEOS) 128 #if defined(OS_CHROMEOS)
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 if (GetLastSessionExitType() == Profile::EXIT_CRASHED || 625 if (GetLastSessionExitType() == Profile::EXIT_CRASHED ||
626 startup_pref_type == SessionStartupPref::LAST) { 626 startup_pref_type == SessionStartupPref::LAST) {
627 session_cookie_mode = content::CookieStoreConfig::RESTORED_SESSION_COOKIES; 627 session_cookie_mode = content::CookieStoreConfig::RESTORED_SESSION_COOKIES;
628 } 628 }
629 629
630 InitHostZoomMap(); 630 InitHostZoomMap();
631 631
632 base::Callback<void(bool)> data_reduction_proxy_unavailable; 632 base::Callback<void(bool)> data_reduction_proxy_unavailable;
633 scoped_ptr<data_reduction_proxy::DataReductionProxyParams> 633 scoped_ptr<data_reduction_proxy::DataReductionProxyParams>
634 data_reduction_proxy_params; 634 data_reduction_proxy_params;
635 scoped_ptr<DataReductionProxyChromeConfigurator> chrome_configurator;
635 #if defined(SPDY_PROXY_AUTH_ORIGIN) 636 #if defined(SPDY_PROXY_AUTH_ORIGIN)
636 DataReductionProxyChromeSettings* data_reduction_proxy_chrome_settings = 637 DataReductionProxyChromeSettings* data_reduction_proxy_chrome_settings =
637 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(this); 638 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(this);
638 data_reduction_proxy_params = 639 data_reduction_proxy_params =
639 data_reduction_proxy_chrome_settings->params()->Clone(); 640 data_reduction_proxy_chrome_settings->params()->Clone();
640 data_reduction_proxy_unavailable = 641 data_reduction_proxy_unavailable =
641 base::Bind( 642 base::Bind(
642 &data_reduction_proxy::DataReductionProxySettings::SetUnreachable, 643 &data_reduction_proxy::DataReductionProxySettings::SetUnreachable,
643 base::Unretained(data_reduction_proxy_chrome_settings)); 644 base::Unretained(data_reduction_proxy_chrome_settings));
645 // The configurator is used by DataReductionProxyChromeSettings and
646 // ProfileIOData. Ownership is passed to the latter via ProfileIOData::Handle,
647 // which is only destroyed after BrowserContextKeyedServices,
648 // including DataReductionProxyChromeSettings.
649 chrome_configurator.reset(
650 new DataReductionProxyChromeConfigurator(
651 prefs_.get(),
652 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)));
653 // Retain a raw pointer to use for initialization of data reduction proxy
654 // settings after ownership is passed.
655 DataReductionProxyChromeConfigurator*
656 data_reduction_proxy_chrome_configurator = chrome_configurator.get();
644 #endif 657 #endif
645 658
646 // Make sure we initialize the ProfileIOData after everything else has been 659 // Make sure we initialize the ProfileIOData after everything else has been
647 // initialized that we might be reading from the IO thread. 660 // initialized that we might be reading from the IO thread.
648 661
649 io_data_.Init(cookie_path, channel_id_path, cache_path, 662 io_data_.Init(cookie_path, channel_id_path, cache_path,
650 cache_max_size, media_cache_path, media_cache_max_size, 663 cache_max_size, media_cache_path, media_cache_max_size,
651 extensions_cookie_path, GetPath(), infinite_cache_path, 664 extensions_cookie_path, GetPath(), infinite_cache_path,
652 predictor_, session_cookie_mode, GetSpecialStoragePolicy(), 665 predictor_, session_cookie_mode, GetSpecialStoragePolicy(),
653 CreateDomainReliabilityMonitor(), 666 CreateDomainReliabilityMonitor(),
654 data_reduction_proxy_unavailable, 667 data_reduction_proxy_unavailable,
668 chrome_configurator.Pass(),
655 data_reduction_proxy_params.Pass()); 669 data_reduction_proxy_params.Pass());
656 670
657 #if defined(SPDY_PROXY_AUTH_ORIGIN) 671 #if defined(SPDY_PROXY_AUTH_ORIGIN)
658 scoped_ptr<data_reduction_proxy::DataReductionProxyConfigurator>
659 configurator(new DataReductionProxyChromeConfigurator(prefs_.get()));
660 data_reduction_proxy_chrome_settings->InitDataReductionProxySettings( 672 data_reduction_proxy_chrome_settings->InitDataReductionProxySettings(
661 configurator.Pass(), 673 data_reduction_proxy_chrome_configurator,
662 prefs_.get(), 674 prefs_.get(),
663 g_browser_process->local_state(), 675 g_browser_process->local_state(),
664 GetRequestContext()); 676 GetRequestContext());
665 #endif 677 #endif
666 678
667 #if defined(ENABLE_PLUGINS) 679 #if defined(ENABLE_PLUGINS)
668 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( 680 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext(
669 PluginPrefs::GetForProfile(this).get(), 681 PluginPrefs::GetForProfile(this).get(),
670 io_data_.GetResourceContextNoInit()); 682 io_data_.GetResourceContextNoInit());
671 #endif 683 #endif
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
1401 ProfileImpl::CreateDomainReliabilityMonitor() { 1413 ProfileImpl::CreateDomainReliabilityMonitor() {
1402 domain_reliability::DomainReliabilityService* service = 1414 domain_reliability::DomainReliabilityService* service =
1403 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> 1415 domain_reliability::DomainReliabilityServiceFactory::GetInstance()->
1404 GetForBrowserContext(this); 1416 GetForBrowserContext(this);
1405 if (!service) 1417 if (!service)
1406 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>(); 1418 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>();
1407 1419
1408 return service->CreateMonitor( 1420 return service->CreateMonitor(
1409 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); 1421 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
1410 } 1422 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698