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

Side by Side Diff: third_party/WebKit/Source/modules/presentation/PresentationAvailability.h

Issue 2148643002: [Presentation API] Adds DOMString[] constructor to PresentationRequest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix LayoutTests 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 PresentationAvailability_h 5 #ifndef PresentationAvailability_h
6 #define PresentationAvailability_h 6 #define PresentationAvailability_h
7 7
8 #include "bindings/core/v8/ActiveScriptWrappable.h" 8 #include "bindings/core/v8/ActiveScriptWrappable.h"
9 #include "core/dom/ActiveDOMObject.h" 9 #include "core/dom/ActiveDOMObject.h"
10 #include "core/events/EventTarget.h" 10 #include "core/events/EventTarget.h"
11 #include "core/page/PageVisibilityObserver.h" 11 #include "core/page/PageVisibilityObserver.h"
12 #include "modules/ModulesExport.h" 12 #include "modules/ModulesExport.h"
13 #include "platform/weborigin/KURL.h" 13 #include "platform/weborigin/KURL.h"
14 #include "public/platform/WebURL.h" 14 #include "public/platform/WebURL.h"
15 #include "public/platform/WebVector.h"
15 #include "public/platform/modules/presentation/WebPresentationAvailabilityObserv er.h" 16 #include "public/platform/modules/presentation/WebPresentationAvailabilityObserv er.h"
17 #include "wtf/Vector.h"
16 18
17 namespace blink { 19 namespace blink {
18 20
19 class ExecutionContext; 21 class ExecutionContext;
20 class ScriptPromiseResolver; 22 class ScriptPromiseResolver;
21 23
22 // Expose whether there is a presentation display available for |url|. The 24 // Expose whether there is a presentation display available for |url|. The
23 // object will be initialized with a default value passed via ::take() and will 25 // object will be initialized with a default value passed via ::take() and will
24 // then subscribe to receive callbacks if the status for |url| were to 26 // then subscribe to receive callbacks if the status for |url| were to
25 // change. The object will only listen to changes when required. 27 // change. The object will only listen to changes when required.
26 class MODULES_EXPORT PresentationAvailability final 28 class MODULES_EXPORT PresentationAvailability final
27 : public EventTargetWithInlineData 29 : public EventTargetWithInlineData
28 , public ActiveScriptWrappable 30 , public ActiveScriptWrappable
29 , public ActiveDOMObject 31 , public ActiveDOMObject
30 , public PageVisibilityObserver 32 , public PageVisibilityObserver
31 , public WebPresentationAvailabilityObserver { 33 , public WebPresentationAvailabilityObserver {
32 USING_GARBAGE_COLLECTED_MIXIN(PresentationAvailability); 34 USING_GARBAGE_COLLECTED_MIXIN(PresentationAvailability);
33 DEFINE_WRAPPERTYPEINFO(); 35 DEFINE_WRAPPERTYPEINFO();
34 public: 36 public:
35 static PresentationAvailability* take(ScriptPromiseResolver*, const KURL&, b ool); 37 static PresentationAvailability* take(ScriptPromiseResolver*, const WTF::Vec tor<KURL>&, bool);
36 ~PresentationAvailability() override; 38 ~PresentationAvailability() override;
37 39
38 // EventTarget implementation. 40 // EventTarget implementation.
39 const AtomicString& interfaceName() const override; 41 const AtomicString& interfaceName() const override;
40 ExecutionContext* getExecutionContext() const override; 42 ExecutionContext* getExecutionContext() const override;
41 43
42 // WebPresentationAvailabilityObserver implementation. 44 // WebPresentationAvailabilityObserver implementation.
43 void availabilityChanged(bool) override; 45 void availabilityChanged(bool) override;
44 const WebURL url() const override; 46 const WebVector<WebURL>& urls() const override;
45 47
46 // ActiveScriptWrappable implementation. 48 // ActiveScriptWrappable implementation.
47 bool hasPendingActivity() const final; 49 bool hasPendingActivity() const final;
48 50
49 // ActiveDOMObject implementation. 51 // ActiveDOMObject implementation.
50 void suspend() override; 52 void suspend() override;
51 void resume() override; 53 void resume() override;
52 void stop() override; 54 void stop() override;
53 55
54 // PageVisibilityObserver implementation. 56 // PageVisibilityObserver implementation.
(...skipping 13 matching lines...) Expand all
68 // Current state of the ActiveDOMObject. It is Active when created. It 70 // Current state of the ActiveDOMObject. It is Active when created. It
69 // becomes Suspended when suspend() is called and moves back to Active if 71 // becomes Suspended when suspend() is called and moves back to Active if
70 // resume() is called. It becomes Inactive when stop() is called or at 72 // resume() is called. It becomes Inactive when stop() is called or at
71 // destruction time. 73 // destruction time.
72 enum class State : char { 74 enum class State : char {
73 Active, 75 Active,
74 Suspended, 76 Suspended,
75 Inactive, 77 Inactive,
76 }; 78 };
77 79
78 PresentationAvailability(ExecutionContext*, const KURL&, bool); 80 PresentationAvailability(ExecutionContext*, const WTF::Vector<KURL>&, bool);
79 81
80 void setState(State); 82 void setState(State);
81 void updateListening(); 83 void updateListening();
82 84
83 const KURL m_url; 85 WebVector<WebURL> m_urls;
84 bool m_value; 86 bool m_value;
85 State m_state; 87 State m_state;
86 }; 88 };
87 89
88 } // namespace blink 90 } // namespace blink
89 91
90 #endif // PresentationAvailability_h 92 #endif // PresentationAvailability_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698