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

Side by Side Diff: media/cdm/stub/stub_cdm.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/cdm/stub/stub_cdm.h" 5 #include "media/cdm/stub/stub_cdm.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/numerics/safe_conversions.h" 8 #include "base/numerics/safe_conversions.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 } 47 }
48 48
49 StubCdm::~StubCdm() { 49 StubCdm::~StubCdm() {
50 } 50 }
51 51
52 void StubCdm::Initialize(bool /* allow_distinctive_identifier */, 52 void StubCdm::Initialize(bool /* allow_distinctive_identifier */,
53 bool /* allow_persistent_state */) { 53 bool /* allow_persistent_state */) {
54 } 54 }
55 55
56 void StubCdm::CreateSessionAndGenerateRequest( 56 void StubCdm::CreateSessionAndGenerateRequest(
57 uint32 promise_id, 57 uint32_t promise_id,
58 cdm::SessionType /* session_type */, 58 cdm::SessionType /* session_type */,
59 cdm::InitDataType /* init_data_type */, 59 cdm::InitDataType /* init_data_type */,
60 const uint8* /* init_data */, 60 const uint8_t* /* init_data */,
61 uint32 /* init_data_size */) { 61 uint32_t /* init_data_size */) {
62 // Provide a dummy message (with a trivial session ID) to enable some testing 62 // Provide a dummy message (with a trivial session ID) to enable some testing
63 // and be consistent with existing testing without a license server. 63 // and be consistent with existing testing without a license server.
64 std::string session_id(base::UintToString(next_session_id_++)); 64 std::string session_id(base::UintToString(next_session_id_++));
65 host_->OnResolveNewSessionPromise( 65 host_->OnResolveNewSessionPromise(
66 promise_id, session_id.data(), 66 promise_id, session_id.data(),
67 base::checked_cast<uint32_t>(session_id.length())); 67 base::checked_cast<uint32_t>(session_id.length()));
68 host_->OnSessionMessage(session_id.data(), 68 host_->OnSessionMessage(session_id.data(),
69 base::checked_cast<uint32_t>(session_id.length()), 69 base::checked_cast<uint32_t>(session_id.length()),
70 cdm::kLicenseRequest, nullptr, 0, nullptr, 0); 70 cdm::kLicenseRequest, nullptr, 0, nullptr, 0);
71 } 71 }
72 72
73 void StubCdm::LoadSession(uint32 promise_id, 73 void StubCdm::LoadSession(uint32_t promise_id,
74 cdm::SessionType /* session_type */, 74 cdm::SessionType /* session_type */,
75 const char* /* session_id */, 75 const char* /* session_id */,
76 uint32_t /* session_id_length */) { 76 uint32_t /* session_id_length */) {
77 FailRequest(promise_id); 77 FailRequest(promise_id);
78 } 78 }
79 79
80 void StubCdm::UpdateSession(uint32 promise_id, 80 void StubCdm::UpdateSession(uint32_t promise_id,
81 const char* /* session_id */, 81 const char* /* session_id */,
82 uint32_t /* session_id_length */, 82 uint32_t /* session_id_length */,
83 const uint8* /* response */, 83 const uint8_t* /* response */,
84 uint32 /* response_size */) { 84 uint32_t /* response_size */) {
85 FailRequest(promise_id); 85 FailRequest(promise_id);
86 } 86 }
87 87
88 void StubCdm::CloseSession(uint32 promise_id, 88 void StubCdm::CloseSession(uint32_t promise_id,
89 const char* /* session_id */, 89 const char* /* session_id */,
90 uint32_t /* session_id_length */) { 90 uint32_t /* session_id_length */) {
91 FailRequest(promise_id); 91 FailRequest(promise_id);
92 } 92 }
93 93
94 void StubCdm::RemoveSession(uint32 promise_id, 94 void StubCdm::RemoveSession(uint32_t promise_id,
95 const char* /* session_id */, 95 const char* /* session_id */,
96 uint32_t /* session_id_length */) { 96 uint32_t /* session_id_length */) {
97 FailRequest(promise_id); 97 FailRequest(promise_id);
98 } 98 }
99 99
100 void StubCdm::SetServerCertificate( 100 void StubCdm::SetServerCertificate(
101 uint32 promise_id, 101 uint32_t promise_id,
102 const uint8_t* /* server_certificate_data */, 102 const uint8_t* /* server_certificate_data */,
103 uint32_t /* server_certificate_data_size */) { 103 uint32_t /* server_certificate_data_size */) {
104 FailRequest(promise_id); 104 FailRequest(promise_id);
105 } 105 }
106 106
107 void StubCdm::TimerExpired(void* /* context */) { 107 void StubCdm::TimerExpired(void* /* context */) {
108 } 108 }
109 109
110 cdm::Status StubCdm::Decrypt(const cdm::InputBuffer& /* encrypted_buffer */, 110 cdm::Status StubCdm::Decrypt(const cdm::InputBuffer& /* encrypted_buffer */,
111 cdm::DecryptedBlock* /* decrypted_block */) { 111 cdm::DecryptedBlock* /* decrypted_block */) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 NOTREACHED(); 149 NOTREACHED();
150 } 150 }
151 151
152 void StubCdm::OnQueryOutputProtectionStatus( 152 void StubCdm::OnQueryOutputProtectionStatus(
153 cdm::QueryResult /* result */, 153 cdm::QueryResult /* result */,
154 uint32_t /* link_mask */, 154 uint32_t /* link_mask */,
155 uint32_t /* output_protection_mask */) { 155 uint32_t /* output_protection_mask */) {
156 NOTREACHED(); 156 NOTREACHED();
157 }; 157 };
158 158
159 void StubCdm::FailRequest(uint32 promise_id) { 159 void StubCdm::FailRequest(uint32_t promise_id) {
160 std::string message("Operation not supported by stub CDM."); 160 std::string message("Operation not supported by stub CDM.");
161 host_->OnRejectPromise(promise_id, cdm::kInvalidAccessError, 0, 161 host_->OnRejectPromise(promise_id, cdm::kInvalidAccessError, 0,
162 message.data(), 162 message.data(),
163 base::checked_cast<uint32_t>(message.length())); 163 base::checked_cast<uint32_t>(message.length()));
164 } 164 }
165 165
166 } // namespace media 166 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698