| OLD | NEW |
| 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 29 matching lines...) Expand all Loading... |
| 40 #include "chrome/browser/net/proxy_service_factory.h" | 40 #include "chrome/browser/net/proxy_service_factory.h" |
| 41 #include "chrome/browser/net/resource_prefetch_predictor_observer.h" | 41 #include "chrome/browser/net/resource_prefetch_predictor_observer.h" |
| 42 #include "chrome/browser/predictors/resource_prefetch_predictor.h" | 42 #include "chrome/browser/predictors/resource_prefetch_predictor.h" |
| 43 #include "chrome/browser/predictors/resource_prefetch_predictor_factory.h" | 43 #include "chrome/browser/predictors/resource_prefetch_predictor_factory.h" |
| 44 #include "chrome/browser/profiles/profile.h" | 44 #include "chrome/browser/profiles/profile.h" |
| 45 #include "chrome/browser/profiles/profile_manager.h" | 45 #include "chrome/browser/profiles/profile_manager.h" |
| 46 #include "chrome/browser/ui/search/new_tab_page_interceptor_service.h" | 46 #include "chrome/browser/ui/search/new_tab_page_interceptor_service.h" |
| 47 #include "chrome/browser/ui/search/new_tab_page_interceptor_service_factory.h" | 47 #include "chrome/browser/ui/search/new_tab_page_interceptor_service_factory.h" |
| 48 #include "chrome/common/chrome_paths.h" | 48 #include "chrome/common/chrome_paths.h" |
| 49 #include "chrome/common/chrome_switches.h" | 49 #include "chrome/common/chrome_switches.h" |
| 50 #include "chrome/common/features.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" |
| 52 #include "components/about_handler/about_protocol_handler.h" | 53 #include "components/about_handler/about_protocol_handler.h" |
| 53 #include "components/content_settings/core/browser/content_settings_provider.h" | 54 #include "components/content_settings/core/browser/content_settings_provider.h" |
| 54 #include "components/content_settings/core/browser/cookie_settings.h" | 55 #include "components/content_settings/core/browser/cookie_settings.h" |
| 55 #include "components/content_settings/core/browser/host_content_settings_map.h" | 56 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 56 #include "components/cookie_config/cookie_store_util.h" | 57 #include "components/cookie_config/cookie_store_util.h" |
| 57 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
ata.h" | 58 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
ata.h" |
| 58 #include "components/dom_distiller/core/url_constants.h" | 59 #include "components/dom_distiller/core/url_constants.h" |
| 59 #include "components/metrics/metrics_pref_names.h" | 60 #include "components/metrics/metrics_pref_names.h" |
| (...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 return base::Bind(&MediaDeviceIDSalt::GetSalt, media_device_id_salt_); | 861 return base::Bind(&MediaDeviceIDSalt::GetSalt, media_device_id_salt_); |
| 861 } | 862 } |
| 862 | 863 |
| 863 bool ProfileIOData::IsOffTheRecord() const { | 864 bool ProfileIOData::IsOffTheRecord() const { |
| 864 return profile_type() == Profile::INCOGNITO_PROFILE | 865 return profile_type() == Profile::INCOGNITO_PROFILE |
| 865 || profile_type() == Profile::GUEST_PROFILE; | 866 || profile_type() == Profile::GUEST_PROFILE; |
| 866 } | 867 } |
| 867 | 868 |
| 868 void ProfileIOData::InitializeMetricsEnabledStateOnUIThread() { | 869 void ProfileIOData::InitializeMetricsEnabledStateOnUIThread() { |
| 869 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 870 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 870 #if defined(OS_ANDROID) | 871 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 871 // TODO(dwkang): rename or unify the pref for UMA once we have conclusion | 872 // TODO(dwkang): rename or unify the pref for UMA once we have conclusion |
| 872 // in crbugs.com/246495. | 873 // in crbugs.com/246495. |
| 873 // Android has it's own preferences for metrics / crash uploading. | 874 // Android has it's own preferences for metrics / crash uploading. |
| 874 enable_metrics_.Init(prefs::kCrashReportingEnabled, | 875 enable_metrics_.Init(prefs::kCrashReportingEnabled, |
| 875 g_browser_process->local_state()); | 876 g_browser_process->local_state()); |
| 876 enable_metrics_.MoveToThread( | 877 enable_metrics_.MoveToThread( |
| 877 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 878 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
| 878 #else | 879 #else |
| 879 // Prep the PrefMember and send it to the IO thread, since this value will be | 880 // Prep the PrefMember and send it to the IO thread, since this value will be |
| 880 // read from there. | 881 // read from there. |
| 881 enable_metrics_.Init(metrics::prefs::kMetricsReportingEnabled, | 882 enable_metrics_.Init(metrics::prefs::kMetricsReportingEnabled, |
| 882 g_browser_process->local_state()); | 883 g_browser_process->local_state()); |
| 883 enable_metrics_.MoveToThread( | 884 enable_metrics_.MoveToThread( |
| 884 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 885 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
| 885 #endif // defined(OS_ANDROID) | 886 #endif // BUILDFLAG(ANDROID_JAVA_UI) |
| 886 } | 887 } |
| 887 | 888 |
| 888 bool ProfileIOData::GetMetricsEnabledStateOnIOThread() const { | 889 bool ProfileIOData::GetMetricsEnabledStateOnIOThread() const { |
| 889 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 890 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 890 return enable_metrics_.GetValue(); | 891 return enable_metrics_.GetValue(); |
| 891 } | 892 } |
| 892 | 893 |
| 893 bool ProfileIOData::IsDataReductionProxyEnabled() const { | 894 bool ProfileIOData::IsDataReductionProxyEnabled() const { |
| 894 return data_reduction_proxy_io_data() && | 895 return data_reduction_proxy_io_data() && |
| 895 data_reduction_proxy_io_data()->IsEnabled(); | 896 data_reduction_proxy_io_data()->IsEnabled(); |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1320 make_scoped_ptr(new DevToolsNetworkTransactionFactory( | 1321 make_scoped_ptr(new DevToolsNetworkTransactionFactory( |
| 1321 network_controller_handle_.GetController(), shared_session)), | 1322 network_controller_handle_.GetController(), shared_session)), |
| 1322 backend.Pass(), true /* set_up_quic_server_info */)); | 1323 backend.Pass(), true /* set_up_quic_server_info */)); |
| 1323 } | 1324 } |
| 1324 | 1325 |
| 1325 void ProfileIOData::SetCookieSettingsForTesting( | 1326 void ProfileIOData::SetCookieSettingsForTesting( |
| 1326 content_settings::CookieSettings* cookie_settings) { | 1327 content_settings::CookieSettings* cookie_settings) { |
| 1327 DCHECK(!cookie_settings_.get()); | 1328 DCHECK(!cookie_settings_.get()); |
| 1328 cookie_settings_ = cookie_settings; | 1329 cookie_settings_ = cookie_settings; |
| 1329 } | 1330 } |
| OLD | NEW |