| 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 "modules/nfc/NFC.h" | 5 #include "modules/nfc/NFC.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptPromiseResolver.h" | 7 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 8 #include "bindings/core/v8/V8ArrayBuffer.h" | 8 #include "bindings/core/v8/V8ArrayBuffer.h" |
| 9 #include "bindings/core/v8/V8StringResource.h" | 9 #include "bindings/core/v8/V8StringResource.h" |
| 10 #include "core/dom/DOMArrayBuffer.h" | 10 #include "core/dom/DOMArrayBuffer.h" |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 } | 505 } |
| 506 | 506 |
| 507 v8::Isolate* isolate = script_state->GetIsolate(); | 507 v8::Isolate* isolate = script_state->GetIsolate(); |
| 508 v8::Local<v8::String> string = V8String(isolate, string_data); | 508 v8::Local<v8::String> string = V8String(isolate, string_data); |
| 509 | 509 |
| 510 // Stringified JSON must be converted back to an Object. | 510 // Stringified JSON must be converted back to an Object. |
| 511 if (record->record_type == | 511 if (record->record_type == |
| 512 device::nfc::mojom::blink::NFCRecordType::JSON) { | 512 device::nfc::mojom::blink::NFCRecordType::JSON) { |
| 513 v8::Local<v8::Value> json_object; | 513 v8::Local<v8::Value> json_object; |
| 514 v8::TryCatch try_catch(isolate); | 514 v8::TryCatch try_catch(isolate); |
| 515 if (!V8Call(v8::JSON::Parse(isolate, string), json_object, try_catch)) { | 515 if (!v8::JSON::Parse(isolate, string).ToLocal(&json_object)) { |
| 516 return v8::Null(isolate); | 516 return v8::Null(isolate); |
| 517 } | 517 } |
| 518 | 518 |
| 519 return json_object; | 519 return json_object; |
| 520 } | 520 } |
| 521 | 521 |
| 522 return string; | 522 return string; |
| 523 } | 523 } |
| 524 | 524 |
| 525 case device::nfc::mojom::blink::NFCRecordType::OPAQUE_RECORD: { | 525 case device::nfc::mojom::blink::NFCRecordType::OPAQUE_RECORD: { |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 } | 825 } |
| 826 | 826 |
| 827 DEFINE_TRACE(NFC) { | 827 DEFINE_TRACE(NFC) { |
| 828 PageVisibilityObserver::Trace(visitor); | 828 PageVisibilityObserver::Trace(visitor); |
| 829 ContextLifecycleObserver::Trace(visitor); | 829 ContextLifecycleObserver::Trace(visitor); |
| 830 visitor->Trace(requests_); | 830 visitor->Trace(requests_); |
| 831 visitor->Trace(callbacks_); | 831 visitor->Trace(callbacks_); |
| 832 } | 832 } |
| 833 | 833 |
| 834 } // namespace blink | 834 } // namespace blink |
| OLD | NEW |