OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "components/policy/core/common/preg_parser_win.h" | 5 #include "components/policy/core/common/preg_parser_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <iterator> | 10 #include <iterator> |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 | 179 |
180 std::string value_name(base::UTF16ToUTF8(value)); | 180 std::string value_name(base::UTF16ToUTF8(value)); |
181 if (!base::StartsWith(value_name, kActionTriggerPrefix, | 181 if (!base::StartsWith(value_name, kActionTriggerPrefix, |
182 base::CompareCase::SENSITIVE)) { | 182 base::CompareCase::SENSITIVE)) { |
183 scoped_ptr<base::Value> value; | 183 scoped_ptr<base::Value> value; |
184 if (DecodePRegValue(type, data, &value)) | 184 if (DecodePRegValue(type, data, &value)) |
185 dict->SetValue(value_name, value.Pass()); | 185 dict->SetValue(value_name, value.Pass()); |
186 return; | 186 return; |
187 } | 187 } |
188 | 188 |
189 std::string action_trigger(base::StringToLowerASCII(value_name.substr( | 189 std::string action_trigger(base::ToLowerASCII(value_name.substr( |
190 arraysize(kActionTriggerPrefix) - 1))); | 190 arraysize(kActionTriggerPrefix) - 1))); |
191 if (action_trigger == kActionTriggerDeleteValues) { | 191 if (action_trigger == kActionTriggerDeleteValues) { |
192 for (const std::string& value : | 192 for (const std::string& value : |
193 base::SplitString(DecodePRegStringValue(data), ";", | 193 base::SplitString(DecodePRegStringValue(data), ";", |
194 base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY)) | 194 base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY)) |
195 dict->RemoveValue(value); | 195 dict->RemoveValue(value); |
196 } else if (base::StartsWith(action_trigger, kActionTriggerDeleteKeys, | 196 } else if (base::StartsWith(action_trigger, kActionTriggerDeleteKeys, |
197 base::CompareCase::SENSITIVE)) { | 197 base::CompareCase::SENSITIVE)) { |
198 for (const std::string& key : | 198 for (const std::string& key : |
199 base::SplitString(DecodePRegStringValue(data), ";", | 199 base::SplitString(DecodePRegStringValue(data), ";", |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 } | 306 } |
307 | 307 |
308 LOG(ERROR) << "Error parsing " << file_path.value() << " at offset " | 308 LOG(ERROR) << "Error parsing " << file_path.value() << " at offset " |
309 << reinterpret_cast<const uint8*>(cursor - 1) - mapped_file.data(); | 309 << reinterpret_cast<const uint8*>(cursor - 1) - mapped_file.data(); |
310 status->Add(POLICY_LOAD_STATUS_PARSE_ERROR); | 310 status->Add(POLICY_LOAD_STATUS_PARSE_ERROR); |
311 return false; | 311 return false; |
312 } | 312 } |
313 | 313 |
314 } // namespace preg_parser | 314 } // namespace preg_parser |
315 } // namespace policy | 315 } // namespace policy |
OLD | NEW |