| 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 return; | 176 return; |
| 177 | 177 |
| 178 std::string value_name(base::UTF16ToUTF8(value)); | 178 std::string value_name(base::UTF16ToUTF8(value)); |
| 179 if (!StartsWithASCII(value_name, kActionTriggerPrefix, true)) { | 179 if (!StartsWithASCII(value_name, kActionTriggerPrefix, true)) { |
| 180 scoped_ptr<base::Value> value; | 180 scoped_ptr<base::Value> value; |
| 181 if (DecodePRegValue(type, data, &value)) | 181 if (DecodePRegValue(type, data, &value)) |
| 182 dict->SetValue(value_name, value.Pass()); | 182 dict->SetValue(value_name, value.Pass()); |
| 183 return; | 183 return; |
| 184 } | 184 } |
| 185 | 185 |
| 186 std::string action_trigger(StringToLowerASCII(value_name.substr( | 186 std::string action_trigger(base::StringToLowerASCII(value_name.substr( |
| 187 arraysize(kActionTriggerPrefix) - 1))); | 187 arraysize(kActionTriggerPrefix) - 1))); |
| 188 if (action_trigger == kActionTriggerDeleteValues) { | 188 if (action_trigger == kActionTriggerDeleteValues) { |
| 189 std::vector<std::string> values; | 189 std::vector<std::string> values; |
| 190 Tokenize(DecodePRegStringValue(data), ";", &values); | 190 Tokenize(DecodePRegStringValue(data), ";", &values); |
| 191 for (std::vector<std::string>::const_iterator value(values.begin()); | 191 for (std::vector<std::string>::const_iterator value(values.begin()); |
| 192 value != values.end(); ++value) { | 192 value != values.end(); ++value) { |
| 193 dict->RemoveValue(*value); | 193 dict->RemoveValue(*value); |
| 194 } | 194 } |
| 195 } else if (StartsWithASCII(action_trigger, kActionTriggerDeleteKeys, true)) { | 195 } else if (StartsWithASCII(action_trigger, kActionTriggerDeleteKeys, true)) { |
| 196 std::vector<std::string> keys; | 196 std::vector<std::string> keys; |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 } | 300 } |
| 301 | 301 |
| 302 LOG(ERROR) << "Error parsing " << file_path.value() << " at offset " | 302 LOG(ERROR) << "Error parsing " << file_path.value() << " at offset " |
| 303 << reinterpret_cast<const uint8*>(cursor - 1) - mapped_file.data(); | 303 << reinterpret_cast<const uint8*>(cursor - 1) - mapped_file.data(); |
| 304 status->Add(POLICY_LOAD_STATUS_PARSE_ERROR); | 304 status->Add(POLICY_LOAD_STATUS_PARSE_ERROR); |
| 305 return false; | 305 return false; |
| 306 } | 306 } |
| 307 | 307 |
| 308 } // namespace preg_parser | 308 } // namespace preg_parser |
| 309 } // namespace policy | 309 } // namespace policy |
| OLD | NEW |