OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ios/chrome/browser/application_context_impl.h" | 5 #include "ios/chrome/browser/application_context_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/path_service.h" | 14 #include "base/path_service.h" |
15 #include "base/prefs/pref_registry_simple.h" | 15 #include "base/prefs/pref_registry_simple.h" |
16 #include "base/prefs/pref_service.h" | 16 #include "base/prefs/pref_service.h" |
17 #include "base/time/default_tick_clock.h" | 17 #include "base/time/default_tick_clock.h" |
18 #include "components/history/core/browser/history_service.h" | 18 #include "components/history/core/browser/history_service.h" |
19 #include "components/keyed_service/core/service_access_type.h" | 19 #include "components/keyed_service/core/service_access_type.h" |
20 #include "components/metrics/metrics_pref_names.h" | 20 #include "components/metrics/metrics_pref_names.h" |
21 #include "components/metrics/metrics_service.h" | 21 #include "components/metrics/metrics_service.h" |
22 #include "components/net_log/chrome_net_log.h" | 22 #include "components/net_log/chrome_net_log.h" |
23 #include "components/network_time/network_time_tracker.h" | 23 #include "components/network_time/network_time_tracker.h" |
24 #include "components/translate/core/browser/translate_download_manager.h" | 24 #include "components/translate/core/browser/translate_download_manager.h" |
25 #include "components/variations/service/variations_service.h" | 25 #include "components/variations/service/variations_service.h" |
| 26 #include "components/web_resource/web_resource_pref_names.h" |
26 #include "ios/chrome/browser/chrome_paths.h" | 27 #include "ios/chrome/browser/chrome_paths.h" |
27 #include "ios/chrome/browser/history/history_service_factory.h" | 28 #include "ios/chrome/browser/history/history_service_factory.h" |
28 #include "ios/chrome/browser/pref_names.h" | 29 #include "ios/chrome/browser/pref_names.h" |
29 #include "ios/chrome/browser/prefs/browser_prefs.h" | 30 #include "ios/chrome/browser/prefs/browser_prefs.h" |
30 #include "ios/chrome/browser/prefs/ios_chrome_pref_service_factory.h" | 31 #include "ios/chrome/browser/prefs/ios_chrome_pref_service_factory.h" |
31 #include "ios/chrome/common/channel_info.h" | 32 #include "ios/chrome/common/channel_info.h" |
32 #include "ios/public/provider/chrome/browser/browser_state/chrome_browser_state.
h" | 33 #include "ios/public/provider/chrome/browser/browser_state/chrome_browser_state.
h" |
33 #include "ios/public/provider/chrome/browser/browser_state/chrome_browser_state_
manager.h" | 34 #include "ios/public/provider/chrome/browser/browser_state/chrome_browser_state_
manager.h" |
34 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" | 35 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" |
35 #include "net/log/net_log_capture_mode.h" | 36 #include "net/log/net_log_capture_mode.h" |
(...skipping 13 matching lines...) Expand all Loading... |
49 command_line.GetCommandLineString(), GetChannelString())); | 50 command_line.GetCommandLineString(), GetChannelString())); |
50 } | 51 } |
51 | 52 |
52 ApplicationContextImpl::~ApplicationContextImpl() { | 53 ApplicationContextImpl::~ApplicationContextImpl() { |
53 DCHECK_EQ(this, GetApplicationContext()); | 54 DCHECK_EQ(this, GetApplicationContext()); |
54 SetApplicationContext(nullptr); | 55 SetApplicationContext(nullptr); |
55 } | 56 } |
56 | 57 |
57 // static | 58 // static |
58 void ApplicationContextImpl::RegisterPrefs(PrefRegistrySimple* registry) { | 59 void ApplicationContextImpl::RegisterPrefs(PrefRegistrySimple* registry) { |
| 60 registry->RegisterStringPref(ios::prefs::kApplicationLocale, std::string()); |
| 61 registry->RegisterBooleanPref(prefs::kEulaAccepted, false); |
59 registry->RegisterBooleanPref(metrics::prefs::kMetricsReportingEnabled, | 62 registry->RegisterBooleanPref(metrics::prefs::kMetricsReportingEnabled, |
60 false); | 63 false); |
61 registry->RegisterBooleanPref(prefs::kLastSessionExitedCleanly, true); | 64 registry->RegisterBooleanPref(prefs::kLastSessionExitedCleanly, true); |
62 registry->RegisterBooleanPref(prefs::kMetricsReportingWifiOnly, true); | 65 registry->RegisterBooleanPref(prefs::kMetricsReportingWifiOnly, true); |
63 } | 66 } |
64 | 67 |
65 void ApplicationContextImpl::SetApplicationLocale(const std::string& locale) { | 68 void ApplicationContextImpl::SetApplicationLocale(const std::string& locale) { |
66 DCHECK(thread_checker_.CalledOnValidThread()); | 69 DCHECK(thread_checker_.CalledOnValidThread()); |
67 application_locale_ = locale; | 70 application_locale_ = locale; |
68 translate::TranslateDownloadManager::GetInstance()->set_application_locale( | 71 translate::TranslateDownloadManager::GetInstance()->set_application_locale( |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 std::max(std::min(max_per_proxy, 99), | 210 std::max(std::min(max_per_proxy, 99), |
208 net::ClientSocketPoolManager::max_sockets_per_group( | 211 net::ClientSocketPoolManager::max_sockets_per_group( |
209 net::HttpNetworkSession::NORMAL_SOCKET_POOL))); | 212 net::HttpNetworkSession::NORMAL_SOCKET_POOL))); |
210 | 213 |
211 // Register the shutdown state before anything changes it. | 214 // Register the shutdown state before anything changes it. |
212 if (local_state_->HasPrefPath(prefs::kLastSessionExitedCleanly)) { | 215 if (local_state_->HasPrefPath(prefs::kLastSessionExitedCleanly)) { |
213 was_last_shutdown_clean_ = | 216 was_last_shutdown_clean_ = |
214 local_state_->GetBoolean(prefs::kLastSessionExitedCleanly); | 217 local_state_->GetBoolean(prefs::kLastSessionExitedCleanly); |
215 } | 218 } |
216 } | 219 } |
OLD | NEW |