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/policy/configuration_policy_handler_chromeos.h" | 5 #include "chrome/browser/policy/configuration_policy_handler_chromeos.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
13 #include "chrome/browser/chromeos/cros/onc_network_parser.h" | 13 #include "chrome/browser/chromeos/cros/onc_network_parser.h" |
14 #include "chrome/browser/policy/policy_error_map.h" | 14 #include "chrome/browser/policy/policy_error_map.h" |
15 #include "chrome/browser/policy/policy_map.h" | 15 #include "chrome/browser/policy/policy_map.h" |
16 #include "chrome/browser/prefs/pref_value_map.h" | |
17 #include "chrome/browser/ui/views/ash/launcher/chrome_launcher_delegate.h" | |
18 #include "chrome/common/pref_names.h" | |
16 #include "grit/generated_resources.h" | 19 #include "grit/generated_resources.h" |
20 #include "policy/policy_constants.h" | |
17 | 21 |
18 namespace policy { | 22 namespace policy { |
19 | 23 |
20 NetworkConfigurationPolicyHandler::NetworkConfigurationPolicyHandler( | 24 NetworkConfigurationPolicyHandler::NetworkConfigurationPolicyHandler( |
21 const char* policy_name, | 25 const char* policy_name, |
22 chromeos::NetworkUIData::ONCSource onc_source) | 26 chromeos::NetworkUIData::ONCSource onc_source) |
23 : TypeCheckingPolicyHandler(policy_name, Value::TYPE_STRING), | 27 : TypeCheckingPolicyHandler(policy_name, Value::TYPE_STRING), |
24 onc_source_(onc_source) {} | 28 onc_source_(onc_source) {} |
25 | 29 |
26 NetworkConfigurationPolicyHandler::~NetworkConfigurationPolicyHandler() {} | 30 NetworkConfigurationPolicyHandler::~NetworkConfigurationPolicyHandler() {} |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
118 static const char kPlaceholder[] = "********"; | 122 static const char kPlaceholder[] = "********"; |
119 | 123 |
120 for (size_t i = 0; i < arraysize(kFilteredSettings); ++i) { | 124 for (size_t i = 0; i < arraysize(kFilteredSettings); ++i) { |
121 if (network_dict->Remove(kFilteredSettings[i], NULL)) { | 125 if (network_dict->Remove(kFilteredSettings[i], NULL)) { |
122 network_dict->Set(kFilteredSettings[i], | 126 network_dict->Set(kFilteredSettings[i], |
123 Value::CreateStringValue(kPlaceholder)); | 127 Value::CreateStringValue(kPlaceholder)); |
124 } | 128 } |
125 } | 129 } |
126 } | 130 } |
127 | 131 |
132 PinnedLauncherAppsPolicyHandler::PinnedLauncherAppsPolicyHandler() | |
133 : ExtensionListPolicyHandler(key::kPinnedLauncherApps, | |
134 prefs::kPinnedLauncherApps, | |
135 false) {} | |
136 | |
137 PinnedLauncherAppsPolicyHandler::~PinnedLauncherAppsPolicyHandler() {} | |
138 | |
139 void PinnedLauncherAppsPolicyHandler::ApplyPolicySettings( | |
140 const PolicyMap& policies, | |
141 PrefValueMap* prefs) { | |
142 PolicyErrorMap errors; | |
143 const base::Value* policy_value = policies.GetValue(policy_name()); | |
144 const base::ListValue* policy_list = NULL; | |
145 if (policy_value && policy_value->GetAsList(&policy_list) && policy_list) { | |
146 base::ListValue* pinned_apps_list = new base::ListValue(); | |
147 for (base::ListValue::const_iterator entry(policy_list->begin()); | |
148 entry != policy_list->end(); ++entry) { | |
149 std::string id; | |
150 if ((*entry)->GetAsString(&id)) { | |
151 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.
| |
152 app_dict->SetString(ChromeLauncherDelegate::kPinnedAppsPrefAppIDPath, | |
153 id); | |
154 pinned_apps_list->Append(app_dict); | |
155 } | |
156 } | |
157 prefs->SetValue(pref_path(), pinned_apps_list); | |
158 } | |
159 } | |
160 | |
128 } // namespace policy | 161 } // namespace policy |
OLD | NEW |