Index: chrome/browser/policy/configuration_policy_handler_chromeos.cc |
diff --git a/chrome/browser/policy/configuration_policy_handler_chromeos.cc b/chrome/browser/policy/configuration_policy_handler_chromeos.cc |
index 2ad265556af51388961617b4304726ec11a2cb06..b709baf1fbb9a97446799aa4692ad1b32c233c52 100644 |
--- a/chrome/browser/policy/configuration_policy_handler_chromeos.cc |
+++ b/chrome/browser/policy/configuration_policy_handler_chromeos.cc |
@@ -13,7 +13,11 @@ |
#include "chrome/browser/chromeos/cros/onc_network_parser.h" |
#include "chrome/browser/policy/policy_error_map.h" |
#include "chrome/browser/policy/policy_map.h" |
+#include "chrome/browser/prefs/pref_value_map.h" |
+#include "chrome/browser/ui/views/ash/launcher/chrome_launcher_delegate.h" |
+#include "chrome/common/pref_names.h" |
#include "grit/generated_resources.h" |
+#include "policy/policy_constants.h" |
namespace policy { |
@@ -125,4 +129,33 @@ void NetworkConfigurationPolicyHandler::StripSensitiveValues( |
} |
} |
+PinnedLauncherAppsPolicyHandler::PinnedLauncherAppsPolicyHandler() |
+ : ExtensionListPolicyHandler(key::kPinnedLauncherApps, |
+ prefs::kPinnedLauncherApps, |
+ false) {} |
+ |
+PinnedLauncherAppsPolicyHandler::~PinnedLauncherAppsPolicyHandler() {} |
+ |
+void PinnedLauncherAppsPolicyHandler::ApplyPolicySettings( |
+ const PolicyMap& policies, |
+ PrefValueMap* prefs) { |
+ PolicyErrorMap errors; |
+ const base::Value* policy_value = policies.GetValue(policy_name()); |
+ const base::ListValue* policy_list = NULL; |
+ if (policy_value && policy_value->GetAsList(&policy_list) && policy_list) { |
+ base::ListValue* pinned_apps_list = new base::ListValue(); |
+ for (base::ListValue::const_iterator entry(policy_list->begin()); |
+ entry != policy_list->end(); ++entry) { |
+ std::string id; |
+ if ((*entry)->GetAsString(&id)) { |
+ base::DictionaryValue* app_dict = new DictionaryValue(); |
Joao da Silva
2012/05/03 18:41:22
nit: base::Dictionary
Mattias Nissler (ping if slow)
2012/05/03 20:13:04
Done.
|
+ app_dict->SetString(ChromeLauncherDelegate::kPinnedAppsPrefAppIDPath, |
+ id); |
+ pinned_apps_list->Append(app_dict); |
+ } |
+ } |
+ prefs->SetValue(pref_path(), pinned_apps_list); |
+ } |
+} |
+ |
} // namespace policy |