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/chromeos/platform_keys/platform_keys_service.h" | 5 #include "chrome/browser/chromeos/platform_keys/platform_keys_service.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/stl_util.h" |
15 #include "base/values.h" | 16 #include "base/values.h" |
16 #include "chrome/browser/chromeos/platform_keys/platform_keys.h" | 17 #include "chrome/browser/chromeos/platform_keys/platform_keys.h" |
17 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
18 #include "extensions/browser/state_store.h" | 19 #include "extensions/browser/state_store.h" |
19 #include "net/cert/x509_certificate.h" | 20 #include "net/cert/x509_certificate.h" |
20 | 21 |
21 using content::BrowserThread; | 22 using content::BrowserThread; |
22 | 23 |
23 namespace chromeos { | 24 namespace chromeos { |
24 | 25 |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 // If the type field does not contain any entries, certificates of all | 417 // If the type field does not contain any entries, certificates of all |
417 // types shall be returned. | 418 // types shall be returned. |
418 if (!request_.certificate_key_types.empty()) { | 419 if (!request_.certificate_key_types.empty()) { |
419 net::X509Certificate::PublicKeyType actual_key_type = | 420 net::X509Certificate::PublicKeyType actual_key_type = |
420 net::X509Certificate::kPublicKeyTypeUnknown; | 421 net::X509Certificate::kPublicKeyTypeUnknown; |
421 size_t unused_key_size = 0; | 422 size_t unused_key_size = 0; |
422 net::X509Certificate::GetPublicKeyInfo( | 423 net::X509Certificate::GetPublicKeyInfo( |
423 certificate->os_cert_handle(), &unused_key_size, &actual_key_type); | 424 certificate->os_cert_handle(), &unused_key_size, &actual_key_type); |
424 const std::vector<net::X509Certificate::PublicKeyType>& accepted_types = | 425 const std::vector<net::X509Certificate::PublicKeyType>& accepted_types = |
425 request_.certificate_key_types; | 426 request_.certificate_key_types; |
426 if (std::find(accepted_types.begin(), accepted_types.end(), | 427 if (!ContainsValue(accepted_types, actual_key_type)) |
427 actual_key_type) == accepted_types.end()) { | |
428 continue; | 428 continue; |
429 } | |
430 } | 429 } |
431 | 430 |
432 matches_.push_back(std::move(certificate)); | 431 matches_.push_back(std::move(certificate)); |
433 } | 432 } |
434 DoStep(); | 433 DoStep(); |
435 } | 434 } |
436 | 435 |
437 // If |input_client_certificates_| is given, removes from |matches_| all | 436 // If |input_client_certificates_| is given, removes from |matches_| all |
438 // certificates that are not elements of |input_client_certificates_|. | 437 // certificates that are not elements of |input_client_certificates_|. |
439 void IntersectWithInputCerts() { | 438 void IntersectWithInputCerts() { |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 while (!tasks_.empty() && tasks_.front()->IsDone()) | 627 while (!tasks_.empty() && tasks_.front()->IsDone()) |
629 tasks_.pop(); | 628 tasks_.pop(); |
630 | 629 |
631 // Now either the queue is empty or the next task is not finished yet and it | 630 // Now either the queue is empty or the next task is not finished yet and it |
632 // can be started. | 631 // can be started. |
633 if (!tasks_.empty()) | 632 if (!tasks_.empty()) |
634 tasks_.front()->Start(); | 633 tasks_.front()->Start(); |
635 } | 634 } |
636 | 635 |
637 } // namespace chromeos | 636 } // namespace chromeos |
OLD | NEW |