Chromium Code Reviews| Index: third_party/WebKit/Source/modules/remoteplayback/RemotePlayback.cpp |
| diff --git a/third_party/WebKit/Source/modules/remoteplayback/RemotePlayback.cpp b/third_party/WebKit/Source/modules/remoteplayback/RemotePlayback.cpp |
| index f8f23bc6320c42579794fc092e8dc11f6d53862f..ea5973d73f0f58420d1f300b5821c04d867b706e 100644 |
| --- a/third_party/WebKit/Source/modules/remoteplayback/RemotePlayback.cpp |
| +++ b/third_party/WebKit/Source/modules/remoteplayback/RemotePlayback.cpp |
| @@ -179,12 +179,8 @@ ScriptPromise RemotePlayback::prompt() { |
| m_promptPromiseResolver = resolver; |
| m_mediaElement->requestRemotePlayback(); |
| } else { |
| + m_promptPromiseResolver = resolver; |
| m_mediaElement->requestRemotePlaybackControl(); |
| - // TODO(avayvod): Need to keep the resolver until user chooses to stop |
| - // the remote playback (resolve) or dismisses the UI (reject). |
| - // Steps 11 and 12 of the prompt() algorithm. |
| - // https://crbug.com/647441 |
| - resolver->resolve(); |
| } |
| return promise; |
| @@ -212,14 +208,16 @@ void RemotePlayback::stateChanged(WebRemotePlaybackState state) { |
| // We may get a "disconnected" state change while in the "disconnected" |
| // state if initiated connection fails. So cleanup the promise resolvers |
| // before checking if anything changed. |
| - // TODO(avayvod): cleanup this logic when we implementing the "connecting" |
| + // TODO(avayvod): cleanup this logic when implementing the "connecting" |
| // state. |
| if (m_promptPromiseResolver) { |
| - if (state != WebRemotePlaybackState::Disconnected) |
| - m_promptPromiseResolver->resolve(); |
| - else |
| + if (m_state != WebRemotePlaybackState::Connected && |
| + state == WebRemotePlaybackState::Disconnected) { |
| m_promptPromiseResolver->reject(DOMException::create( |
| AbortError, "Failed to connect to the remote device.")); |
| + } else { |
| + m_promptPromiseResolver->resolve(); |
|
mlamouri (slow - plz ping)
2016/11/02 14:59:10
So if we go from not connected to connected or fro
whywhat
2016/11/02 21:05:00
Yes, if we go from not-connected to disconnected -
whywhat
2016/11/03 00:10:34
It becomes a bit easier to follow with the 'connec
|
| + } |
| m_promptPromiseResolver = nullptr; |
| } |