OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/encrypted_media_player_support.h" | 5 #include "media/blink/encrypted_media_player_support.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_to_current_loop.h" |
10 #include "base/callback_helpers.h" | 11 #include "base/callback_helpers.h" |
11 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
12 #include "base/numerics/safe_conversions.h" | 13 #include "base/numerics/safe_conversions.h" |
13 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
14 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
15 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
16 #include "media/base/bind_to_current_loop.h" | |
17 #include "media/base/key_systems.h" | 17 #include "media/base/key_systems.h" |
18 #include "media/blink/webcontentdecryptionmodule_impl.h" | 18 #include "media/blink/webcontentdecryptionmodule_impl.h" |
19 #include "third_party/WebKit/public/platform/WebContentDecryptionModule.h" | 19 #include "third_party/WebKit/public/platform/WebContentDecryptionModule.h" |
20 #include "third_party/WebKit/public/platform/WebMediaPlayerClient.h" | 20 #include "third_party/WebKit/public/platform/WebMediaPlayerClient.h" |
21 #include "third_party/WebKit/public/web/WebDocument.h" | 21 #include "third_party/WebKit/public/web/WebDocument.h" |
22 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 22 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
23 | 23 |
24 using blink::WebMediaPlayer; | 24 using blink::WebMediaPlayer; |
25 using blink::WebMediaPlayerClient; | 25 using blink::WebMediaPlayerClient; |
26 using blink::WebString; | 26 using blink::WebString; |
27 | 27 |
28 namespace media { | 28 namespace media { |
29 | 29 |
30 #define BIND_TO_RENDER_LOOP(function) \ | 30 #define BIND_TO_RENDER_LOOP(function) \ |
31 (BindToCurrentLoop(base::Bind(function, AsWeakPtr()))) | 31 (base::BindToCurrentLoop(base::Bind(function, AsWeakPtr()))) |
32 | 32 |
33 #define BIND_TO_RENDER_LOOP1(function, arg1) \ | 33 #define BIND_TO_RENDER_LOOP1(function, arg1) \ |
34 (BindToCurrentLoop(base::Bind(function, AsWeakPtr(), arg1))) | 34 (base::BindToCurrentLoop(base::Bind(function, AsWeakPtr(), arg1))) |
35 | 35 |
36 // Prefix for histograms related to Encrypted Media Extensions. | 36 // Prefix for histograms related to Encrypted Media Extensions. |
37 static const char* kMediaEme = "Media.EME."; | 37 static const char* kMediaEme = "Media.EME."; |
38 | 38 |
39 // Convert a WebString to ASCII, falling back on an empty string in the case | 39 // Convert a WebString to ASCII, falling back on an empty string in the case |
40 // of a non-ASCII string. | 40 // of a non-ASCII string. |
41 static std::string ToASCIIOrEmpty(const WebString& string) { | 41 static std::string ToASCIIOrEmpty(const WebString& string) { |
42 return base::IsStringASCII(string) ? base::UTF16ToASCII(string) | 42 return base::IsStringASCII(string) ? base::UTF16ToASCII(string) |
43 : std::string(); | 43 : std::string(); |
44 } | 44 } |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 | 316 |
317 client_->keyMessage( | 317 client_->keyMessage( |
318 WebString::fromUTF8(GetPrefixedKeySystemName(current_key_system_)), | 318 WebString::fromUTF8(GetPrefixedKeySystemName(current_key_system_)), |
319 WebString::fromUTF8(session_id), | 319 WebString::fromUTF8(session_id), |
320 message.empty() ? NULL : &message[0], | 320 message.empty() ? NULL : &message[0], |
321 base::saturated_cast<unsigned int>(message.size()), | 321 base::saturated_cast<unsigned int>(message.size()), |
322 destination_url); | 322 destination_url); |
323 } | 323 } |
324 | 324 |
325 } // namespace media | 325 } // namespace media |
OLD | NEW |