| 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/JSONValuesForV8.h" | 7 #include "bindings/core/v8/JSONValuesForV8.h" |
| 8 #include "bindings/core/v8/ScriptPromiseResolver.h" | 8 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 9 #include "bindings/core/v8/V8ArrayBuffer.h" | 9 #include "bindings/core/v8/V8ArrayBuffer.h" |
| 10 #include "core/dom/DOMArrayBuffer.h" | 10 #include "core/dom/DOMArrayBuffer.h" |
| 11 #include "core/dom/DOMException.h" | 11 #include "core/dom/DOMException.h" |
| 12 #include "core/dom/Document.h" | 12 #include "core/dom/Document.h" |
| 13 #include "core/dom/ExceptionCode.h" | 13 #include "core/dom/ExceptionCode.h" |
| 14 #include "core/frame/LocalDOMWindow.h" | 14 #include "core/frame/LocalDOMWindow.h" |
| 15 #include "modules/nfc/NFCError.h" | 15 #include "modules/nfc/NFCError.h" |
| 16 #include "modules/nfc/NFCMessage.h" | 16 #include "modules/nfc/NFCMessage.h" |
| 17 #include "modules/nfc/NFCPushOptions.h" | 17 #include "modules/nfc/NFCPushOptions.h" |
| 18 #include "platform/mojo/MojoHelper.h" | 18 #include "platform/mojo/MojoHelper.h" |
| 19 #include "public/platform/ServiceRegistry.h" | 19 #include "public/platform/InterfaceProvider.h" |
| 20 | 20 |
| 21 namespace nfc = device::nfc::blink; | 21 namespace nfc = device::nfc::blink; |
| 22 | 22 |
| 23 namespace { | 23 namespace { |
| 24 const char kJsonMimePrefix[] = "application/"; | 24 const char kJsonMimePrefix[] = "application/"; |
| 25 const char kJsonMimeType[] = "application/json"; | 25 const char kJsonMimeType[] = "application/json"; |
| 26 const char kOpaqueMimeType[] = "application/octet-stream"; | 26 const char kOpaqueMimeType[] = "application/octet-stream"; |
| 27 const char kPlainTextMimeType[] = "text/plain"; | 27 const char kPlainTextMimeType[] = "text/plain"; |
| 28 const char kPlainTextMimePrefix[] = "text/"; | 28 const char kPlainTextMimePrefix[] = "text/"; |
| 29 const char kCharSetUTF8[] = ";charset=UTF-8"; | 29 const char kCharSetUTF8[] = ";charset=UTF-8"; |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 } | 436 } |
| 437 | 437 |
| 438 } // anonymous namespace | 438 } // anonymous namespace |
| 439 | 439 |
| 440 NFC::NFC(LocalFrame* frame) | 440 NFC::NFC(LocalFrame* frame) |
| 441 : PageVisibilityObserver(frame->page()) | 441 : PageVisibilityObserver(frame->page()) |
| 442 , ContextLifecycleObserver(frame->document()) | 442 , ContextLifecycleObserver(frame->document()) |
| 443 , m_client(this) | 443 , m_client(this) |
| 444 { | 444 { |
| 445 ThreadState::current()->registerPreFinalizer(this); | 445 ThreadState::current()->registerPreFinalizer(this); |
| 446 frame->serviceRegistry()->connectToRemoteService(mojo::GetProxy(&m_nfc)); | 446 frame->interfaceProvider()->getInterface(mojo::GetProxy(&m_nfc)); |
| 447 m_nfc.set_connection_error_handler(convertToBaseCallback(WTF::bind(&NFC::OnC
onnectionError, wrapWeakPersistent(this)))); | 447 m_nfc.set_connection_error_handler(convertToBaseCallback(WTF::bind(&NFC::OnC
onnectionError, wrapWeakPersistent(this)))); |
| 448 m_nfc->SetClient(m_client.CreateInterfacePtrAndBind()); | 448 m_nfc->SetClient(m_client.CreateInterfacePtrAndBind()); |
| 449 } | 449 } |
| 450 | 450 |
| 451 NFC* NFC::create(LocalFrame* frame) | 451 NFC* NFC::create(LocalFrame* frame) |
| 452 { | 452 { |
| 453 NFC* nfc = new NFC(frame); | 453 NFC* nfc = new NFC(frame); |
| 454 return nfc; | 454 return nfc; |
| 455 } | 455 } |
| 456 | 456 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 } | 580 } |
| 581 | 581 |
| 582 DEFINE_TRACE(NFC) | 582 DEFINE_TRACE(NFC) |
| 583 { | 583 { |
| 584 PageVisibilityObserver::trace(visitor); | 584 PageVisibilityObserver::trace(visitor); |
| 585 ContextLifecycleObserver::trace(visitor); | 585 ContextLifecycleObserver::trace(visitor); |
| 586 visitor->trace(m_requests); | 586 visitor->trace(m_requests); |
| 587 } | 587 } |
| 588 | 588 |
| 589 } // namespace blink | 589 } // namespace blink |
| OLD | NEW |