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

Unified Diff: chrome/browser/chromeos/login/auth/parallel_authenticator.cc

Issue 409113002: Refactoring: get rid of notificataions in ParallelAuthenticator (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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
Index: chrome/browser/chromeos/login/auth/parallel_authenticator.cc
diff --git a/chrome/browser/chromeos/login/auth/parallel_authenticator.cc b/chrome/browser/chromeos/login/auth/parallel_authenticator.cc
index 1f3d3754c34eefb99e51eb3d5534958c3441b989..0303806698dfee22285c6e53bb0c43789d30a0f5 100644
--- a/chrome/browser/chromeos/login/auth/parallel_authenticator.cc
+++ b/chrome/browser/chromeos/login/auth/parallel_authenticator.cc
@@ -8,9 +8,6 @@
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/logging.h"
-#include "chrome/browser/chrome_notification_types.h"
-#include "chrome/browser/chromeos/boot_times_loader.h"
-#include "chrome/browser/chromeos/login/auth/authentication_notification_details.h"
#include "chrome/browser/chromeos/login/users/user_manager.h"
#include "chrome/browser/chromeos/ownership/owner_settings_service.h"
#include "chrome/browser/chromeos/ownership/owner_settings_service_factory.h"
@@ -25,9 +22,9 @@
#include "chromeos/login/auth/user_context.h"
#include "chromeos/login/login_state.h"
#include "chromeos/login/user_names.h"
+#include "chromeos/login_event_recorder.h"
#include "components/user_manager/user_type.h"
#include "content/public/browser/browser_thread.h"
-#include "content/public/browser/notification_service.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
using content::BrowserThread;
@@ -77,7 +74,7 @@ void TriggerResolveWithLoginTimeMarker(
scoped_refptr<ParallelAuthenticator> resolver,
bool success,
cryptohome::MountError return_code) {
- chromeos::BootTimesLoader::Get()->AddLoginTimeMarker(marker_name, false);
+ chromeos::LoginEventRecorder::Get()->AddLoginTimeMarker(marker_name, false);
TriggerResolve(attempt, resolver, success, return_code);
}
@@ -87,7 +84,7 @@ void Mount(AuthAttemptState* attempt,
int flags,
const std::string& system_salt) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- chromeos::BootTimesLoader::Get()->AddLoginTimeMarker(
+ chromeos::LoginEventRecorder::Get()->AddLoginTimeMarker(
"CryptohomeMount-Start", false);
// Set state that username_hash is requested here so that test implementation
// that returns directly would not generate 2 OnLoginSucces() calls.
@@ -165,7 +162,7 @@ void Migrate(AuthAttemptState* attempt,
const std::string& old_password,
const std::string& system_salt) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- chromeos::BootTimesLoader::Get()->AddLoginTimeMarker(
+ chromeos::LoginEventRecorder::Get()->AddLoginTimeMarker(
"CryptohomeMigrate-Start", false);
cryptohome::AsyncMethodCaller* caller =
cryptohome::AsyncMethodCaller::GetInstance();
@@ -199,7 +196,7 @@ void Migrate(AuthAttemptState* attempt,
void Remove(AuthAttemptState* attempt,
scoped_refptr<ParallelAuthenticator> resolver) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- chromeos::BootTimesLoader::Get()->AddLoginTimeMarker(
+ chromeos::LoginEventRecorder::Get()->AddLoginTimeMarker(
"CryptohomeRemove-Start", false);
cryptohome::AsyncMethodCaller::GetInstance()->AsyncRemove(
attempt->user_context.GetUserID(),
@@ -393,12 +390,7 @@ void ParallelAuthenticator::LoginAsKioskAccount(
void ParallelAuthenticator::OnRetailModeAuthSuccess() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
VLOG(1) << "Retail mode login success";
- // Send notification of success
- AuthenticationNotificationDetails details(true);
- content::NotificationService::current()->Notify(
- chrome::NOTIFICATION_LOGIN_AUTHENTICATION,
- content::NotificationService::AllSources(),
- content::Details<AuthenticationNotificationDetails>(&details));
+ chromeos::LoginEventRecorder::Get()->RecordAuthenticationSuccess();
if (consumer_)
consumer_->OnRetailModeAuthSuccess(current_state_->user_context);
}
@@ -407,11 +399,7 @@ void ParallelAuthenticator::OnAuthSuccess() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
VLOG(1) << "Login success";
// Send notification of success
- AuthenticationNotificationDetails details(true);
- content::NotificationService::current()->Notify(
- chrome::NOTIFICATION_LOGIN_AUTHENTICATION,
- content::NotificationService::AllSources(),
- content::Details<AuthenticationNotificationDetails>(&details));
+ chromeos::LoginEventRecorder::Get()->RecordAuthenticationSuccess();
{
base::AutoLock for_this_block(success_lock_);
already_reported_success_ = true;
@@ -422,12 +410,7 @@ void ParallelAuthenticator::OnAuthSuccess() {
void ParallelAuthenticator::OnOffTheRecordAuthSuccess() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- // Send notification of success
- AuthenticationNotificationDetails details(true);
- content::NotificationService::current()->Notify(
- chrome::NOTIFICATION_LOGIN_AUTHENTICATION,
- content::NotificationService::AllSources(),
- content::Details<AuthenticationNotificationDetails>(&details));
+ chromeos::LoginEventRecorder::Get()->RecordAuthenticationSuccess();
if (consumer_)
consumer_->OnOffTheRecordAuthSuccess();
}
@@ -448,13 +431,7 @@ void ParallelAuthenticator::OnAuthFailure(const AuthFailure& error) {
RemoveEncryptedData();
return;
}
-
- // Send notification of failure
- AuthenticationNotificationDetails details(false);
- content::NotificationService::current()->Notify(
- chrome::NOTIFICATION_LOGIN_AUTHENTICATION,
- content::NotificationService::AllSources(),
- content::Details<AuthenticationNotificationDetails>(&details));
+ chromeos::LoginEventRecorder::Get()->RecordAuthenticationFailure();
LOG(WARNING) << "Login failed: " << error.GetErrorString();
if (consumer_)
consumer_->OnAuthFailure(error);

Powered by Google App Engine
This is Rietveld 408576698