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

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: Rebase + Add NetworkConnectionHandler to NetworkHandler 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 17 matching lines...) Expand all
28 28
29 net::CertificateList* LoadNSSCertificates() { 29 net::CertificateList* LoadNSSCertificates() {
30 net::CertificateList* cert_list(new net::CertificateList()); 30 net::CertificateList* cert_list(new net::CertificateList());
31 if (base::chromeos::IsRunningOnChromeOS()) 31 if (base::chromeos::IsRunningOnChromeOS())
32 net::NSSCertDatabase::GetInstance()->ListCerts(cert_list); 32 net::NSSCertDatabase::GetInstance()->ListCerts(cert_list);
33 return cert_list; 33 return cert_list;
34 } 34 }
35 35
36 } // namespace 36 } // namespace
37 37
38 static CertLoader* g_cert_loader = NULL;
39
40 // static
41 void CertLoader::Initialize() {
42 CHECK(!g_cert_loader);
43 g_cert_loader = new CertLoader();
44 }
45
46 // static
47 void CertLoader::Shutdown() {
48 CHECK(g_cert_loader);
49 delete g_cert_loader;
50 g_cert_loader = NULL;
51 }
52
53 // static
54 CertLoader* CertLoader::Get() {
55 CHECK(g_cert_loader) << "CertLoader::Get() called before Initialize()";
56 return g_cert_loader;
57 }
58
59 // static
60 bool CertLoader::IsInitialized() {
61 return g_cert_loader;
62 }
63
64 CertLoader::CertLoader() 38 CertLoader::CertLoader()
65 : tpm_token_ready_(false), 39 : tpm_token_ready_(false),
66 certificates_requested_(false), 40 certificates_requested_(false),
67 certificates_loaded_(false), 41 certificates_loaded_(false),
68 key_store_loaded_(false), 42 key_store_loaded_(false),
69 weak_ptr_factory_(this) { 43 weak_ptr_factory_(this) {
70 net::CertDatabase::GetInstance()->AddObserver(this); 44 net::CertDatabase::GetInstance()->AddObserver(this);
71 LoginState::Get()->AddObserver(this); 45 LoginState::Get()->AddObserver(this);
72 if (LoginState::Get()->IsUserLoggedIn()) 46 if (LoginState::Get()->IsUserLoggedIn())
73 RequestCertificates(); 47 RequestCertificates();
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 StartLoadCertificates(); 260 StartLoadCertificates();
287 } 261 }
288 262
289 void CertLoader::LoggedInStateChanged(LoginState::LoggedInState state) { 263 void CertLoader::LoggedInStateChanged(LoginState::LoggedInState state) {
290 VLOG(1) << "LoggedInStateChanged: " << state; 264 VLOG(1) << "LoggedInStateChanged: " << state;
291 if (LoginState::Get()->IsUserLoggedIn() && !certificates_requested_) 265 if (LoginState::Get()->IsUserLoggedIn() && !certificates_requested_)
292 RequestCertificates(); 266 RequestCertificates();
293 } 267 }
294 268
295 } // namespace chromeos 269 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698