OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/safe_json/utility/safe_json_parser_mojo_impl.h" | 5 #include "components/safe_json/utility/safe_json_parser_mojo_impl.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| 11 #include "base/memory/ptr_util.h" |
11 #include "base/values.h" | 12 #include "base/values.h" |
12 #include "mojo/public/cpp/bindings/strong_binding.h" | 13 #include "mojo/public/cpp/bindings/strong_binding.h" |
13 | 14 |
14 namespace safe_json { | 15 namespace safe_json { |
15 | 16 |
16 SafeJsonParserMojoImpl::SafeJsonParserMojoImpl() = default; | 17 SafeJsonParserMojoImpl::SafeJsonParserMojoImpl() = default; |
17 | 18 |
18 SafeJsonParserMojoImpl::~SafeJsonParserMojoImpl() = default; | 19 SafeJsonParserMojoImpl::~SafeJsonParserMojoImpl() = default; |
19 | 20 |
20 // static | 21 // static |
(...skipping 10 matching lines...) Expand all Loading... |
31 std::unique_ptr<base::Value> value = base::JSONReader::ReadAndReturnError( | 32 std::unique_ptr<base::Value> value = base::JSONReader::ReadAndReturnError( |
32 json, base::JSON_PARSE_RFC, &error_code, &error); | 33 json, base::JSON_PARSE_RFC, &error_code, &error); |
33 if (value) { | 34 if (value) { |
34 callback.Run(std::move(value), base::nullopt); | 35 callback.Run(std::move(value), base::nullopt); |
35 } else { | 36 } else { |
36 callback.Run(nullptr, base::make_optional(std::move(error))); | 37 callback.Run(nullptr, base::make_optional(std::move(error))); |
37 } | 38 } |
38 } | 39 } |
39 | 40 |
40 } // namespace safe_json | 41 } // namespace safe_json |
OLD | NEW |