| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "media/blink/webmediaplayer_util.h" | 5 #include "media/blink/webmediaplayer_util.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> |
| 10 | 11 |
| 11 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
| 12 #include "media/base/bind_to_current_loop.h" | 13 #include "media/base/bind_to_current_loop.h" |
| 13 #include "media/base/media_client.h" | 14 #include "media/base/media_client.h" |
| 14 #include "media/base/media_keys.h" | 15 #include "media/base/media_keys.h" |
| 15 #include "third_party/WebKit/public/platform/WebMediaPlayerEncryptedMediaClient.
h" | 16 #include "third_party/WebKit/public/platform/WebMediaPlayerEncryptedMediaClient.
h" |
| 16 | 17 |
| 17 namespace media { | 18 namespace media { |
| 18 | 19 |
| 19 // Compile asserts shared by all platforms. | 20 // Compile asserts shared by all platforms. |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 // does not support move semantics and there is no base::MovableCallback. | 191 // does not support move semantics and there is no base::MovableCallback. |
| 191 // Since scoped pointers are not copyable, we cannot bind them directly | 192 // Since scoped pointers are not copyable, we cannot bind them directly |
| 192 // to a base::Callback in this case. Thus, we use this helper class, | 193 // to a base::Callback in this case. Thus, we use this helper class, |
| 193 // whose copy constructor transfers ownership of the scoped pointer. | 194 // whose copy constructor transfers ownership of the scoped pointer. |
| 194 | 195 |
| 195 class SetSinkIdCallback { | 196 class SetSinkIdCallback { |
| 196 public: | 197 public: |
| 197 explicit SetSinkIdCallback(blink::WebSetSinkIdCallbacks* web_callback) | 198 explicit SetSinkIdCallback(blink::WebSetSinkIdCallbacks* web_callback) |
| 198 : web_callback_(web_callback) {} | 199 : web_callback_(web_callback) {} |
| 199 SetSinkIdCallback(const SetSinkIdCallback& other) | 200 SetSinkIdCallback(const SetSinkIdCallback& other) |
| 200 : web_callback_(other.web_callback_.Pass()) {} | 201 : web_callback_(std::move(other.web_callback_)) {} |
| 201 ~SetSinkIdCallback() {} | 202 ~SetSinkIdCallback() {} |
| 202 friend void RunSetSinkIdCallback(const SetSinkIdCallback& callback, | 203 friend void RunSetSinkIdCallback(const SetSinkIdCallback& callback, |
| 203 OutputDeviceStatus result); | 204 OutputDeviceStatus result); |
| 204 | 205 |
| 205 private: | 206 private: |
| 206 // Mutable is required so that Pass() can be called in the copy | 207 // Mutable is required so that Pass() can be called in the copy |
| 207 // constructor. | 208 // constructor. |
| 208 mutable scoped_ptr<blink::WebSetSinkIdCallbacks> web_callback_; | 209 mutable scoped_ptr<blink::WebSetSinkIdCallbacks> web_callback_; |
| 209 }; | 210 }; |
| 210 | 211 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 235 | 236 |
| 236 } // namespace | 237 } // namespace |
| 237 | 238 |
| 238 SwitchOutputDeviceCB ConvertToSwitchOutputDeviceCB( | 239 SwitchOutputDeviceCB ConvertToSwitchOutputDeviceCB( |
| 239 blink::WebSetSinkIdCallbacks* web_callbacks) { | 240 blink::WebSetSinkIdCallbacks* web_callbacks) { |
| 240 return media::BindToCurrentLoop( | 241 return media::BindToCurrentLoop( |
| 241 base::Bind(RunSetSinkIdCallback, SetSinkIdCallback(web_callbacks))); | 242 base::Bind(RunSetSinkIdCallback, SetSinkIdCallback(web_callbacks))); |
| 242 } | 243 } |
| 243 | 244 |
| 244 } // namespace media | 245 } // namespace media |
| OLD | NEW |