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

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

Issue 2138663003: Rename PageLifecycleObserver to PageVisibilityObserver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months 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 #ifndef NFC_h 5 #ifndef NFC_h
6 #define NFC_h 6 #define NFC_h
7 7
8 #include "bindings/core/v8/ScriptPromise.h" 8 #include "bindings/core/v8/ScriptPromise.h"
9 #include "bindings/core/v8/ScriptWrappable.h" 9 #include "bindings/core/v8/ScriptWrappable.h"
10 #include "bindings/modules/v8/StringOrArrayBufferOrNFCMessage.h" 10 #include "bindings/modules/v8/StringOrArrayBufferOrNFCMessage.h"
11 #include "core/dom/ContextLifecycleObserver.h" 11 #include "core/dom/ContextLifecycleObserver.h"
12 #include "core/page/PageLifecycleObserver.h" 12 #include "core/page/PageVisibilityObserver.h"
13 #include "device/nfc/nfc.mojom-blink.h" 13 #include "device/nfc/nfc.mojom-blink.h"
14 #include "mojo/public/cpp/bindings/binding.h" 14 #include "mojo/public/cpp/bindings/binding.h"
15 15
16 namespace blink { 16 namespace blink {
17 17
18 class MessageCallback; 18 class MessageCallback;
19 class NFCError; 19 class NFCError;
20 class NFCPushOptions; 20 class NFCPushOptions;
21 using NFCPushMessage = StringOrArrayBufferOrNFCMessage; 21 using NFCPushMessage = StringOrArrayBufferOrNFCMessage;
22 class NFCWatchOptions; 22 class NFCWatchOptions;
23 class ServiceRegistry; 23 class ServiceRegistry;
24 24
25 class NFC final 25 class NFC final
26 : public GarbageCollectedFinalized<NFC> 26 : public GarbageCollectedFinalized<NFC>
27 , public ScriptWrappable 27 , public ScriptWrappable
28 , public PageLifecycleObserver 28 , public PageVisibilityObserver
29 , public ContextLifecycleObserver 29 , public ContextLifecycleObserver
30 , public device::nfc::blink::NFCClient { 30 , public device::nfc::blink::NFCClient {
31 DEFINE_WRAPPERTYPEINFO(); 31 DEFINE_WRAPPERTYPEINFO();
32 USING_GARBAGE_COLLECTED_MIXIN(NFC); 32 USING_GARBAGE_COLLECTED_MIXIN(NFC);
33 USING_PRE_FINALIZER(NFC, dispose); 33 USING_PRE_FINALIZER(NFC, dispose);
34 34
35 public: 35 public:
36 static NFC* create(LocalFrame*); 36 static NFC* create(LocalFrame*);
37 37
38 virtual ~NFC(); 38 virtual ~NFC();
(...skipping 11 matching lines...) Expand all
50 50
51 // Starts watching for NFC messages that match NFCWatchOptions criteria. 51 // Starts watching for NFC messages that match NFCWatchOptions criteria.
52 ScriptPromise watch(ScriptState*, MessageCallback*, const NFCWatchOptions&); 52 ScriptPromise watch(ScriptState*, MessageCallback*, const NFCWatchOptions&);
53 53
54 // Cancels watch operation with id. 54 // Cancels watch operation with id.
55 ScriptPromise cancelWatch(ScriptState*, long id); 55 ScriptPromise cancelWatch(ScriptState*, long id);
56 56
57 // Cancels all watch operations. 57 // Cancels all watch operations.
58 ScriptPromise cancelWatch(ScriptState*); 58 ScriptPromise cancelWatch(ScriptState*);
59 59
60 // Implementation of PageLifecycleObserver. 60 // Implementation of PageVisibilityObserver.
61 void pageVisibilityChanged() override; 61 void pageVisibilityChanged() override;
62 62
63 // Interface required by garbage collection. 63 // Interface required by garbage collection.
64 DECLARE_VIRTUAL_TRACE(); 64 DECLARE_VIRTUAL_TRACE();
65 65
66 private: 66 private:
67 void OnRequestCompleted(ScriptPromiseResolver*, device::nfc::blink::NFCError Ptr); 67 void OnRequestCompleted(ScriptPromiseResolver*, device::nfc::blink::NFCError Ptr);
68 void OnConnectionError(); 68 void OnConnectionError();
69 69
70 // device::nfc::blink::NFCClient implementation. 70 // device::nfc::blink::NFCClient implementation.
71 void OnWatch(mojo::WTFArray<uint32_t> ids, device::nfc::blink::NFCMessagePtr ) override; 71 void OnWatch(mojo::WTFArray<uint32_t> ids, device::nfc::blink::NFCMessagePtr ) override;
72 72
73 private: 73 private:
74 explicit NFC(LocalFrame*); 74 explicit NFC(LocalFrame*);
75 device::nfc::blink::NFCPtr m_nfc; 75 device::nfc::blink::NFCPtr m_nfc;
76 mojo::Binding<device::nfc::blink::NFCClient> m_client; 76 mojo::Binding<device::nfc::blink::NFCClient> m_client;
77 HeapHashSet<Member<ScriptPromiseResolver>> m_requests; 77 HeapHashSet<Member<ScriptPromiseResolver>> m_requests;
78 }; 78 };
79 79
80 } // namespace blink 80 } // namespace blink
81 81
82 #endif // NFC_h 82 #endif // NFC_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/geolocation/Geolocation.cpp ('k') | third_party/WebKit/Source/modules/nfc/NFC.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698