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

Side by Side Diff: third_party/WebKit/Source/modules/remoteplayback/RemotePlayback.h

Issue 2480003002: [RemotePlayback] Keep track of source compatibility and reject prompt() correspondingly (Closed)
Patch Set: Fixed failing tests Created 4 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 RemotePlayback_h 5 #ifndef RemotePlayback_h
6 #define RemotePlayback_h 6 #define RemotePlayback_h
7 7
8 #include "bindings/core/v8/ActiveScriptWrappable.h" 8 #include "bindings/core/v8/ActiveScriptWrappable.h"
9 #include "bindings/core/v8/ScriptPromise.h" 9 #include "bindings/core/v8/ScriptPromise.h"
10 #include "bindings/core/v8/ScriptState.h" 10 #include "bindings/core/v8/ScriptState.h"
(...skipping 10 matching lines...) Expand all
21 namespace blink { 21 namespace blink {
22 22
23 class ExecutionContext; 23 class ExecutionContext;
24 class HTMLMediaElement; 24 class HTMLMediaElement;
25 class RemotePlaybackAvailabilityCallback; 25 class RemotePlaybackAvailabilityCallback;
26 class ScriptPromiseResolver; 26 class ScriptPromiseResolver;
27 27
28 class MODULES_EXPORT RemotePlayback final 28 class MODULES_EXPORT RemotePlayback final
29 : public EventTargetWithInlineData, 29 : public EventTargetWithInlineData,
30 public ActiveScriptWrappable, 30 public ActiveScriptWrappable,
31 WTF_NON_EXPORTED_BASE(private WebRemotePlaybackClient) { 31 WTF_NON_EXPORTED_BASE(public WebRemotePlaybackClient) {
32 DEFINE_WRAPPERTYPEINFO(); 32 DEFINE_WRAPPERTYPEINFO();
33 USING_GARBAGE_COLLECTED_MIXIN(RemotePlayback); 33 USING_GARBAGE_COLLECTED_MIXIN(RemotePlayback);
34 34
35 public: 35 public:
36 static RemotePlayback* create(ScriptState*, HTMLMediaElement&); 36 static RemotePlayback* create(ScriptState*, HTMLMediaElement&);
37 37
38 // Notifies this object that disableRemotePlayback attribute was set on the 38 // Notifies this object that disableRemotePlayback attribute was set on the
39 // corresponding media element. 39 // corresponding media element.
40 void remotePlaybackDisabled(); 40 void remotePlaybackDisabled();
41 41
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 friend class RemotePlaybackTest; 76 friend class RemotePlaybackTest;
77 77
78 explicit RemotePlayback(ScriptState*, HTMLMediaElement&); 78 explicit RemotePlayback(ScriptState*, HTMLMediaElement&);
79 79
80 // Calls the specified availability callback with the current availability. 80 // Calls the specified availability callback with the current availability.
81 // Need a void() method to post it as a task. 81 // Need a void() method to post it as a task.
82 void notifyInitialAvailability(int callbackId); 82 void notifyInitialAvailability(int callbackId);
83 83
84 // WebRemotePlaybackClient implementation. 84 // WebRemotePlaybackClient implementation.
85 void stateChanged(WebRemotePlaybackState) override; 85 void stateChanged(WebRemotePlaybackState) override;
86 void availabilityChanged(bool available) override; 86 void availabilityChanged(bool isRouteAvailable,
87 bool isSourceCompatible) override;
87 void promptCancelled() override; 88 void promptCancelled() override;
89 bool remotePlaybackAvailable() const override;
88 90
89 // Prevent v8 from garbage collecting the availability callbacks. 91 // Prevent v8 from garbage collecting the availability callbacks.
90 // TODO(avayvod): remove when crbug.com/468240 is fixed and the references 92 // TODO(avayvod): remove when crbug.com/468240 is fixed and the references
91 // are maintained automatically. 93 // are maintained automatically.
92 void setV8ReferencesForCallbacks(v8::Isolate*, 94 void setV8ReferencesForCallbacks(v8::Isolate*,
93 const v8::Persistent<v8::Object>& wrapper); 95 const v8::Persistent<v8::Object>& wrapper);
94 96
95 RefPtr<ScriptState> m_scriptState; 97 RefPtr<ScriptState> m_scriptState;
96 WebRemotePlaybackState m_state; 98 WebRemotePlaybackState m_state;
97 bool m_availability; 99 bool m_routeAvailable;
100 bool m_sourceCompatible;
98 HeapHashMap<int, TraceWrapperMember<RemotePlaybackAvailabilityCallback>> 101 HeapHashMap<int, TraceWrapperMember<RemotePlaybackAvailabilityCallback>>
99 m_availabilityCallbacks; 102 m_availabilityCallbacks;
100 Member<HTMLMediaElement> m_mediaElement; 103 Member<HTMLMediaElement> m_mediaElement;
101 Member<ScriptPromiseResolver> m_promptPromiseResolver; 104 Member<ScriptPromiseResolver> m_promptPromiseResolver;
102 }; 105 };
103 106
104 } // namespace blink 107 } // namespace blink
105 108
106 #endif // RemotePlayback_h 109 #endif // RemotePlayback_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698