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 "ppapi/proxy/platform_verification_private_resource.h" | 5 #include "ppapi/proxy/platform_verification_private_resource.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "ppapi/c/pp_errors.h" | 8 #include "ppapi/c/pp_errors.h" |
9 #include "ppapi/proxy/dispatch_reply_message.h" | 9 #include "ppapi/proxy/dispatch_reply_message.h" |
10 #include "ppapi/proxy/ppapi_messages.h" | 10 #include "ppapi/proxy/ppapi_messages.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 VarTracker::IsVarTypeRefcounted(platform_key_certificate->type)) { | 45 VarTracker::IsVarTypeRefcounted(platform_key_certificate->type)) { |
46 return PP_ERROR_BADARGUMENT; | 46 return PP_ERROR_BADARGUMENT; |
47 } | 47 } |
48 | 48 |
49 StringVar* service_id_str = StringVar::FromPPVar(service_id); | 49 StringVar* service_id_str = StringVar::FromPPVar(service_id); |
50 if (!service_id_str) | 50 if (!service_id_str) |
51 return PP_ERROR_BADARGUMENT; | 51 return PP_ERROR_BADARGUMENT; |
52 | 52 |
53 scoped_refptr<ArrayBufferVar> challenge_buffer = | 53 scoped_refptr<ArrayBufferVar> challenge_buffer = |
54 ArrayBufferVar::FromPPVar(challenge); | 54 ArrayBufferVar::FromPPVar(challenge); |
55 if (!challenge_buffer) | 55 if (!challenge_buffer.get()) |
56 return PP_ERROR_BADARGUMENT; | 56 return PP_ERROR_BADARGUMENT; |
57 | 57 |
58 uint8_t* challenge_data = static_cast<uint8_t*>(challenge_buffer->Map()); | 58 uint8_t* challenge_data = static_cast<uint8_t*>(challenge_buffer->Map()); |
59 uint32 challenge_length = challenge_buffer->ByteLength(); | 59 uint32 challenge_length = challenge_buffer->ByteLength(); |
60 std::vector<uint8_t> challenge_vector(challenge_data, | 60 std::vector<uint8_t> challenge_vector(challenge_data, |
61 challenge_data + challenge_length); | 61 challenge_data + challenge_length); |
62 challenge_buffer->Unmap(); | 62 challenge_buffer->Unmap(); |
63 | 63 |
64 PpapiHostMsg_PlatformVerification_ChallengePlatform challenge_message( | 64 PpapiHostMsg_PlatformVerification_ChallengePlatform challenge_message( |
65 service_id_str->value(), challenge_vector); | 65 service_id_str->value(), challenge_vector); |
(...skipping 28 matching lines...) Expand all Loading... |
94 raw_signed_data_signature.size(), | 94 raw_signed_data_signature.size(), |
95 &raw_signed_data_signature.front()))->GetPPVar(); | 95 &raw_signed_data_signature.front()))->GetPPVar(); |
96 *(output_params.platform_key_certificate) = | 96 *(output_params.platform_key_certificate) = |
97 (new StringVar(raw_platform_key_certificate))->GetPPVar(); | 97 (new StringVar(raw_platform_key_certificate))->GetPPVar(); |
98 } | 98 } |
99 output_params.callback->Run(params.result()); | 99 output_params.callback->Run(params.result()); |
100 } | 100 } |
101 | 101 |
102 } // namespace proxy | 102 } // namespace proxy |
103 } // namespace ppapi | 103 } // namespace ppapi |
OLD | NEW |