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

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

Issue 2782373002: Remove MediaControls methods needed for the Cast button (Closed)
Patch Set: Fixed MediaControlsImplTest Created 3 years, 8 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/AvailabilityCallbackWrapper.cpp
diff --git a/third_party/WebKit/Source/modules/remoteplayback/AvailabilityCallbackWrapper.cpp b/third_party/WebKit/Source/modules/remoteplayback/AvailabilityCallbackWrapper.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..0c387a7cb02576e55be4148e284eec0516640315
--- /dev/null
+++ b/third_party/WebKit/Source/modules/remoteplayback/AvailabilityCallbackWrapper.cpp
@@ -0,0 +1,39 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "modules/remoteplayback/AvailabilityCallbackWrapper.h"
+
+#include "bindings/modules/v8/RemotePlaybackAvailabilityCallback.h"
+#include "modules/remoteplayback/RemotePlayback.h"
+
+namespace blink {
+
+AvailabilityCallbackWrapper::AvailabilityCallbackWrapper(
+ RemotePlaybackAvailabilityCallback* callback)
+ : bindings_cb_(this, callback) {}
+
+AvailabilityCallbackWrapper::AvailabilityCallbackWrapper(
+ std::unique_ptr<WTF::Closure> callback)
+ : bindings_cb_(nullptr, nullptr), internal_cb_(std::move(callback)) {}
+
+void AvailabilityCallbackWrapper::Run(RemotePlayback* remote_playback,
+ bool new_availability) {
+ if (internal_cb_) {
+ DCHECK(!bindings_cb_);
+ (*internal_cb_.get())();
+ return;
+ }
+
+ bindings_cb_->call(remote_playback, new_availability);
+}
+
+DEFINE_TRACE(AvailabilityCallbackWrapper) {
+ visitor->Trace(bindings_cb_);
+}
+
+DEFINE_TRACE_WRAPPERS(AvailabilityCallbackWrapper) {
+ visitor->TraceWrappers(bindings_cb_);
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698