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

Side by Side Diff: media/blink/encrypted_media_player_support.cc

Issue 1534273002: Switch to standard integer types in media/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more Created 5 years 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 unified diff | Download patch
OLDNEW
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
8 #include "base/bind.h" 7 #include "base/bind.h"
9 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
10 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
11 #include "base/numerics/safe_conversions.h" 10 #include "base/numerics/safe_conversions.h"
12 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
13 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
14 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
15 #include "media/base/bind_to_current_loop.h" 14 #include "media/base/bind_to_current_loop.h"
16 #include "media/base/key_systems.h" 15 #include "media/base/key_systems.h"
17 #include "media/blink/webcontentdecryptionmodule_impl.h" 16 #include "media/blink/webcontentdecryptionmodule_impl.h"
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 283
285 void EncryptedMediaPlayerSupport::OnKeyAdded(const std::string& session_id) { 284 void EncryptedMediaPlayerSupport::OnKeyAdded(const std::string& session_id) {
286 EmeUMAHistogramCounts(current_key_system_, "KeyAdded", 1); 285 EmeUMAHistogramCounts(current_key_system_, "KeyAdded", 1);
287 client_->keyAdded( 286 client_->keyAdded(
288 WebString::fromUTF8(GetPrefixedKeySystemName(current_key_system_)), 287 WebString::fromUTF8(GetPrefixedKeySystemName(current_key_system_)),
289 WebString::fromUTF8(session_id)); 288 WebString::fromUTF8(session_id));
290 } 289 }
291 290
292 void EncryptedMediaPlayerSupport::OnKeyError(const std::string& session_id, 291 void EncryptedMediaPlayerSupport::OnKeyError(const std::string& session_id,
293 MediaKeys::KeyError error_code, 292 MediaKeys::KeyError error_code,
294 uint32 system_code) { 293 uint32_t system_code) {
295 EmeUMAHistogramEnumeration(current_key_system_, "KeyError", 294 EmeUMAHistogramEnumeration(current_key_system_, "KeyError",
296 error_code, MediaKeys::kMaxKeyError); 295 error_code, MediaKeys::kMaxKeyError);
297 296
298 uint16 short_system_code = 0; 297 uint16_t short_system_code = 0;
299 if (system_code > std::numeric_limits<uint16>::max()) { 298 if (system_code > std::numeric_limits<uint16_t>::max()) {
300 LOG(WARNING) << "system_code exceeds unsigned short limit."; 299 LOG(WARNING) << "system_code exceeds unsigned short limit.";
301 short_system_code = std::numeric_limits<uint16>::max(); 300 short_system_code = std::numeric_limits<uint16_t>::max();
302 } else { 301 } else {
303 short_system_code = static_cast<uint16>(system_code); 302 short_system_code = static_cast<uint16_t>(system_code);
304 } 303 }
305 304
306 client_->keyError( 305 client_->keyError(
307 WebString::fromUTF8(GetPrefixedKeySystemName(current_key_system_)), 306 WebString::fromUTF8(GetPrefixedKeySystemName(current_key_system_)),
308 WebString::fromUTF8(session_id), 307 WebString::fromUTF8(session_id),
309 static_cast<WebMediaPlayerEncryptedMediaClient::MediaKeyErrorCode>( 308 static_cast<WebMediaPlayerEncryptedMediaClient::MediaKeyErrorCode>(
310 error_code), 309 error_code),
311 short_system_code); 310 short_system_code);
312 } 311 }
313 312
314 void EncryptedMediaPlayerSupport::OnKeyMessage( 313 void EncryptedMediaPlayerSupport::OnKeyMessage(
315 const std::string& session_id, 314 const std::string& session_id,
316 const std::vector<uint8>& message, 315 const std::vector<uint8_t>& message,
317 const GURL& destination_url) { 316 const GURL& destination_url) {
318 DCHECK(destination_url.is_empty() || destination_url.is_valid()); 317 DCHECK(destination_url.is_empty() || destination_url.is_valid());
319 318
320 client_->keyMessage( 319 client_->keyMessage(
321 WebString::fromUTF8(GetPrefixedKeySystemName(current_key_system_)), 320 WebString::fromUTF8(GetPrefixedKeySystemName(current_key_system_)),
322 WebString::fromUTF8(session_id), 321 WebString::fromUTF8(session_id),
323 message.empty() ? NULL : &message[0], 322 message.empty() ? NULL : &message[0],
324 base::saturated_cast<unsigned int>(message.size()), 323 base::saturated_cast<unsigned int>(message.size()),
325 destination_url); 324 destination_url);
326 } 325 }
327 326
328 } // namespace media 327 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698