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

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

Issue 13495003: Add LoginState class to src/chromeos/login (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 8 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/cros/cert_library.h" 5 #include "chrome/browser/chromeos/cros/cert_library.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/command_line.h" 10 #include "base/command_line.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "base/observer_list_threadsafe.h" 12 #include "base/observer_list_threadsafe.h"
13 #include "base/string_util.h" 13 #include "base/string_util.h"
14 #include "base/strings/string_number_conversions.h" 14 #include "base/strings/string_number_conversions.h"
15 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
16 #include "chrome/browser/browser_process.h" // g_browser_process 16 #include "chrome/browser/browser_process.h" // g_browser_process
17 #include "chrome/browser/chromeos/cros/cros_library.h" 17 #include "chrome/browser/chromeos/cros/cros_library.h"
18 #include "chrome/browser/chromeos/cros/cryptohome_library.h" 18 #include "chrome/browser/chromeos/cros/cryptohome_library.h"
19 #include "chrome/browser/chromeos/login/user_manager.h"
20 #include "chrome/common/chrome_switches.h" 19 #include "chrome/common/chrome_switches.h"
21 #include "chrome/common/net/x509_certificate_model.h" 20 #include "chrome/common/net/x509_certificate_model.h"
22 #include "chromeos/dbus/cryptohome_client.h" 21 #include "chromeos/dbus/cryptohome_client.h"
23 #include "chromeos/dbus/dbus_thread_manager.h" 22 #include "chromeos/dbus/dbus_thread_manager.h"
23 #include "chromeos/login/login_state.h"
24 #include "content/public/browser/browser_thread.h" 24 #include "content/public/browser/browser_thread.h"
25 #include "crypto/encryptor.h" 25 #include "crypto/encryptor.h"
26 #include "crypto/nss_util.h" 26 #include "crypto/nss_util.h"
27 #include "crypto/sha2.h" 27 #include "crypto/sha2.h"
28 #include "crypto/symmetric_key.h" 28 #include "crypto/symmetric_key.h"
29 #include "grit/generated_resources.h" 29 #include "grit/generated_resources.h"
30 #include "net/cert/cert_database.h" 30 #include "net/cert/cert_database.h"
31 #include "net/cert/nss_cert_database.h" 31 #include "net/cert/nss_cert_database.h"
32 #include "third_party/icu/public/i18n/unicode/coll.h" // icu::Collator 32 #include "third_party/icu/public/i18n/unicode/coll.h" // icu::Collator
33 #include "ui/base/l10n/l10n_util.h" 33 #include "ui/base/l10n/l10n_util.h"
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 return system_salt_key_.get() != NULL; 446 return system_salt_key_.get() != NULL;
447 } 447 }
448 448
449 // Call this to start the certificate list initialization process. 449 // Call this to start the certificate list initialization process.
450 // Must be called from the UI thread. 450 // Must be called from the UI thread.
451 void RequestCertificates() { 451 void RequestCertificates() {
452 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 452 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
453 453
454 certificates_requested_ = true; 454 certificates_requested_ = true;
455 455
456 if (!UserManager::Get()->IsUserLoggedIn()) { 456 if (!LoginState::Get()->IsUserLoggedIn()) {
457 // If we are not logged in, we cannot load any certificates. 457 // If we are not logged in, we cannot load any certificates.
458 // Set 'loaded' to true for the UI, since we are not waiting on loading. 458 // Set 'loaded' to true for the UI, since we are not waiting on loading.
459 LOG(WARNING) << "Requesting certificates before login."; 459 LOG(WARNING) << "Requesting certificates before login.";
460 certificates_loaded_ = true; 460 certificates_loaded_ = true;
461 supplemental_user_key_.reset(NULL); 461 supplemental_user_key_.reset(NULL);
462 return; 462 return;
463 } 463 }
464 464
465 if (!user_logged_in_) { 465 if (!user_logged_in_) {
466 user_logged_in_ = true; 466 user_logged_in_ = true;
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 net::X509Certificate* cert = GetCertificateAt(index); 727 net::X509Certificate* cert = GetCertificateAt(index);
728 net::X509Certificate::OSCertHandle cert_handle = cert->os_cert_handle(); 728 net::X509Certificate::OSCertHandle cert_handle = cert->os_cert_handle();
729 std::string id = x509_certificate_model::GetPkcs11Id(cert_handle); 729 std::string id = x509_certificate_model::GetPkcs11Id(cert_handle);
730 if (id == pkcs11_id) 730 if (id == pkcs11_id)
731 return index; 731 return index;
732 } 732 }
733 return -1; // Not found. 733 return -1; // Not found.
734 } 734 }
735 735
736 } // chromeos 736 } // chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698