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 "content/renderer/media/android/webmediaplayer_android.h" | 5 #include "content/renderer/media/android/webmediaplayer_android.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 1314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1325 void WebMediaPlayerAndroid::OnKeyAdded(const std::string& session_id) { | 1325 void WebMediaPlayerAndroid::OnKeyAdded(const std::string& session_id) { |
1326 EmeUMAHistogramCounts(current_key_system_, "KeyAdded", 1); | 1326 EmeUMAHistogramCounts(current_key_system_, "KeyAdded", 1); |
1327 | 1327 |
1328 client_->keyAdded( | 1328 client_->keyAdded( |
1329 WebString::fromUTF8(GetPrefixedKeySystemName(current_key_system_)), | 1329 WebString::fromUTF8(GetPrefixedKeySystemName(current_key_system_)), |
1330 WebString::fromUTF8(session_id)); | 1330 WebString::fromUTF8(session_id)); |
1331 } | 1331 } |
1332 | 1332 |
1333 void WebMediaPlayerAndroid::OnKeyError(const std::string& session_id, | 1333 void WebMediaPlayerAndroid::OnKeyError(const std::string& session_id, |
1334 media::MediaKeys::KeyError error_code, | 1334 media::MediaKeys::KeyError error_code, |
1335 int system_code) { | 1335 uint32 system_code) { |
1336 EmeUMAHistogramEnumeration(current_key_system_, "KeyError", | 1336 EmeUMAHistogramEnumeration(current_key_system_, "KeyError", |
1337 error_code, media::MediaKeys::kMaxKeyError); | 1337 error_code, media::MediaKeys::kMaxKeyError); |
1338 | 1338 |
| 1339 unsigned short short_system_code = 0; |
| 1340 if (system_code > std::numeric_limits<unsigned short>::max()) { |
| 1341 LOG(WARNING) << "system_code exceeds unsigned short limit."; |
| 1342 short_system_code = std::numeric_limits<unsigned short>::max(); |
| 1343 } else { |
| 1344 short_system_code = static_cast<unsigned short>(system_code); |
| 1345 } |
| 1346 |
1339 client_->keyError( | 1347 client_->keyError( |
1340 WebString::fromUTF8(GetPrefixedKeySystemName(current_key_system_)), | 1348 WebString::fromUTF8(GetPrefixedKeySystemName(current_key_system_)), |
1341 WebString::fromUTF8(session_id), | 1349 WebString::fromUTF8(session_id), |
1342 static_cast<blink::WebMediaPlayerClient::MediaKeyErrorCode>(error_code), | 1350 static_cast<blink::WebMediaPlayerClient::MediaKeyErrorCode>(error_code), |
1343 system_code); | 1351 short_system_code); |
1344 } | 1352 } |
1345 | 1353 |
1346 void WebMediaPlayerAndroid::OnKeyMessage(const std::string& session_id, | 1354 void WebMediaPlayerAndroid::OnKeyMessage(const std::string& session_id, |
1347 const std::vector<uint8>& message, | 1355 const std::vector<uint8>& message, |
1348 const std::string& destination_url) { | 1356 const std::string& destination_url) { |
1349 const GURL destination_url_gurl(destination_url); | 1357 const GURL destination_url_gurl(destination_url); |
1350 DLOG_IF(WARNING, !destination_url.empty() && !destination_url_gurl.is_valid()) | 1358 DLOG_IF(WARNING, !destination_url.empty() && !destination_url_gurl.is_valid()) |
1351 << "Invalid URL in destination_url: " << destination_url; | 1359 << "Invalid URL in destination_url: " << destination_url; |
1352 | 1360 |
1353 client_->keyMessage( | 1361 client_->keyMessage( |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1434 | 1442 |
1435 void WebMediaPlayerAndroid::exitFullscreen() { | 1443 void WebMediaPlayerAndroid::exitFullscreen() { |
1436 manager_->ExitFullscreen(player_id_); | 1444 manager_->ExitFullscreen(player_id_); |
1437 } | 1445 } |
1438 | 1446 |
1439 bool WebMediaPlayerAndroid::canEnterFullscreen() const { | 1447 bool WebMediaPlayerAndroid::canEnterFullscreen() const { |
1440 return manager_->CanEnterFullscreen(frame_); | 1448 return manager_->CanEnterFullscreen(frame_); |
1441 } | 1449 } |
1442 | 1450 |
1443 } // namespace content | 1451 } // namespace content |
OLD | NEW |