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

Side by Side Diff: ios/chrome/browser/application_context_impl.cc

Issue 1456783004: Remove configuration policy on iOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clean up gyp and DEPS Created 5 years, 1 month 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 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"
(...skipping 17 matching lines...) Expand all
28 #include "ios/chrome/browser/pref_names.h" 28 #include "ios/chrome/browser/pref_names.h"
29 #include "ios/chrome/browser/prefs/browser_prefs.h" 29 #include "ios/chrome/browser/prefs/browser_prefs.h"
30 #include "ios/chrome/browser/prefs/ios_chrome_pref_service_factory.h" 30 #include "ios/chrome/browser/prefs/ios_chrome_pref_service_factory.h"
31 #include "ios/chrome/common/channel_info.h" 31 #include "ios/chrome/common/channel_info.h"
32 #include "ios/public/provider/chrome/browser/browser_state/chrome_browser_state. 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_ manager.h" 33 #include "ios/public/provider/chrome/browser/browser_state/chrome_browser_state_ manager.h"
34 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" 34 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h"
35 #include "net/log/net_log_capture_mode.h" 35 #include "net/log/net_log_capture_mode.h"
36 #include "net/socket/client_socket_pool_manager.h" 36 #include "net/socket/client_socket_pool_manager.h"
37 37
38 #if defined(ENABLE_CONFIGURATION_POLICY)
39 #include "components/policy/core/browser/browser_policy_connector.h"
40 #include "components/policy/core/common/policy_service.h"
41 #else
42 #include "components/policy/core/common/policy_service_stub.h"
43 #endif
44
45 ApplicationContextImpl::ApplicationContextImpl( 38 ApplicationContextImpl::ApplicationContextImpl(
46 base::SequencedTaskRunner* local_state_task_runner, 39 base::SequencedTaskRunner* local_state_task_runner,
47 const base::CommandLine& command_line) 40 const base::CommandLine& command_line)
48 : local_state_task_runner_(local_state_task_runner), 41 : local_state_task_runner_(local_state_task_runner),
49 was_last_shutdown_clean_(false), 42 was_last_shutdown_clean_(false),
50 created_local_state_(false) { 43 created_local_state_(false) {
51 DCHECK(!GetApplicationContext()); 44 DCHECK(!GetApplicationContext());
52 SetApplicationContext(this); 45 SetApplicationContext(this);
53 46
54 net_log_.reset(new net_log::ChromeNetLog( 47 net_log_.reset(new net_log::ChromeNetLog(
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 metrics::MetricsService* ApplicationContextImpl::GetMetricsService() { 158 metrics::MetricsService* ApplicationContextImpl::GetMetricsService() {
166 DCHECK(thread_checker_.CalledOnValidThread()); 159 DCHECK(thread_checker_.CalledOnValidThread());
167 return ios::GetChromeBrowserProvider()->GetMetricsService(); 160 return ios::GetChromeBrowserProvider()->GetMetricsService();
168 } 161 }
169 162
170 variations::VariationsService* ApplicationContextImpl::GetVariationsService() { 163 variations::VariationsService* ApplicationContextImpl::GetVariationsService() {
171 DCHECK(thread_checker_.CalledOnValidThread()); 164 DCHECK(thread_checker_.CalledOnValidThread());
172 return ios::GetChromeBrowserProvider()->GetVariationsService(); 165 return ios::GetChromeBrowserProvider()->GetVariationsService();
173 } 166 }
174 167
175 policy::BrowserPolicyConnector*
176 ApplicationContextImpl::GetBrowserPolicyConnector() {
177 DCHECK(thread_checker_.CalledOnValidThread());
178 return ios::GetChromeBrowserProvider()->GetBrowserPolicyConnector();
179 }
180
181 policy::PolicyService* ApplicationContextImpl::GetPolicyService() {
182 DCHECK(thread_checker_.CalledOnValidThread());
183 #if defined(ENABLE_CONFIGURATION_POLICY)
184 return GetBrowserPolicyConnector()->GetPolicyService();
185 #else
186 if (!policy_service_)
187 policy_service_.reset(new policy::PolicyServiceStub);
188 return policy_service_.get();
189 #endif
190 }
191
192 rappor::RapporService* ApplicationContextImpl::GetRapporService() { 168 rappor::RapporService* ApplicationContextImpl::GetRapporService() {
193 DCHECK(thread_checker_.CalledOnValidThread()); 169 DCHECK(thread_checker_.CalledOnValidThread());
194 return ios::GetChromeBrowserProvider()->GetRapporService(); 170 return ios::GetChromeBrowserProvider()->GetRapporService();
195 } 171 }
196 172
197 net_log::ChromeNetLog* ApplicationContextImpl::GetNetLog() { 173 net_log::ChromeNetLog* ApplicationContextImpl::GetNetLog() {
198 DCHECK(thread_checker_.CalledOnValidThread()); 174 DCHECK(thread_checker_.CalledOnValidThread());
199 return net_log_.get(); 175 return net_log_.get();
200 } 176 }
201 177
(...skipping 12 matching lines...) Expand all
214 DCHECK(!created_local_state_ && !local_state_); 190 DCHECK(!created_local_state_ && !local_state_);
215 created_local_state_ = true; 191 created_local_state_ = true;
216 192
217 base::FilePath local_state_path; 193 base::FilePath local_state_path;
218 CHECK(PathService::Get(ios::FILE_LOCAL_STATE, &local_state_path)); 194 CHECK(PathService::Get(ios::FILE_LOCAL_STATE, &local_state_path));
219 scoped_refptr<PrefRegistrySimple> pref_registry(new PrefRegistrySimple); 195 scoped_refptr<PrefRegistrySimple> pref_registry(new PrefRegistrySimple);
220 196
221 // Register local state preferences. 197 // Register local state preferences.
222 RegisterLocalStatePrefs(pref_registry.get()); 198 RegisterLocalStatePrefs(pref_registry.get());
223 199
224 local_state_ = 200 local_state_ = ::CreateLocalState(
225 ::CreateLocalState(local_state_path, local_state_task_runner_.get(), 201 local_state_path, local_state_task_runner_.get(), pref_registry, false);
226 GetPolicyService(), pref_registry, false);
227 202
228 const int max_per_proxy = 203 const int max_per_proxy =
229 local_state_->GetInteger(ios::prefs::kMaxConnectionsPerProxy); 204 local_state_->GetInteger(ios::prefs::kMaxConnectionsPerProxy);
230 net::ClientSocketPoolManager::set_max_sockets_per_proxy_server( 205 net::ClientSocketPoolManager::set_max_sockets_per_proxy_server(
231 net::HttpNetworkSession::NORMAL_SOCKET_POOL, 206 net::HttpNetworkSession::NORMAL_SOCKET_POOL,
232 std::max(std::min(max_per_proxy, 99), 207 std::max(std::min(max_per_proxy, 99),
233 net::ClientSocketPoolManager::max_sockets_per_group( 208 net::ClientSocketPoolManager::max_sockets_per_group(
234 net::HttpNetworkSession::NORMAL_SOCKET_POOL))); 209 net::HttpNetworkSession::NORMAL_SOCKET_POOL)));
235 210
236 // Register the shutdown state before anything changes it. 211 // Register the shutdown state before anything changes it.
237 if (local_state_->HasPrefPath(prefs::kLastSessionExitedCleanly)) { 212 if (local_state_->HasPrefPath(prefs::kLastSessionExitedCleanly)) {
238 was_last_shutdown_clean_ = 213 was_last_shutdown_clean_ =
239 local_state_->GetBoolean(prefs::kLastSessionExitedCleanly); 214 local_state_->GetBoolean(prefs::kLastSessionExitedCleanly);
240 } 215 }
241 } 216 }
OLDNEW
« no previous file with comments | « ios/chrome/browser/application_context_impl.h ('k') | ios/chrome/browser/net/ios_chrome_network_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698