Chromium Code Reviews| 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_impl.h" | 5 #include "chrome/browser/profiles/profile_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 86 #include "content/public/browser/user_metrics.h" | 86 #include "content/public/browser/user_metrics.h" |
| 87 #include "content/public/common/content_constants.h" | 87 #include "content/public/common/content_constants.h" |
| 88 #include "grit/chromium_strings.h" | 88 #include "grit/chromium_strings.h" |
| 89 #include "grit/generated_resources.h" | 89 #include "grit/generated_resources.h" |
| 90 #include "ui/base/l10n/l10n_util.h" | 90 #include "ui/base/l10n/l10n_util.h" |
| 91 | 91 |
| 92 #if defined(ENABLE_CONFIGURATION_POLICY) | 92 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 93 #include "chrome/browser/policy/browser_policy_connector.h" | 93 #include "chrome/browser/policy/browser_policy_connector.h" |
| 94 #include "chrome/browser/policy/managed_mode_policy_provider.h" | 94 #include "chrome/browser/policy/managed_mode_policy_provider.h" |
| 95 #include "chrome/browser/policy/user_cloud_policy_manager.h" | 95 #include "chrome/browser/policy/user_cloud_policy_manager.h" |
| 96 #include "chrome/browser/policy/user_cloud_policy_store.h" | |
|
Joao da Silva
2012/11/21 17:06:34
These 2 are excluded from gyp when OS_CHROMEOS
Mattias Nissler (ping if slow)
2012/11/22 20:51:59
Thanks, this comment uncovered a deeper issue: Rem
| |
| 96 #else | 97 #else |
| 97 #include "chrome/browser/policy/policy_service_stub.h" | 98 #include "chrome/browser/policy/policy_service_stub.h" |
| 98 #endif // defined(ENABLE_CONFIGURATION_POLICY) | 99 #endif // defined(ENABLE_CONFIGURATION_POLICY) |
| 99 | 100 |
| 100 #if defined(OS_WIN) | 101 #if defined(OS_WIN) |
| 101 #include "chrome/installer/util/install_util.h" | 102 #include "chrome/installer/util/install_util.h" |
| 102 #endif | 103 #endif |
| 103 | 104 |
| 104 #if defined(OS_CHROMEOS) | 105 #if defined(OS_CHROMEOS) |
| 105 #include "chrome/browser/chromeos/enterprise_extension_observer.h" | 106 #include "chrome/browser/chromeos/enterprise_extension_observer.h" |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 333 #endif | 334 #endif |
| 334 | 335 |
| 335 // Determine if prefetch is enabled for this profile. | 336 // Determine if prefetch is enabled for this profile. |
| 336 // If not profile_manager is present, it means we are in a unittest. | 337 // If not profile_manager is present, it means we are in a unittest. |
| 337 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 338 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 338 predictor_ = chrome_browser_net::Predictor::CreatePredictor( | 339 predictor_ = chrome_browser_net::Predictor::CreatePredictor( |
| 339 !command_line->HasSwitch(switches::kDisablePreconnect), | 340 !command_line->HasSwitch(switches::kDisablePreconnect), |
| 340 g_browser_process->profile_manager() == NULL); | 341 g_browser_process->profile_manager() == NULL); |
| 341 | 342 |
| 342 #if defined(ENABLE_CONFIGURATION_POLICY) | 343 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 343 // TODO(atwilson): Change these to ProfileKeyedServices once PrefService is | 344 // If we are creating the profile synchronously, then we should load the |
| 345 // policy data immediately. | |
| 346 bool force_immediate_policy_load = (create_mode == CREATE_MODE_SYNCHRONOUS); | |
| 347 | |
| 348 // TODO(atwilson): Change |cloud_policy_manager_| and | |
| 349 // |managed_mode_policy_provider_| to ProfileKeyedServices once PrefService is | |
| 344 // a ProfileKeyedService (policy must be initialized before PrefService | 350 // a ProfileKeyedService (policy must be initialized before PrefService |
| 345 // because PrefService depends on policy loading to get overridden pref | 351 // because PrefService depends on policy loading to get overridden pref |
| 346 // values). | 352 // values). |
| 347 policy::BrowserPolicyConnector* connector = | 353 #if !defined(OS_CHROMEOS) |
| 348 g_browser_process->browser_policy_connector(); | 354 if (command_line->HasSwitch(switches::kLoadCloudPolicyOnSignin)) { |
| 349 // If we are creating the profile synchronously, then we should load the | 355 scoped_ptr<policy::UserCloudPolicyStore> store( |
| 350 // policy data immediately. | 356 policy::UserCloudPolicyStore::Create(this)); |
|
Andrew T Wilson (Slow)
2012/11/21 17:34:24
Hmmm. Do we like exposing this code to Profile() a
Mattias Nissler (ping if slow)
2012/11/22 20:51:59
Fair. Changed.
| |
| 351 bool force_immediate_policy_load = (create_mode == CREATE_MODE_SYNCHRONOUS); | 357 if (force_immediate_policy_load) |
| 352 cloud_policy_manager_ = | 358 store->LoadImmediately(); |
| 353 connector->CreateCloudPolicyManager(this, force_immediate_policy_load); | 359 cloud_policy_manager_.reset( |
| 354 if (cloud_policy_manager_) | 360 new policy::UserCloudPolicyManager(store.Pass())); |
| 355 cloud_policy_manager_->Init(); | 361 cloud_policy_manager_->Init(); |
| 362 } | |
| 363 #endif | |
| 356 managed_mode_policy_provider_ = | 364 managed_mode_policy_provider_ = |
| 357 policy::ManagedModePolicyProvider::Create(this, | 365 policy::ManagedModePolicyProvider::Create(this, |
| 358 sequenced_task_runner, | 366 sequenced_task_runner, |
| 359 force_immediate_policy_load); | 367 force_immediate_policy_load); |
| 360 managed_mode_policy_provider_->Init(); | 368 managed_mode_policy_provider_->Init(); |
| 361 policy_service_ = connector->CreatePolicyService(this); | 369 policy_service_ = |
| 370 g_browser_process->browser_policy_connector()->CreatePolicyService(this); | |
| 362 #else | 371 #else |
| 363 policy_service_.reset(new policy::PolicyServiceStub()); | 372 policy_service_.reset(new policy::PolicyServiceStub()); |
| 364 #endif | 373 #endif |
| 365 | 374 |
| 366 if (create_mode == CREATE_MODE_ASYNCHRONOUS) { | 375 if (create_mode == CREATE_MODE_ASYNCHRONOUS) { |
| 367 prefs_.reset(PrefService::CreatePrefService( | 376 prefs_.reset(PrefService::CreatePrefService( |
| 368 GetPrefFilePath(), | 377 GetPrefFilePath(), |
| 369 sequenced_task_runner, | 378 sequenced_task_runner, |
| 370 policy_service_.get(), | 379 policy_service_.get(), |
| 371 new ExtensionPrefStore( | 380 new ExtensionPrefStore( |
| (...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1151 if (!path.empty()) | 1160 if (!path.empty()) |
| 1152 *cache_path = path; | 1161 *cache_path = path; |
| 1153 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : | 1162 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : |
| 1154 prefs_->GetInteger(prefs::kDiskCacheSize); | 1163 prefs_->GetInteger(prefs::kDiskCacheSize); |
| 1155 } | 1164 } |
| 1156 | 1165 |
| 1157 base::Callback<ChromeURLDataManagerBackend*(void)> | 1166 base::Callback<ChromeURLDataManagerBackend*(void)> |
| 1158 ProfileImpl::GetChromeURLDataManagerBackendGetter() const { | 1167 ProfileImpl::GetChromeURLDataManagerBackendGetter() const { |
| 1159 return io_data_.GetChromeURLDataManagerBackendGetter(); | 1168 return io_data_.GetChromeURLDataManagerBackendGetter(); |
| 1160 } | 1169 } |
| OLD | NEW |