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

Side by Side Diff: chrome/browser/chromeos/options/cert_library.cc

Issue 2416763002: Replace FOR_EACH_OBSERVER in c/b/chromeos with range-based for (Closed)
Patch Set: Created 4 years, 2 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 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 "chrome/browser/chromeos/options/cert_library.h" 5 #include "chrome/browser/chromeos/options/cert_library.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/i18n/string_compare.h" 10 #include "base/i18n/string_compare.h"
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 std::sort(user_certs_.begin(), user_certs_.end(), cert_name_comparator); 243 std::sort(user_certs_.begin(), user_certs_.end(), cert_name_comparator);
244 std::sort(server_certs_.begin(), server_certs_.end(), cert_name_comparator); 244 std::sort(server_certs_.begin(), server_certs_.end(), cert_name_comparator);
245 std::sort(server_ca_certs_.begin(), server_ca_certs_.end(), 245 std::sort(server_ca_certs_.begin(), server_ca_certs_.end(),
246 cert_name_comparator); 246 cert_name_comparator);
247 247
248 VLOG(1) << "certs_: " << certs_.size(); 248 VLOG(1) << "certs_: " << certs_.size();
249 VLOG(1) << "user_certs_: " << user_certs_.size(); 249 VLOG(1) << "user_certs_: " << user_certs_.size();
250 VLOG(1) << "server_certs_: " << server_certs_.size(); 250 VLOG(1) << "server_certs_: " << server_certs_.size();
251 VLOG(1) << "server_ca_certs_: " << server_ca_certs_.size(); 251 VLOG(1) << "server_ca_certs_: " << server_ca_certs_.size();
252 252
253 FOR_EACH_OBSERVER(CertLibrary::Observer, observer_list_, 253 for (auto& observer : observer_list_)
254 OnCertificatesLoaded(initial_load)); 254 observer.OnCertificatesLoaded(initial_load);
255 } 255 }
256 256
257 net::X509Certificate* CertLibrary::GetCertificateAt(CertType type, 257 net::X509Certificate* CertLibrary::GetCertificateAt(CertType type,
258 int index) const { 258 int index) const {
259 const net::CertificateList& cert_list = GetCertificateListForType(type); 259 const net::CertificateList& cert_list = GetCertificateListForType(type);
260 DCHECK_GE(index, 0); 260 DCHECK_GE(index, 0);
261 DCHECK_LT(index, static_cast<int>(cert_list.size())); 261 DCHECK_LT(index, static_cast<int>(cert_list.size()));
262 return cert_list[index].get(); 262 return cert_list[index].get();
263 } 263 }
264 264
265 const net::CertificateList& CertLibrary::GetCertificateListForType( 265 const net::CertificateList& CertLibrary::GetCertificateListForType(
266 CertType type) const { 266 CertType type) const {
267 if (type == CERT_TYPE_USER) 267 if (type == CERT_TYPE_USER)
268 return user_certs_; 268 return user_certs_;
269 if (type == CERT_TYPE_SERVER) 269 if (type == CERT_TYPE_SERVER)
270 return server_certs_; 270 return server_certs_;
271 if (type == CERT_TYPE_SERVER_CA) 271 if (type == CERT_TYPE_SERVER_CA)
272 return server_ca_certs_; 272 return server_ca_certs_;
273 DCHECK(type == CERT_TYPE_DEFAULT); 273 DCHECK(type == CERT_TYPE_DEFAULT);
274 return certs_; 274 return certs_;
275 } 275 }
276 276
277 } // namespace chromeos 277 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698