| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #ifndef COMPONENTS_SAFE_JSON_SAFE_JSON_PARSER_IMPL_H_ | 5 #ifndef COMPONENTS_SAFE_JSON_SAFE_JSON_PARSER_IMPL_H_ |
| 6 #define COMPONENTS_SAFE_JSON_SAFE_JSON_PARSER_IMPL_H_ | 6 #define COMPONENTS_SAFE_JSON_SAFE_JSON_PARSER_IMPL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/threading/thread_checker.h" | 14 #include "base/threading/thread_checker.h" |
| 15 #include "components/safe_json/public/interfaces/safe_json.mojom.h" | 15 #include "components/safe_json/public/interfaces/safe_json.mojom.h" |
| 16 #include "components/safe_json/safe_json_parser.h" | 16 #include "components/safe_json/safe_json_parser.h" |
| 17 #include "content/public/browser/utility_process_host_client.h" | 17 #include "content/public/browser/utility_process_host_client.h" |
| 18 | 18 |
| 19 namespace base { | 19 namespace base { |
| 20 class ListValue; | 20 class ListValue; |
| 21 class SequencedTaskRunner; | 21 class TaskRunner; |
| 22 class Value; | 22 class Value; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace content { | 25 namespace content { |
| 26 class UtilityProcessHost; | 26 class UtilityProcessHost; |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace IPC { | 29 namespace IPC { |
| 30 class Message; | 30 class Message; |
| 31 } | 31 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 52 | 52 |
| 53 // SafeJsonParser implementation. | 53 // SafeJsonParser implementation. |
| 54 void Start() override; | 54 void Start() override; |
| 55 | 55 |
| 56 // mojom::SafeJsonParser::Parse callback. | 56 // mojom::SafeJsonParser::Parse callback. |
| 57 void OnParseDone(const base::ListValue& wrapper, mojo::String error); | 57 void OnParseDone(const base::ListValue& wrapper, mojo::String error); |
| 58 | 58 |
| 59 const std::string unsafe_json_; | 59 const std::string unsafe_json_; |
| 60 SuccessCallback success_callback_; | 60 SuccessCallback success_callback_; |
| 61 ErrorCallback error_callback_; | 61 ErrorCallback error_callback_; |
| 62 scoped_refptr<base::SequencedTaskRunner> caller_task_runner_; | 62 scoped_refptr<base::TaskRunner> caller_task_runner_; |
| 63 | 63 |
| 64 std::unique_ptr<base::Value> parsed_json_; | 64 std::unique_ptr<base::Value> parsed_json_; |
| 65 std::string error_; | 65 std::string error_; |
| 66 | 66 |
| 67 base::WeakPtr<content::UtilityProcessHost> utility_process_host_; | 67 base::WeakPtr<content::UtilityProcessHost> utility_process_host_; |
| 68 | 68 |
| 69 mojom::SafeJsonParserPtr service_; | 69 mojom::SafeJsonParserPtr service_; |
| 70 | 70 |
| 71 // To ensure the UtilityProcessHost and Mojo service are only accessed on the | 71 // To ensure the UtilityProcessHost and Mojo service are only accessed on the |
| 72 // IO thread. | 72 // IO thread. |
| 73 base::ThreadChecker io_thread_checker_; | 73 base::ThreadChecker io_thread_checker_; |
| 74 | 74 |
| 75 DISALLOW_COPY_AND_ASSIGN(SafeJsonParserImpl); | 75 DISALLOW_COPY_AND_ASSIGN(SafeJsonParserImpl); |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 } // namespace safe_json | 78 } // namespace safe_json |
| 79 | 79 |
| 80 #endif // COMPONENTS_SAFE_JSON_SAFE_JSON_PARSER_IMPL_H_ | 80 #endif // COMPONENTS_SAFE_JSON_SAFE_JSON_PARSER_IMPL_H_ |
| OLD | NEW |