| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/json_sanitizer.h" | 5 #include "components/safe_json/json_sanitizer.h" |
| 6 | 6 |
| 7 #if defined(OS_ANDROID) | 7 #if defined(OS_ANDROID) |
| 8 #error Build json_sanitizer_android.cc instead of this file on Android. | 8 #error Build json_sanitizer_android.cc instead of this file on Android. |
| 9 #endif | 9 #endif |
| 10 | 10 |
| 11 #include <memory> | 11 #include <memory> |
| 12 | 12 |
| 13 #include "base/bind.h" | 13 #include "base/bind.h" |
| 14 #include "base/callback.h" | 14 #include "base/callback.h" |
| 15 #include "base/json/json_writer.h" | 15 #include "base/json/json_writer.h" |
| 16 #include "base/macros.h" |
| 16 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| 17 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
| 18 #include "base/values.h" | 19 #include "base/values.h" |
| 20 #include "build/build_config.h" |
| 19 #include "components/safe_json/safe_json_parser.h" | 21 #include "components/safe_json/safe_json_parser.h" |
| 20 | 22 |
| 21 namespace safe_json { | 23 namespace safe_json { |
| 22 | 24 |
| 23 namespace { | 25 namespace { |
| 24 | 26 |
| 25 class OopJsonSanitizer : public JsonSanitizer { | 27 class OopJsonSanitizer : public JsonSanitizer { |
| 26 public: | 28 public: |
| 27 OopJsonSanitizer(const std::string& unsafe_json, | 29 OopJsonSanitizer(const std::string& unsafe_json, |
| 28 const StringCallback& success_callback, | 30 const StringCallback& success_callback, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 | 84 |
| 83 // static | 85 // static |
| 84 void JsonSanitizer::Sanitize(const std::string& unsafe_json, | 86 void JsonSanitizer::Sanitize(const std::string& unsafe_json, |
| 85 const StringCallback& success_callback, | 87 const StringCallback& success_callback, |
| 86 const StringCallback& error_callback) { | 88 const StringCallback& error_callback) { |
| 87 // OopJsonSanitizer destroys itself when it is finished. | 89 // OopJsonSanitizer destroys itself when it is finished. |
| 88 new OopJsonSanitizer(unsafe_json, success_callback, error_callback); | 90 new OopJsonSanitizer(unsafe_json, success_callback, error_callback); |
| 89 } | 91 } |
| 90 | 92 |
| 91 } // namespace safe_json | 93 } // namespace safe_json |
| OLD | NEW |