1 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "chromeos/login_event_recorder.h" 6 7 #include <vector> 8 9 #include "base/lazy_instance.h" 10 11 namespace chromeos { 12 13 static base::LazyInstance<LoginEventRecorder> g_login_event_recorder = 14 LAZY_INSTANCE_INITIALIZER; 15 16 LoginEventRecorder::LoginEventRecorder() : delegate_(NULL) { 17 } 18 19 LoginEventRecorder::~LoginEventRecorder() { 20 } 21 22 // static 23 LoginEventRecorder* LoginEventRecorder::Get() { 24 return g_login_event_recorder.Pointer(); 25 } 26 27 void LoginEventRecorder::SetDelegate(LoginEventRecorder::Delegate* delegate) { 28 delegate_ = delegate; 29 } 30 31 void LoginEventRecorder::AddLoginTimeMarker(const std::string& marker_name, 32 bool send_to_uma) { 33 if (delegate_) 34 delegate_->AddLoginTimeMarker(marker_name, send_to_uma); 35 } 36 37 void LoginEventRecorder::RecordAuthenticationSuccess() { 38 if (delegate_) 39 delegate_->RecordAuthenticationSuccess(); 40 } 41 42 void LoginEventRecorder::RecordAuthenticationFailure() { 43 if (delegate_) 44 delegate_->RecordAuthenticationFailure(); 45 } 46 47 } // namespace chromeos 48