OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/policy/configuration_policy_pref_store.h" | 5 #include "chrome/browser/policy/configuration_policy_pref_store.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 BrowserPolicyConnector* connector = | 819 BrowserPolicyConnector* connector = |
820 g_browser_process->browser_policy_connector(); | 820 g_browser_process->browser_policy_connector(); |
821 return new ConfigurationPolicyPrefStore( | 821 return new ConfigurationPolicyPrefStore( |
822 connector->GetManagedPlatformProvider()); | 822 connector->GetManagedPlatformProvider()); |
823 } | 823 } |
824 | 824 |
825 // static | 825 // static |
826 ConfigurationPolicyPrefStore* | 826 ConfigurationPolicyPrefStore* |
827 ConfigurationPolicyPrefStore::CreateManagedCloudPolicyPrefStore( | 827 ConfigurationPolicyPrefStore::CreateManagedCloudPolicyPrefStore( |
828 Profile* profile) { | 828 Profile* profile) { |
829 ConfigurationPolicyProvider* provider = NULL; | 829 return new ConfigurationPolicyPrefStore( |
830 if (profile) { | 830 g_browser_process->managed_cloud_policy_provider()); |
831 // For user policy, return the profile's policy provider. | |
832 provider = policy::ProfilePolicyConnectorFactory::GetForProfile(profile)-> | |
833 GetManagedCloudProvider(); | |
834 } else { | |
835 // For device policy, return the provider of the browser process. | |
836 BrowserPolicyConnector* connector = | |
837 g_browser_process->browser_policy_connector(); | |
838 provider = connector->GetManagedCloudProvider(); | |
839 } | |
840 return new ConfigurationPolicyPrefStore(provider); | |
841 } | 831 } |
842 | 832 |
843 // static | 833 // static |
844 ConfigurationPolicyPrefStore* | 834 ConfigurationPolicyPrefStore* |
845 ConfigurationPolicyPrefStore::CreateRecommendedPlatformPolicyPrefStore() { | 835 ConfigurationPolicyPrefStore::CreateRecommendedPlatformPolicyPrefStore() { |
846 BrowserPolicyConnector* connector = | 836 BrowserPolicyConnector* connector = |
847 g_browser_process->browser_policy_connector(); | 837 g_browser_process->browser_policy_connector(); |
848 return new ConfigurationPolicyPrefStore( | 838 return new ConfigurationPolicyPrefStore( |
849 connector->GetRecommendedPlatformProvider()); | 839 connector->GetRecommendedPlatformProvider()); |
850 } | 840 } |
851 | 841 |
852 // static | 842 // static |
853 ConfigurationPolicyPrefStore* | 843 ConfigurationPolicyPrefStore* |
854 ConfigurationPolicyPrefStore::CreateRecommendedCloudPolicyPrefStore( | 844 ConfigurationPolicyPrefStore::CreateRecommendedCloudPolicyPrefStore() { |
855 Profile* profile) { | 845 return new ConfigurationPolicyPrefStore( |
856 ConfigurationPolicyProvider* provider = NULL; | 846 g_browser_process->recommended_cloud_policy_provider()); |
857 if (profile) { | |
858 // For user policy, return the profile's policy provider. | |
859 provider = policy::ProfilePolicyConnectorFactory::GetForProfile(profile)-> | |
860 GetRecommendedCloudProvider(); | |
861 } else { | |
862 // For device policy, return the provider of the browser process. | |
863 BrowserPolicyConnector* connector = | |
864 g_browser_process->browser_policy_connector(); | |
865 provider = connector->GetRecommendedCloudProvider(); | |
866 } | |
867 return new ConfigurationPolicyPrefStore(provider); | |
868 } | 847 } |
869 | 848 |
870 /* static */ | 849 /* static */ |
871 const ConfigurationPolicyProvider::PolicyDefinitionList* | 850 const ConfigurationPolicyProvider::PolicyDefinitionList* |
872 ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList() { | 851 ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList() { |
873 static ConfigurationPolicyProvider::PolicyDefinitionList::Entry entries[] = { | 852 static ConfigurationPolicyProvider::PolicyDefinitionList::Entry entries[] = { |
874 { kPolicyHomepageLocation, Value::TYPE_STRING, key::kHomepageLocation }, | 853 { kPolicyHomepageLocation, Value::TYPE_STRING, key::kHomepageLocation }, |
875 { kPolicyHomepageIsNewTabPage, Value::TYPE_BOOLEAN, | 854 { kPolicyHomepageIsNewTabPage, Value::TYPE_BOOLEAN, |
876 key::kHomepageIsNewTabPage }, | 855 key::kHomepageIsNewTabPage }, |
877 { kPolicyRestoreOnStartup, Value::TYPE_INTEGER, key::kRestoreOnStartup }, | 856 { kPolicyRestoreOnStartup, Value::TYPE_INTEGER, key::kRestoreOnStartup }, |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1047 // Update the initialization flag. | 1026 // Update the initialization flag. |
1048 if (!initialization_complete_ && | 1027 if (!initialization_complete_ && |
1049 provider_->IsInitializationComplete()) { | 1028 provider_->IsInitializationComplete()) { |
1050 initialization_complete_ = true; | 1029 initialization_complete_ = true; |
1051 FOR_EACH_OBSERVER(PrefStore::Observer, observers_, | 1030 FOR_EACH_OBSERVER(PrefStore::Observer, observers_, |
1052 OnInitializationCompleted(true)); | 1031 OnInitializationCompleted(true)); |
1053 } | 1032 } |
1054 } | 1033 } |
1055 | 1034 |
1056 } // namespace policy | 1035 } // namespace policy |
OLD | NEW |