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

Unified Diff: chrome/browser/chromeos/login/tpm_password_fetcher.cc

Issue 286933002: [cros login] Split login related classes into subfolders. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix includes in new tests Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/login/tpm_password_fetcher.h ('k') | chrome/browser/chromeos/login/ui/DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/login/tpm_password_fetcher.cc
diff --git a/chrome/browser/chromeos/login/tpm_password_fetcher.cc b/chrome/browser/chromeos/login/tpm_password_fetcher.cc
deleted file mode 100644
index 0cfa7dde94ad16f82867dfdd42f633a1161cee4b..0000000000000000000000000000000000000000
--- a/chrome/browser/chromeos/login/tpm_password_fetcher.cc
+++ /dev/null
@@ -1,75 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/chromeos/login/tpm_password_fetcher.h"
-
-#include "base/bind.h"
-#include "base/compiler_specific.h"
-#include "base/message_loop/message_loop.h"
-#include "chromeos/dbus/cryptohome_client.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-
-namespace chromeos {
-
-namespace {
-
-// Interval between TPM password checks.
-const int kTpmCheckIntervalMs = 500;
-
-} // namespace
-
-TpmPasswordFetcher::TpmPasswordFetcher(TpmPasswordFetcherDelegate* delegate)
- : weak_factory_(this),
- delegate_(delegate) {
- DCHECK(delegate_);
-}
-
-TpmPasswordFetcher::~TpmPasswordFetcher() {
-}
-
-void TpmPasswordFetcher::Fetch() {
- // Since this method is also called directly.
- weak_factory_.InvalidateWeakPtrs();
-
- DBusThreadManager::Get()->GetCryptohomeClient()->TpmIsReady(
- base::Bind(&TpmPasswordFetcher::OnTpmIsReady,
- weak_factory_.GetWeakPtr()));
-}
-
-void TpmPasswordFetcher::OnTpmIsReady(DBusMethodCallStatus call_status,
- bool tpm_is_ready) {
- if (call_status == DBUS_METHOD_CALL_SUCCESS && tpm_is_ready) {
- DBusThreadManager::Get()->GetCryptohomeClient()->TpmGetPassword(
- base::Bind(&TpmPasswordFetcher::OnTpmGetPassword,
- weak_factory_.GetWeakPtr()));
- } else {
- // Password hasn't been acquired, reschedule fetch.
- RescheduleFetch();
- }
-}
-
-void TpmPasswordFetcher::OnTpmGetPassword(DBusMethodCallStatus call_status,
- const std::string& password) {
- if (call_status == DBUS_METHOD_CALL_SUCCESS) {
- if (password.empty()) {
- // For a fresh OOBE flow TPM is uninitialized,
- // ownership process is started at the EULA screen,
- // password is cleared after EULA is accepted.
- LOG(ERROR) << "TPM returned an empty password.";
- }
- delegate_->OnPasswordFetched(password);
- } else {
- // Password hasn't been acquired, reschedule fetch.
- RescheduleFetch();
- }
-}
-
-void TpmPasswordFetcher::RescheduleFetch() {
- base::MessageLoop::current()->PostDelayedTask(
- FROM_HERE,
- base::Bind(&TpmPasswordFetcher::Fetch, weak_factory_.GetWeakPtr()),
- base::TimeDelta::FromMilliseconds(kTpmCheckIntervalMs));
-}
-
-} // namespace chromeos
« no previous file with comments | « chrome/browser/chromeos/login/tpm_password_fetcher.h ('k') | chrome/browser/chromeos/login/ui/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698