Index: chromeos/login/auth/extended_authenticator.cc |
diff --git a/chrome/browser/chromeos/login/auth/extended_authenticator.cc b/chromeos/login/auth/extended_authenticator.cc |
similarity index 89% |
rename from chrome/browser/chromeos/login/auth/extended_authenticator.cc |
rename to chromeos/login/auth/extended_authenticator.cc |
index 271a9c1473abdb25778034a97b0e5c3d7b8a7ee9..549888ddef4c885d65a314b35ac26eb4cc9460aa 100644 |
--- a/chrome/browser/chromeos/login/auth/extended_authenticator.cc |
+++ b/chromeos/login/auth/extended_authenticator.cc |
@@ -2,12 +2,11 @@ |
// 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/auth/extended_authenticator.h" |
+#include "chromeos/login/auth/extended_authenticator.h" |
#include "base/bind.h" |
#include "base/strings/string_number_conversions.h" |
#include "base/strings/string_util.h" |
-#include "chrome/browser/chromeos/boot_times_loader.h" |
#include "chromeos/cryptohome/async_method_caller.h" |
#include "chromeos/cryptohome/cryptohome_parameters.h" |
#include "chromeos/cryptohome/homedir_methods.h" |
@@ -17,13 +16,11 @@ |
#include "chromeos/login/auth/auth_status_consumer.h" |
#include "chromeos/login/auth/key.h" |
#include "chromeos/login/auth/user_context.h" |
-#include "content/public/browser/browser_thread.h" |
+#include "chromeos/login_event_recorder.h" |
#include "crypto/sha2.h" |
#include "google_apis/gaia/gaia_auth_util.h" |
#include "third_party/cros_system_api/dbus/service_constants.h" |
-using content::BrowserThread; |
- |
namespace chromeos { |
namespace { |
@@ -32,14 +29,14 @@ void RecordStartMarker(const std::string& marker) { |
std::string full_marker = "Cryptohome-"; |
full_marker.append(marker); |
full_marker.append("-Start"); |
- chromeos::BootTimesLoader::Get()->AddLoginTimeMarker(full_marker, false); |
+ chromeos::LoginEventRecorder::Get()->AddLoginTimeMarker(full_marker, false); |
} |
void RecordEndMarker(const std::string& marker) { |
std::string full_marker = "Cryptohome-"; |
full_marker.append(marker); |
full_marker.append("-End"); |
- chromeos::BootTimesLoader::Get()->AddLoginTimeMarker(full_marker, false); |
+ chromeos::LoginEventRecorder::Get()->AddLoginTimeMarker(full_marker, false); |
} |
} // namespace |
@@ -63,7 +60,6 @@ void ExtendedAuthenticator::SetConsumer(AuthStatusConsumer* consumer) { |
void ExtendedAuthenticator::AuthenticateToMount( |
const UserContext& context, |
const ResultCallback& success_callback) { |
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
TransformKeyIfNeeded(context, |
base::Bind(&ExtendedAuthenticator::DoAuthenticateToMount, |
this, |
@@ -73,7 +69,6 @@ void ExtendedAuthenticator::AuthenticateToMount( |
void ExtendedAuthenticator::AuthenticateToCheck( |
const UserContext& context, |
const base::Closure& success_callback) { |
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
TransformKeyIfNeeded(context, |
base::Bind(&ExtendedAuthenticator::DoAuthenticateToCheck, |
this, |
@@ -84,8 +79,6 @@ void ExtendedAuthenticator::CreateMount( |
const std::string& user_id, |
const std::vector<cryptohome::KeyDefinition>& keys, |
const ResultCallback& success_callback) { |
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
- |
RecordStartMarker("MountEx"); |
std::string canonicalized = gaia::CanonicalizeEmail(user_id); |
@@ -115,7 +108,6 @@ void ExtendedAuthenticator::AddKey(const UserContext& context, |
const cryptohome::KeyDefinition& key, |
bool replace_existing, |
const base::Closure& success_callback) { |
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
TransformKeyIfNeeded(context, |
base::Bind(&ExtendedAuthenticator::DoAddKey, |
this, |
@@ -129,7 +121,6 @@ void ExtendedAuthenticator::UpdateKeyAuthorized( |
const cryptohome::KeyDefinition& key, |
const std::string& signature, |
const base::Closure& success_callback) { |
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
TransformKeyIfNeeded(context, |
base::Bind(&ExtendedAuthenticator::DoUpdateKeyAuthorized, |
this, |
@@ -141,7 +132,6 @@ void ExtendedAuthenticator::UpdateKeyAuthorized( |
void ExtendedAuthenticator::RemoveKey(const UserContext& context, |
const std::string& key_to_remove, |
const base::Closure& success_callback) { |
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
TransformKeyIfNeeded(context, |
base::Bind(&ExtendedAuthenticator::DoRemoveKey, |
this, |
@@ -158,11 +148,11 @@ void ExtendedAuthenticator::TransformKeyIfNeeded( |
} |
if (!salt_obtained_) { |
- system_salt_callbacks_.push_back(base::Bind( |
- &ExtendedAuthenticator::TransformKeyIfNeeded, |
- this, |
- user_context, |
- callback)); |
+ system_salt_callbacks_.push_back( |
+ base::Bind(&ExtendedAuthenticator::TransformKeyIfNeeded, |
+ this, |
+ user_context, |
+ callback)); |
return; |
} |
@@ -176,13 +166,12 @@ ExtendedAuthenticator::~ExtendedAuthenticator() { |
} |
void ExtendedAuthenticator::OnSaltObtained(const std::string& system_salt) { |
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
- |
salt_obtained_ = true; |
system_salt_ = system_salt; |
for (std::vector<base::Closure>::const_iterator it = |
system_salt_callbacks_.begin(); |
- it != system_salt_callbacks_.end(); ++it) { |
+ it != system_salt_callbacks_.end(); |
+ ++it) { |
it->Run(); |
} |
system_salt_callbacks_.clear(); |
@@ -191,8 +180,6 @@ void ExtendedAuthenticator::OnSaltObtained(const std::string& system_salt) { |
void ExtendedAuthenticator::DoAuthenticateToMount( |
const ResultCallback& success_callback, |
const UserContext& user_context) { |
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
- |
RecordStartMarker("MountEx"); |
std::string canonicalized = gaia::CanonicalizeEmail(user_context.GetUserID()); |
@@ -215,8 +202,6 @@ void ExtendedAuthenticator::DoAuthenticateToMount( |
void ExtendedAuthenticator::DoAuthenticateToCheck( |
const base::Closure& success_callback, |
const UserContext& user_context) { |
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
- |
RecordStartMarker("CheckKeyEx"); |
std::string canonicalized = gaia::CanonicalizeEmail(user_context.GetUserID()); |
@@ -238,8 +223,6 @@ void ExtendedAuthenticator::DoAddKey(const cryptohome::KeyDefinition& key, |
bool replace_existing, |
const base::Closure& success_callback, |
const UserContext& user_context) { |
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
- |
RecordStartMarker("AddKeyEx"); |
std::string canonicalized = gaia::CanonicalizeEmail(user_context.GetUserID()); |
@@ -264,7 +247,6 @@ void ExtendedAuthenticator::DoUpdateKeyAuthorized( |
const std::string& signature, |
const base::Closure& success_callback, |
const UserContext& user_context) { |
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
RecordStartMarker("UpdateKeyAuthorized"); |
std::string canonicalized = gaia::CanonicalizeEmail(user_context.GetUserID()); |
@@ -287,8 +269,6 @@ void ExtendedAuthenticator::DoUpdateKeyAuthorized( |
void ExtendedAuthenticator::DoRemoveKey(const std::string& key_to_remove, |
const base::Closure& success_callback, |
const UserContext& user_context) { |
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
- |
RecordStartMarker("RemoveKeyEx"); |
std::string canonicalized = gaia::CanonicalizeEmail(user_context.GetUserID()); |
@@ -314,8 +294,6 @@ void ExtendedAuthenticator::OnMountComplete( |
bool success, |
cryptohome::MountError return_code, |
const std::string& mount_hash) { |
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
- |
RecordEndMarker(time_marker); |
UserContext copy = user_context; |
copy.SetUserIDHash(mount_hash); |
@@ -349,8 +327,6 @@ void ExtendedAuthenticator::OnOperationComplete( |
const base::Closure& success_callback, |
bool success, |
cryptohome::MountError return_code) { |
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
- |
RecordEndMarker(time_marker); |
if (return_code == cryptohome::MOUNT_ERROR_NONE) { |
if (!success_callback.is_null()) |