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

Unified Diff: third_party/WebKit/Source/modules/remoteplayback/RemotePlayback.cpp

Issue 2415443004: [Blink, RemotePlayback]Split onstatechange to separate events (Closed)
Patch Set: Added extra state changes Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
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 c17d001e919af3572084dd23b764d5f020ac43e5..bddeb4b1c5ef5001569be2140ada60a7eb849d03 100644
--- a/third_party/WebKit/Source/modules/remoteplayback/RemotePlayback.cpp
+++ b/third_party/WebKit/Source/modules/remoteplayback/RemotePlayback.cpp
@@ -19,10 +19,13 @@ namespace blink {
namespace {
const AtomicString& remotePlaybackStateToString(WebRemotePlaybackState state) {
+ DEFINE_STATIC_LOCAL(const AtomicString, connectingValue, ("connecting"));
DEFINE_STATIC_LOCAL(const AtomicString, connectedValue, ("connected"));
DEFINE_STATIC_LOCAL(const AtomicString, disconnectedValue, ("disconnected"));
switch (state) {
+ case WebRemotePlaybackState::Connecting:
+ return connectingValue;
case WebRemotePlaybackState::Connected:
return connectedValue;
case WebRemotePlaybackState::Disconnected:
@@ -146,7 +149,17 @@ void RemotePlayback::stateChanged(WebRemotePlaybackState state) {
return;
m_state = state;
- dispatchEvent(Event::create(EventTypeNames::statechange));
+ switch (m_state) {
+ case WebRemotePlaybackState::Connecting:
+ dispatchEvent(Event::create(EventTypeNames::connecting));
+ break;
+ case WebRemotePlaybackState::Connected:
+ dispatchEvent(Event::create(EventTypeNames::connect));
+ break;
+ case WebRemotePlaybackState::Disconnected:
+ dispatchEvent(Event::create(EventTypeNames::disconnect));
+ break;
+ }
}
void RemotePlayback::availabilityChanged(bool available) {

Powered by Google App Engine
This is Rietveld 408576698