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

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

Issue 2552343009: [Presentation API] Adds DOMString[] constructor to PresentationRequest. (Closed)
Patch Set: resolve code review comments from foolip Created 3 years, 11 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/SuspendableObject.h" 9 #include "core/dom/SuspendableObject.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 "modules/presentation/PresentationPromiseProperty.h" 13 #include "modules/presentation/PresentationPromiseProperty.h"
14 #include "platform/weborigin/KURL.h" 14 #include "platform/weborigin/KURL.h"
15 #include "public/platform/WebURL.h" 15 #include "public/platform/WebURL.h"
16 #include "public/platform/WebVector.h"
16 #include "public/platform/modules/presentation/WebPresentationAvailabilityObserv er.h" 17 #include "public/platform/modules/presentation/WebPresentationAvailabilityObserv er.h"
18 #include "wtf/Vector.h"
17 19
18 namespace blink { 20 namespace blink {
19 21
20 class ExecutionContext; 22 class ExecutionContext;
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<PresentationAvailability>, 30 public ActiveScriptWrappable<PresentationAvailability>,
29 public SuspendableObject, 31 public SuspendableObject,
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 36
35 public: 37 public:
36 static PresentationAvailability* take(PresentationAvailabilityProperty*, 38 static PresentationAvailability* take(PresentationAvailabilityProperty*,
37 const KURL&, 39 const WTF::Vector<KURL>&,
38 bool); 40 bool);
39 ~PresentationAvailability() override; 41 ~PresentationAvailability() override;
40 42
41 // EventTarget implementation. 43 // EventTarget implementation.
42 const AtomicString& interfaceName() const override; 44 const AtomicString& interfaceName() const override;
43 ExecutionContext* getExecutionContext() const override; 45 ExecutionContext* getExecutionContext() const override;
44 46
45 // WebPresentationAvailabilityObserver implementation. 47 // WebPresentationAvailabilityObserver implementation.
46 void availabilityChanged(bool) override; 48 void availabilityChanged(bool) override;
47 const WebURL url() const override; 49 const WebVector<WebURL>& urls() const override;
48 50
49 // ScriptWrappable implementation. 51 // ScriptWrappable implementation.
50 bool hasPendingActivity() const final; 52 bool hasPendingActivity() const final;
51 53
52 // SuspendableObject implementation. 54 // SuspendableObject implementation.
53 void suspend() override; 55 void suspend() override;
54 void resume() override; 56 void resume() override;
55 void contextDestroyed() override; 57 void contextDestroyed() override;
56 58
57 // PageVisibilityObserver implementation. 59 // PageVisibilityObserver implementation.
(...skipping 14 matching lines...) Expand all
72 // Current state of the SuspendableObject. It is Active when created. It 74 // Current state of the SuspendableObject. It is Active when created. It
73 // becomes Suspended when suspend() is called and moves back to Active if 75 // becomes Suspended when suspend() is called and moves back to Active if
74 // resume() is called. It becomes Inactive when stop() is called or at 76 // resume() is called. It becomes Inactive when stop() is called or at
75 // destruction time. 77 // destruction time.
76 enum class State : char { 78 enum class State : char {
77 Active, 79 Active,
78 Suspended, 80 Suspended,
79 Inactive, 81 Inactive,
80 }; 82 };
81 83
82 PresentationAvailability(ExecutionContext*, const KURL&, bool); 84 PresentationAvailability(ExecutionContext*, const WTF::Vector<KURL>&, bool);
83 85
84 void setState(State); 86 void setState(State);
85 void updateListening(); 87 void updateListening();
86 88
87 const KURL m_url; 89 WebVector<WebURL> m_urls;
88 bool m_value; 90 bool m_value;
89 State m_state; 91 State m_state;
90 }; 92 };
91 93
92 } // namespace blink 94 } // namespace blink
93 95
94 #endif // PresentationAvailability_h 96 #endif // PresentationAvailability_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698