Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(400)

Side by Side Diff: third_party/WebKit/Source/modules/nfc/NFC.cpp

Issue 1444303002: [webnfc] Align NFC interface with latest specification. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use default destructor for !ENABLE(OILPAN) builds Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "config.h" 5 #include "config.h"
6 #include "modules/nfc/NFC.h" 6 #include "modules/nfc/NFC.h"
7 7
8 #include "bindings/core/v8/ScriptPromiseResolver.h" 8 #include "bindings/core/v8/ScriptPromiseResolver.h"
9 #include "core/dom/DOMException.h" 9 #include "core/dom/DOMException.h"
10 #include "core/dom/ExceptionCode.h" 10 #include "core/dom/ExceptionCode.h"
11 #include "modules/nfc/NFCMessage.h"
12 #include "modules/nfc/NFCPushOptions.h"
11 13
12 namespace blink { 14 namespace blink {
13 15
14 NFC::NFC(LocalFrame* frame) 16 NFC::NFC(LocalFrame* frame)
15 : LocalFrameLifecycleObserver(frame) 17 : LocalFrameLifecycleObserver(frame)
16 , PageLifecycleObserver(frame ? frame->page() : 0) 18 , PageLifecycleObserver(frame ? frame->page() : 0)
17 { 19 {
18 } 20 }
19 21
20 NFC* NFC::create(LocalFrame* frame) 22 NFC* NFC::create(LocalFrame* frame)
21 { 23 {
22 NFC* nfc = new NFC(frame); 24 NFC* nfc = new NFC(frame);
23 return nfc; 25 return nfc;
24 } 26 }
25 27
26 NFC::~NFC() 28 ScriptPromise NFC::push(ScriptState* scriptState, const NFCPushMessage& records, const NFCPushOptions& options)
27 { 29 {
28 } 30 // TODO(shalamov): To be implemented
29
30 ScriptPromise NFC::requestAdapter(ScriptState* scriptState)
31 {
32 // TODO(riju): To be implemented.
33 return ScriptPromise::rejectWithDOMException(scriptState, DOMException::crea te(NotSupportedError)); 31 return ScriptPromise::rejectWithDOMException(scriptState, DOMException::crea te(NotSupportedError));
34 } 32 }
35 33
34 ScriptPromise NFC::cancelPush(ScriptState* scriptState, const String& target)
35 {
36 // TODO(shalamov): To be implemented
37 return ScriptPromise::rejectWithDOMException(scriptState, DOMException::crea te(NotSupportedError));
38 }
39
40 ScriptPromise NFC::watch(ScriptState* scriptState, MessageCallback* callback, co nst NFCWatchOptions& options)
41 {
42 // todo(shalamov): To be implemented
riju_ 2015/11/16 15:05:01 nit: s/todo/TODO and a . at the end.
shalamov 2015/11/19 12:59:06 Done.
43 return ScriptPromise::rejectWithDOMException(scriptState, DOMException::crea te(NotSupportedError));
44 }
45
46 ScriptPromise NFC::cancelWatch(ScriptState* scriptState, long id)
47 {
48 // todo(shalamov): To be implemented
riju_ 2015/11/16 15:05:01 nit: same as above.
shalamov 2015/11/19 12:59:06 Done.
49 return ScriptPromise::rejectWithDOMException(scriptState, DOMException::crea te(NotSupportedError));
50 }
51
52 ScriptPromise NFC::cancelWatch(ScriptState* scriptState)
53 {
54 // todo(shalamov): To be implemented
riju_ 2015/11/16 15:05:01 nit: same as above.
shalamov 2015/11/19 12:59:06 Done.
55 return ScriptPromise::rejectWithDOMException(scriptState, DOMException::crea te(NotSupportedError));
56 }
57
36 void NFC::willDetachFrameHost() 58 void NFC::willDetachFrameHost()
37 { 59 {
38 // TODO(shalamov): To be implemented. 60 // TODO(shalamov): To be implemented.
39 } 61 }
40 62
41 void NFC::pageVisibilityChanged() 63 void NFC::pageVisibilityChanged()
42 { 64 {
43 // TODO(shalamov): To be implemented. When visibility is lost, 65 // TODO(shalamov): To be implemented. When visibility is lost,
44 // NFC operations should be suspended. 66 // NFC operations should be suspended.
45 // https://w3c.github.io/web-nfc/#nfc-suspended 67 // https://w3c.github.io/web-nfc/#nfc-suspended
46 } 68 }
47 69
48 DEFINE_TRACE(NFC) 70 DEFINE_TRACE(NFC)
49 { 71 {
50 LocalFrameLifecycleObserver::trace(visitor); 72 LocalFrameLifecycleObserver::trace(visitor);
51 PageLifecycleObserver::trace(visitor); 73 PageLifecycleObserver::trace(visitor);
52 } 74 }
53 75
54 } // namespace blink 76 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698