| 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 #import "ios/chrome/browser/payments/js_payment_request_manager.h" | 5 #import "ios/chrome/browser/payments/js_payment_request_manager.h" |
| 6 | 6 |
| 7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
| 8 #include "base/json/string_escape.h" | 8 #include "base/json/string_escape.h" |
| 9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "ios/web/public/payments/payment_request.h" | 11 #include "ios/web/public/payments/payment_request.h" |
| 12 | 12 |
| 13 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 14 #error "This file requires ARC support." |
| 15 #endif |
| 16 |
| 13 namespace { | 17 namespace { |
| 14 | 18 |
| 15 // Sanitizes |JSON| and wraps it in quotes so it can be injected safely in | 19 // Sanitizes |JSON| and wraps it in quotes so it can be injected safely in |
| 16 // JavaScript. | 20 // JavaScript. |
| 17 NSString* JSONEscape(NSString* JSON) { | 21 NSString* JSONEscape(NSString* JSON) { |
| 18 return base::SysUTF8ToNSString( | 22 return base::SysUTF8ToNSString( |
| 19 base::GetQuotedJSONString(base::SysNSStringToUTF8(JSON))); | 23 base::GetQuotedJSONString(base::SysNSStringToUTF8(JSON))); |
| 20 } | 24 } |
| 21 | 25 |
| 22 } // namespace | 26 } // namespace |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 107 |
| 104 - (NSString*)scriptPath { | 108 - (NSString*)scriptPath { |
| 105 return @"payment_request_manager"; | 109 return @"payment_request_manager"; |
| 106 } | 110 } |
| 107 | 111 |
| 108 - (NSString*)presenceBeacon { | 112 - (NSString*)presenceBeacon { |
| 109 return @"__gCrWeb.paymentRequestManager"; | 113 return @"__gCrWeb.paymentRequestManager"; |
| 110 } | 114 } |
| 111 | 115 |
| 112 @end | 116 @end |
| OLD | NEW |