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

Side by Side Diff: chromeos/network/cert_loader.cc

Issue 14729017: Add NetworkHandler to own network handlers in src/chromeos/network (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "chromeos/network/cert_loader.h" 5 #include "chromeos/network/cert_loader.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/chromeos/chromeos_version.h" 9 #include "base/chromeos/chromeos_version.h"
10 #include "base/observer_list.h" 10 #include "base/observer_list.h"
(...skipping 15 matching lines...) Expand all
26 const int kRequestDelayMs = 500; 26 const int kRequestDelayMs = 500;
27 27
28 net::CertificateList* LoadNSSCertificates() { 28 net::CertificateList* LoadNSSCertificates() {
29 net::CertificateList* cert_list(new net::CertificateList()); 29 net::CertificateList* cert_list(new net::CertificateList());
30 net::NSSCertDatabase::GetInstance()->ListCerts(cert_list); 30 net::NSSCertDatabase::GetInstance()->ListCerts(cert_list);
31 return cert_list; 31 return cert_list;
32 } 32 }
33 33
34 } // namespace 34 } // namespace
35 35
36 static CertLoader* g_cert_loader = NULL;
37
38 // static
39 void CertLoader::Initialize() {
40 CHECK(!g_cert_loader);
41 g_cert_loader = new CertLoader();
42 }
43
44 // static
45 void CertLoader::Shutdown() {
46 CHECK(g_cert_loader);
47 delete g_cert_loader;
48 g_cert_loader = NULL;
49 }
50
51 // static
52 CertLoader* CertLoader::Get() {
53 CHECK(g_cert_loader) << "CertLoader::Get() called before Initialize()";
54 return g_cert_loader;
55 }
56
57 // static
58 bool CertLoader::IsInitialized() {
59 return g_cert_loader;
60 }
61
62 CertLoader::CertLoader() 36 CertLoader::CertLoader()
63 : tpm_token_ready_(false), 37 : tpm_token_ready_(false),
64 certificates_requested_(false), 38 certificates_requested_(false),
65 certificates_loaded_(false), 39 certificates_loaded_(false),
66 key_store_loaded_(false), 40 key_store_loaded_(false),
67 weak_ptr_factory_(this) { 41 weak_ptr_factory_(this) {
68 net::CertDatabase::GetInstance()->AddObserver(this); 42 net::CertDatabase::GetInstance()->AddObserver(this);
69 LoginState::Get()->AddObserver(this); 43 LoginState::Get()->AddObserver(this);
70 if (LoginState::Get()->IsUserLoggedIn()) 44 if (LoginState::Get()->IsUserLoggedIn())
71 RequestCertificates(); 45 RequestCertificates();
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 StartLoadCertificates(); 225 StartLoadCertificates();
252 } 226 }
253 227
254 void CertLoader::LoggedInStateChanged(LoginState::LoggedInState state) { 228 void CertLoader::LoggedInStateChanged(LoginState::LoggedInState state) {
255 VLOG(1) << "LoggedInStateChanged: " << state; 229 VLOG(1) << "LoggedInStateChanged: " << state;
256 if (LoginState::Get()->IsUserLoggedIn() && !certificates_requested_) 230 if (LoginState::Get()->IsUserLoggedIn() && !certificates_requested_)
257 RequestCertificates(); 231 RequestCertificates();
258 } 232 }
259 233
260 } // namespace chromeos 234 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698