| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/browser_notification_observers.h" | 5 #include "chrome/browser/chromeos/browser_notification_observers.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "chrome/browser/chrome_thread.h" | 10 #include "chrome/browser/chrome_thread.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 InitialTabNotificationObserver::~InitialTabNotificationObserver() { | 22 InitialTabNotificationObserver::~InitialTabNotificationObserver() { |
| 23 } | 23 } |
| 24 | 24 |
| 25 void InitialTabNotificationObserver::Observe( | 25 void InitialTabNotificationObserver::Observe( |
| 26 NotificationType type, | 26 NotificationType type, |
| 27 const NotificationSource& source, | 27 const NotificationSource& source, |
| 28 const NotificationDetails& details) { | 28 const NotificationDetails& details) { |
| 29 // Only log for first tab to render. Make sure this is only done once. | 29 // Only log for first tab to render. Make sure this is only done once. |
| 30 if (type == NotificationType::LOAD_START && num_tabs_.GetNext() == 0) { | 30 if (type == NotificationType::LOAD_START && num_tabs_.GetNext() == 0) { |
| 31 // If we can't post it, it doesn't matter. | 31 // Post difference between first tab and login succeess time as login time. |
| 32 UMA_HISTOGRAM_TIMES("BootTime.Login", |
| 33 base::Time::NowFromSystemTime() - login_success_time_); |
| 34 // Post chrome first render stat. |
| 32 BootTimesLoader::RecordCurrentStats("chrome-first-render"); | 35 BootTimesLoader::RecordCurrentStats("chrome-first-render"); |
| 33 registrar_.Remove(this, NotificationType::LOAD_START, | 36 registrar_.Remove(this, NotificationType::LOAD_START, |
| 34 NotificationService::AllSources()); | 37 NotificationService::AllSources()); |
| 35 } | 38 } |
| 36 } | 39 } |
| 37 | 40 |
| 38 LogLoginSuccessObserver::LogLoginSuccessObserver() { | 41 LogLoginSuccessObserver::LogLoginSuccessObserver() { |
| 39 registrar_.Add(this, NotificationType::LOGIN_AUTHENTICATION, | 42 registrar_.Add(this, NotificationType::LOGIN_AUTHENTICATION, |
| 40 NotificationService::AllSources()); | 43 NotificationService::AllSources()); |
| 41 } | 44 } |
| 42 | 45 |
| 43 LogLoginSuccessObserver::~LogLoginSuccessObserver() { | 46 LogLoginSuccessObserver::~LogLoginSuccessObserver() { |
| 44 } | 47 } |
| 45 | 48 |
| 46 void LogLoginSuccessObserver::Observe(NotificationType type, | 49 void LogLoginSuccessObserver::Observe(NotificationType type, |
| 47 const NotificationSource& source, | 50 const NotificationSource& source, |
| 48 const NotificationDetails& details) { | 51 const NotificationDetails& details) { |
| 49 DCHECK(type == NotificationType::LOGIN_AUTHENTICATION); | 52 DCHECK(type == NotificationType::LOGIN_AUTHENTICATION); |
| 50 Details<AuthenticationNotificationDetails> auth_details(details); | 53 Details<AuthenticationNotificationDetails> auth_details(details); |
| 51 if (auth_details->success()) { | 54 if (auth_details->success()) { |
| 52 // If we can't post it, it doesn't matter. | 55 InitialTabNotificationObserver::Get()->SetLoginSuccessTime(); |
| 53 BootTimesLoader::RecordCurrentStats("login-successful"); | 56 BootTimesLoader::RecordCurrentStats("login-successful"); |
| 54 registrar_.Remove(this, NotificationType::LOGIN_AUTHENTICATION, | 57 registrar_.Remove(this, NotificationType::LOGIN_AUTHENTICATION, |
| 55 NotificationService::AllSources()); | 58 NotificationService::AllSources()); |
| 56 } | 59 } |
| 57 } | 60 } |
| 58 | 61 |
| 59 } // namespace chromeos | 62 } // namespace chromeos |
| OLD | NEW |