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

Unified Diff: chrome/browser/policy/configuration_policy_handler_chromeos.cc

Issue 10316022: Wire up the policy for controlling pinned apps in the ash launcher. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 7 months 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 side-by-side diff with in-line comments
Download patch
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..1f68bb58628e380008127735073e3b5e1e4f0b47 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_controller.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 base::DictionaryValue();
+ app_dict->SetString(ChromeLauncherController::kPinnedAppsPrefAppIDPath,
+ id);
+ pinned_apps_list->Append(app_dict);
+ }
+ }
+ prefs->SetValue(pref_path(), pinned_apps_list);
+ }
+}
+
} // namespace policy

Powered by Google App Engine
This is Rietveld 408576698