| 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 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <algorithm> | 11 #include <algorithm> |
| 12 #include <functional> | 12 #include <functional> |
| 13 #include <iterator> | 13 #include <iterator> |
| 14 #include <utility> |
| 14 #include <vector> | 15 #include <vector> |
| 15 | 16 |
| 16 #include "base/files/file_path.h" | 17 #include "base/files/file_path.h" |
| 17 #include "base/files/memory_mapped_file.h" | 18 #include "base/files/memory_mapped_file.h" |
| 18 #include "base/i18n/case_conversion.h" | 19 #include "base/i18n/case_conversion.h" |
| 19 #include "base/logging.h" | 20 #include "base/logging.h" |
| 20 #include "base/macros.h" | 21 #include "base/macros.h" |
| 21 #include "base/strings/string16.h" | 22 #include "base/strings/string16.h" |
| 22 #include "base/strings/string_split.h" | 23 #include "base/strings/string_split.h" |
| 23 #include "base/strings/string_util.h" | 24 #include "base/strings/string_util.h" |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 } | 178 } |
| 178 | 179 |
| 179 if (value.empty()) | 180 if (value.empty()) |
| 180 return; | 181 return; |
| 181 | 182 |
| 182 std::string value_name(base::UTF16ToUTF8(value)); | 183 std::string value_name(base::UTF16ToUTF8(value)); |
| 183 if (!base::StartsWith(value_name, kActionTriggerPrefix, | 184 if (!base::StartsWith(value_name, kActionTriggerPrefix, |
| 184 base::CompareCase::SENSITIVE)) { | 185 base::CompareCase::SENSITIVE)) { |
| 185 scoped_ptr<base::Value> value; | 186 scoped_ptr<base::Value> value; |
| 186 if (DecodePRegValue(type, data, &value)) | 187 if (DecodePRegValue(type, data, &value)) |
| 187 dict->SetValue(value_name, value.Pass()); | 188 dict->SetValue(value_name, std::move(value)); |
| 188 return; | 189 return; |
| 189 } | 190 } |
| 190 | 191 |
| 191 std::string action_trigger(base::ToLowerASCII(value_name.substr( | 192 std::string action_trigger(base::ToLowerASCII(value_name.substr( |
| 192 arraysize(kActionTriggerPrefix) - 1))); | 193 arraysize(kActionTriggerPrefix) - 1))); |
| 193 if (action_trigger == kActionTriggerDeleteValues) { | 194 if (action_trigger == kActionTriggerDeleteValues) { |
| 194 for (const std::string& value : | 195 for (const std::string& value : |
| 195 base::SplitString(DecodePRegStringValue(data), ";", | 196 base::SplitString(DecodePRegStringValue(data), ";", |
| 196 base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY)) | 197 base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY)) |
| 197 dict->RemoveValue(value); | 198 dict->RemoveValue(value); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 | 310 |
| 310 LOG(ERROR) << "Error parsing " << file_path.value() << " at offset " | 311 LOG(ERROR) << "Error parsing " << file_path.value() << " at offset " |
| 311 << reinterpret_cast<const uint8_t*>(cursor - 1) - | 312 << reinterpret_cast<const uint8_t*>(cursor - 1) - |
| 312 mapped_file.data(); | 313 mapped_file.data(); |
| 313 status->Add(POLICY_LOAD_STATUS_PARSE_ERROR); | 314 status->Add(POLICY_LOAD_STATUS_PARSE_ERROR); |
| 314 return false; | 315 return false; |
| 315 } | 316 } |
| 316 | 317 |
| 317 } // namespace preg_parser | 318 } // namespace preg_parser |
| 318 } // namespace policy | 319 } // namespace policy |
| OLD | NEW |