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

Side by Side Diff: chrome/browser/chromeos/platform_keys/platform_keys_service.cc

Issue 1715683002: chrome: Use base's ContainsValue helper function instead of std::find (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated as per latest code Created 4 years, 10 months 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 "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
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)) {
sky 2016/03/02 17:19:34 nit: no {}
chakshu 2016/03/07 08:10:46 Done.
427 actual_key_type) == accepted_types.end()) {
428 continue; 428 continue;
429 } 429 }
430 } 430 }
431 431
432 matches_.push_back(std::move(certificate)); 432 matches_.push_back(std::move(certificate));
433 } 433 }
434 DoStep(); 434 DoStep();
435 } 435 }
436 436
437 // If |input_client_certificates_| is given, removes from |matches_| all 437 // If |input_client_certificates_| is given, removes from |matches_| all
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 while (!tasks_.empty() && tasks_.front()->IsDone()) 628 while (!tasks_.empty() && tasks_.front()->IsDone())
629 tasks_.pop(); 629 tasks_.pop();
630 630
631 // Now either the queue is empty or the next task is not finished yet and it 631 // Now either the queue is empty or the next task is not finished yet and it
632 // can be started. 632 // can be started.
633 if (!tasks_.empty()) 633 if (!tasks_.empty())
634 tasks_.front()->Start(); 634 tasks_.front()->Start();
635 } 635 }
636 636
637 } // namespace chromeos 637 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698