| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 #include "content/public/browser/render_process_host.h" | 89 #include "content/public/browser/render_process_host.h" |
| 90 #include "content/public/browser/storage_partition.h" | 90 #include "content/public/browser/storage_partition.h" |
| 91 #include "content/public/browser/user_metrics.h" | 91 #include "content/public/browser/user_metrics.h" |
| 92 #include "content/public/common/content_constants.h" | 92 #include "content/public/common/content_constants.h" |
| 93 #include "grit/chromium_strings.h" | 93 #include "grit/chromium_strings.h" |
| 94 #include "grit/generated_resources.h" | 94 #include "grit/generated_resources.h" |
| 95 #include "ui/base/l10n/l10n_util.h" | 95 #include "ui/base/l10n/l10n_util.h" |
| 96 | 96 |
| 97 #if defined(ENABLE_CONFIGURATION_POLICY) | 97 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 98 #include "chrome/browser/policy/browser_policy_connector.h" | 98 #include "chrome/browser/policy/browser_policy_connector.h" |
| 99 #include "chrome/browser/policy/managed_mode_policy_provider.h" | |
| 100 #if !defined(OS_CHROMEOS) | 99 #if !defined(OS_CHROMEOS) |
| 101 #include "chrome/browser/policy/cloud/user_cloud_policy_manager.h" | 100 #include "chrome/browser/policy/cloud/user_cloud_policy_manager.h" |
| 102 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" | 101 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" |
| 103 #endif | 102 #endif |
| 103 #if defined(ENABLE_MANAGED_USERS) |
| 104 #include "chrome/browser/policy/managed_mode_policy_provider.h" |
| 105 #endif |
| 104 #else | 106 #else |
| 105 #include "chrome/browser/policy/policy_service_stub.h" | 107 #include "chrome/browser/policy/policy_service_stub.h" |
| 106 #endif // defined(ENABLE_CONFIGURATION_POLICY) | 108 #endif // defined(ENABLE_CONFIGURATION_POLICY) |
| 107 | 109 |
| 108 #if defined(OS_WIN) | 110 #if defined(OS_WIN) |
| 109 #include "chrome/installer/util/install_util.h" | 111 #include "chrome/installer/util/install_util.h" |
| 110 #endif | 112 #endif |
| 111 | 113 |
| 112 #if defined(OS_CHROMEOS) | 114 #if defined(OS_CHROMEOS) |
| 113 #include "chrome/browser/chromeos/enterprise_extension_observer.h" | 115 #include "chrome/browser/chromeos/enterprise_extension_observer.h" |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 // before PrefServiceSyncable because PrefServiceSyncable depends on policy | 372 // before PrefServiceSyncable because PrefServiceSyncable depends on policy |
| 371 // loading to get overridden pref values). | 373 // loading to get overridden pref values). |
| 372 #if !defined(OS_CHROMEOS) | 374 #if !defined(OS_CHROMEOS) |
| 373 if (!command_line->HasSwitch(switches::kDisableCloudPolicyOnSignin)) { | 375 if (!command_line->HasSwitch(switches::kDisableCloudPolicyOnSignin)) { |
| 374 cloud_policy_manager_ = | 376 cloud_policy_manager_ = |
| 375 policy::UserCloudPolicyManagerFactory::CreateForProfile( | 377 policy::UserCloudPolicyManagerFactory::CreateForProfile( |
| 376 this, force_immediate_policy_load); | 378 this, force_immediate_policy_load); |
| 377 cloud_policy_manager_->Init(); | 379 cloud_policy_manager_->Init(); |
| 378 } | 380 } |
| 379 #endif | 381 #endif |
| 382 #if defined(ENABLE_MANAGED_USERS) |
| 380 managed_mode_policy_provider_ = | 383 managed_mode_policy_provider_ = |
| 381 policy::ManagedModePolicyProvider::Create(this, | 384 policy::ManagedModePolicyProvider::Create(this, |
| 382 sequenced_task_runner, | 385 sequenced_task_runner, |
| 383 force_immediate_policy_load); | 386 force_immediate_policy_load); |
| 384 managed_mode_policy_provider_->Init(); | 387 managed_mode_policy_provider_->Init(); |
| 388 #endif |
| 385 policy_service_ = | 389 policy_service_ = |
| 386 g_browser_process->browser_policy_connector()->CreatePolicyService(this); | 390 g_browser_process->browser_policy_connector()->CreatePolicyService(this); |
| 387 #else | 391 #else |
| 388 policy_service_.reset(new policy::PolicyServiceStub()); | 392 policy_service_.reset(new policy::PolicyServiceStub()); |
| 389 #endif | 393 #endif |
| 390 | 394 |
| 391 DCHECK(create_mode == CREATE_MODE_ASYNCHRONOUS || | 395 DCHECK(create_mode == CREATE_MODE_ASYNCHRONOUS || |
| 392 create_mode == CREATE_MODE_SYNCHRONOUS); | 396 create_mode == CREATE_MODE_SYNCHRONOUS); |
| 393 bool async_prefs = create_mode == CREATE_MODE_ASYNCHRONOUS; | 397 bool async_prefs = create_mode == CREATE_MODE_ASYNCHRONOUS; |
| 394 | 398 |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 | 637 |
| 634 if (top_sites_.get()) | 638 if (top_sites_.get()) |
| 635 top_sites_->Shutdown(); | 639 top_sites_->Shutdown(); |
| 636 | 640 |
| 637 if (pref_proxy_config_tracker_.get()) | 641 if (pref_proxy_config_tracker_.get()) |
| 638 pref_proxy_config_tracker_->DetachFromPrefService(); | 642 pref_proxy_config_tracker_->DetachFromPrefService(); |
| 639 | 643 |
| 640 if (host_content_settings_map_) | 644 if (host_content_settings_map_) |
| 641 host_content_settings_map_->ShutdownOnUIThread(); | 645 host_content_settings_map_->ShutdownOnUIThread(); |
| 642 | 646 |
| 643 #if defined(ENABLE_CONFIGURATION_POLICY) | 647 #if defined(ENABLE_MANAGED_USERS) |
| 644 if (managed_mode_policy_provider_) | 648 if (managed_mode_policy_provider_) |
| 645 managed_mode_policy_provider_->Shutdown(); | 649 managed_mode_policy_provider_->Shutdown(); |
| 646 #endif | 650 #endif |
| 647 | 651 |
| 648 // This causes the Preferences file to be written to disk. | 652 // This causes the Preferences file to be written to disk. |
| 649 if (prefs_loaded) | 653 if (prefs_loaded) |
| 650 SetExitType(EXIT_NORMAL); | 654 SetExitType(EXIT_NORMAL); |
| 651 } | 655 } |
| 652 | 656 |
| 653 std::string ProfileImpl::GetProfileName() { | 657 std::string ProfileImpl::GetProfileName() { |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 } | 781 } |
| 778 | 782 |
| 779 Profile::ExitType ProfileImpl::GetLastSessionExitType() { | 783 Profile::ExitType ProfileImpl::GetLastSessionExitType() { |
| 780 // last_session_exited_cleanly_ is set when the preferences are loaded. Force | 784 // last_session_exited_cleanly_ is set when the preferences are loaded. Force |
| 781 // it to be set by asking for the prefs. | 785 // it to be set by asking for the prefs. |
| 782 GetPrefs(); | 786 GetPrefs(); |
| 783 return last_session_exit_type_; | 787 return last_session_exit_type_; |
| 784 } | 788 } |
| 785 | 789 |
| 786 policy::ManagedModePolicyProvider* ProfileImpl::GetManagedModePolicyProvider() { | 790 policy::ManagedModePolicyProvider* ProfileImpl::GetManagedModePolicyProvider() { |
| 787 #if defined(ENABLE_CONFIGURATION_POLICY) | 791 #if defined(ENABLE_MANAGED_USERS) |
| 788 return managed_mode_policy_provider_.get(); | 792 return managed_mode_policy_provider_.get(); |
| 789 #else | 793 #else |
| 790 return NULL; | 794 return NULL; |
| 791 #endif | 795 #endif |
| 792 } | 796 } |
| 793 | 797 |
| 794 policy::PolicyService* ProfileImpl::GetPolicyService() { | 798 policy::PolicyService* ProfileImpl::GetPolicyService() { |
| 795 DCHECK(policy_service_.get()); // Should explicitly be initialized. | 799 DCHECK(policy_service_.get()); // Should explicitly be initialized. |
| 796 return policy_service_.get(); | 800 return policy_service_.get(); |
| 797 } | 801 } |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1163 base::FilePath* cache_path, | 1167 base::FilePath* cache_path, |
| 1164 int* max_size) { | 1168 int* max_size) { |
| 1165 DCHECK(cache_path); | 1169 DCHECK(cache_path); |
| 1166 DCHECK(max_size); | 1170 DCHECK(max_size); |
| 1167 base::FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); | 1171 base::FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); |
| 1168 if (!path.empty()) | 1172 if (!path.empty()) |
| 1169 *cache_path = path; | 1173 *cache_path = path; |
| 1170 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : | 1174 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : |
| 1171 prefs_->GetInteger(prefs::kDiskCacheSize); | 1175 prefs_->GetInteger(prefs::kDiskCacheSize); |
| 1172 } | 1176 } |
| OLD | NEW |