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 "chrome/browser/extensions/api/enterprise_platform_keys/enterprise_plat
form_keys_api.h" | 5 #include "chrome/browser/extensions/api/enterprise_platform_keys/enterprise_plat
form_keys_api.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 Respond(Error(error_message)); | 112 Respond(Error(error_message)); |
113 return; | 113 return; |
114 } | 114 } |
115 | 115 |
116 std::unique_ptr<base::ListValue> client_certs(new base::ListValue()); | 116 std::unique_ptr<base::ListValue> client_certs(new base::ListValue()); |
117 for (net::CertificateList::const_iterator it = certs->begin(); | 117 for (net::CertificateList::const_iterator it = certs->begin(); |
118 it != certs->end(); | 118 it != certs->end(); |
119 ++it) { | 119 ++it) { |
120 std::string der_encoding; | 120 std::string der_encoding; |
121 net::X509Certificate::GetDEREncoded((*it)->os_cert_handle(), &der_encoding); | 121 net::X509Certificate::GetDEREncoded((*it)->os_cert_handle(), &der_encoding); |
122 client_certs->Append(base::BinaryValue::CreateWithCopiedBuffer( | 122 client_certs->Append(base::Value::CreateWithCopiedBuffer( |
123 der_encoding.data(), der_encoding.size())); | 123 der_encoding.data(), der_encoding.size())); |
124 } | 124 } |
125 | 125 |
126 std::unique_ptr<base::ListValue> results(new base::ListValue()); | 126 std::unique_ptr<base::ListValue> results(new base::ListValue()); |
127 results->Append(std::move(client_certs)); | 127 results->Append(std::move(client_certs)); |
128 Respond(ArgumentList(std::move(results))); | 128 Respond(ArgumentList(std::move(results))); |
129 } | 129 } |
130 | 130 |
131 EnterprisePlatformKeysImportCertificateFunction:: | 131 EnterprisePlatformKeysImportCertificateFunction:: |
132 ~EnterprisePlatformKeysImportCertificateFunction() { | 132 ~EnterprisePlatformKeysImportCertificateFunction() { |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 const std::string& data) { | 319 const std::string& data) { |
320 if (success) { | 320 if (success) { |
321 Respond(ArgumentList( | 321 Respond(ArgumentList( |
322 api_epk::ChallengeUserKey::Results::Create(VectorFromString(data)))); | 322 api_epk::ChallengeUserKey::Results::Create(VectorFromString(data)))); |
323 } else { | 323 } else { |
324 Respond(Error(data)); | 324 Respond(Error(data)); |
325 } | 325 } |
326 } | 326 } |
327 | 327 |
328 } // namespace extensions | 328 } // namespace extensions |
OLD | NEW |