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

Side by Side Diff: chromeos/cert_loader.cc

Issue 23904025: Move IsRunningOnChromeOS to SysInfo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge fix Created 7 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/usb/usb_device.cc ('k') | chromeos/cryptohome/cryptohome_library.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/cert_loader.h" 5 #include "chromeos/cert_loader.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/chromeos/chromeos_version.h"
10 #include "base/message_loop/message_loop_proxy.h" 9 #include "base/message_loop/message_loop_proxy.h"
11 #include "base/observer_list.h" 10 #include "base/observer_list.h"
12 #include "base/sequenced_task_runner.h" 11 #include "base/sequenced_task_runner.h"
13 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
13 #include "base/sys_info.h"
14 #include "base/task_runner_util.h" 14 #include "base/task_runner_util.h"
15 #include "base/threading/worker_pool.h" 15 #include "base/threading/worker_pool.h"
16 #include "chromeos/dbus/cryptohome_client.h" 16 #include "chromeos/dbus/cryptohome_client.h"
17 #include "chromeos/dbus/dbus_thread_manager.h" 17 #include "chromeos/dbus/dbus_thread_manager.h"
18 #include "crypto/encryptor.h" 18 #include "crypto/encryptor.h"
19 #include "crypto/nss_util.h" 19 #include "crypto/nss_util.h"
20 #include "crypto/sha2.h" 20 #include "crypto/sha2.h"
21 #include "crypto/symmetric_key.h" 21 #include "crypto/symmetric_key.h"
22 #include "net/cert/nss_cert_database.h" 22 #include "net/cert/nss_cert_database.h"
23 23
(...skipping 21 matching lines...) Expand all
45 45
46 void LoadNSSCertificates(net::CertificateList* cert_list) { 46 void LoadNSSCertificates(net::CertificateList* cert_list) {
47 net::NSSCertDatabase::GetInstance()->ListCerts(cert_list); 47 net::NSSCertDatabase::GetInstance()->ListCerts(cert_list);
48 } 48 }
49 49
50 void CallOpenPersistentNSSDB() { 50 void CallOpenPersistentNSSDB() {
51 // Called from crypto_task_runner_. 51 // Called from crypto_task_runner_.
52 VLOG(1) << "CallOpenPersistentNSSDB"; 52 VLOG(1) << "CallOpenPersistentNSSDB";
53 53
54 // Ensure we've opened the user's key/certificate database. 54 // Ensure we've opened the user's key/certificate database.
55 if (base::chromeos::IsRunningOnChromeOS()) 55 if (base::SysInfo::IsRunningOnChromeOS())
56 crypto::OpenPersistentNSSDB(); 56 crypto::OpenPersistentNSSDB();
57 crypto::EnableTPMTokenForNSS(); 57 crypto::EnableTPMTokenForNSS();
58 } 58 }
59 59
60 } // namespace 60 } // namespace
61 61
62 static CertLoader* g_cert_loader = NULL; 62 static CertLoader* g_cert_loader = NULL;
63 63
64 // static 64 // static
65 void CertLoader::Initialize() { 65 void CertLoader::Initialize() {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 LoginState::Get()->IsInSafeMode(); 152 LoginState::Get()->IsInSafeMode();
153 153
154 VLOG(1) << "RequestCertificates: " << request_certificates; 154 VLOG(1) << "RequestCertificates: " << request_certificates;
155 if (!request_certificates) 155 if (!request_certificates)
156 return; 156 return;
157 157
158 certificates_requested_ = true; 158 certificates_requested_ = true;
159 159
160 // Ensure we only initialize the TPM token once. 160 // Ensure we only initialize the TPM token once.
161 DCHECK_EQ(tpm_token_state_, TPM_STATE_UNKNOWN); 161 DCHECK_EQ(tpm_token_state_, TPM_STATE_UNKNOWN);
162 if (!initialize_tpm_for_test_ && !base::chromeos::IsRunningOnChromeOS()) 162 if (!initialize_tpm_for_test_ && !base::SysInfo::IsRunningOnChromeOS())
163 tpm_token_state_ = TPM_DISABLED; 163 tpm_token_state_ = TPM_DISABLED;
164 164
165 // Treat TPM as disabled for guest users since they do not store certs. 165 // Treat TPM as disabled for guest users since they do not store certs.
166 if (LoginState::Get()->IsGuestUser()) 166 if (LoginState::Get()->IsGuestUser())
167 tpm_token_state_ = TPM_DISABLED; 167 tpm_token_state_ = TPM_DISABLED;
168 168
169 InitializeTokenAndLoadCertificates(); 169 InitializeTokenAndLoadCertificates();
170 } 170 }
171 171
172 void CertLoader::InitializeTokenAndLoadCertificates() { 172 void CertLoader::InitializeTokenAndLoadCertificates() {
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 VLOG(1) << "OnCertRemoved"; 390 VLOG(1) << "OnCertRemoved";
391 LoadCertificates(); 391 LoadCertificates();
392 } 392 }
393 393
394 void CertLoader::LoggedInStateChanged() { 394 void CertLoader::LoggedInStateChanged() {
395 VLOG(1) << "LoggedInStateChanged"; 395 VLOG(1) << "LoggedInStateChanged";
396 MaybeRequestCertificates(); 396 MaybeRequestCertificates();
397 } 397 }
398 398
399 } // namespace chromeos 399 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/usb/usb_device.cc ('k') | chromeos/cryptohome/cryptohome_library.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698