diff options
author | antrim@chromium.org <antrim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-24 03:15:28 +0000 |
---|---|---|
committer | antrim@chromium.org <antrim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-24 03:15:28 +0000 |
commit | 34897239269ed821392ff443d26ec89bc3ee174a (patch) | |
tree | e26bfb55f37798028e56043bb62a5db6583b1354 | |
parent | d7f7e2ff75d5adfb75927e8db4bb5e31e2037f8c (diff) | |
download | chromium_src-34897239269ed821392ff443d26ec89bc3ee174a.zip chromium_src-34897239269ed821392ff443d26ec89bc3ee174a.tar.gz chromium_src-34897239269ed821392ff443d26ec89bc3ee174a.tar.bz2 |
Refactoring : Move AuthAttempt and Authenticators to chromeos/login
Extracted LoginEventRecorder from BootTimesLoader to loose dependecies.
BUG=387613
R=nkostylev@chromium.org
TBR=bauerb@chromium.org
TBR=stevenjb@chromium.org
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=284682
Review URL: https://codereview.chromium.org/391373002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@285137 0039d316-1c4b-4281-b951-d872f2087c98
44 files changed, 260 insertions, 202 deletions
diff --git a/chrome/browser/chromeos/boot_times_loader.h b/chrome/browser/chromeos/boot_times_loader.h index 1df7e1c..4dbb9c2 100644 --- a/chrome/browser/chromeos/boot_times_loader.h +++ b/chrome/browser/chromeos/boot_times_loader.h @@ -13,6 +13,7 @@ #include "base/compiler_specific.h" #include "base/task/cancelable_task_tracker.h" #include "base/time/time.h" +#include "chromeos/login_event_recorder.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/render_widget_host.h" @@ -31,18 +32,22 @@ namespace chromeos { // . Define the callback method, something like: // void OnBootTimesLoaded(const BootTimesLoader::BootTimes& boot_times); // . When you want the version invoke: loader.GetBootTimes(callback, &tracker_); -class BootTimesLoader : public content::NotificationObserver { +class BootTimesLoader : public content::NotificationObserver, + public LoginEventRecorder::Delegate { public: BootTimesLoader(); virtual ~BootTimesLoader(); static BootTimesLoader* Get(); + // LoginEventRecorder::Delegate override. + // Add a time marker for login. A timeline will be dumped to // /tmp/login-times-sent after login is done. If |send_to_uma| is true // the time between this marker and the last will be sent to UMA with // the identifier BootTime.|marker_name|. - void AddLoginTimeMarker(const std::string& marker_name, bool send_to_uma); + virtual void AddLoginTimeMarker(const std::string& marker_name, + bool send_to_uma) OVERRIDE; // Add a time marker for logout. A timeline will be dumped to // /tmp/logout-times-sent after logout is done. If |send_to_uma| is true diff --git a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc index cbee9ef..a6af4d2 100644 --- a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc +++ b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc @@ -96,6 +96,7 @@ #include "chromeos/ime/input_method_manager.h" #include "chromeos/login/login_state.h" #include "chromeos/login/user_names.h" +#include "chromeos/login_event_recorder.h" #include "chromeos/network/network_change_notifier_chromeos.h" #include "chromeos/network/network_change_notifier_factory_chromeos.h" #include "chromeos/network/network_handler.h" @@ -345,6 +346,7 @@ void ChromeBrowserMainPartsChromeos::PreProfileInit() { // Now that the file thread exists we can record our stats. BootTimesLoader::Get()->RecordChromeMainStats(); + LoginEventRecorder::Get()->SetDelegate(BootTimesLoader::Get()); // Trigger prefetching of ownership status. DeviceSettingsService::Get()->Load(); diff --git a/chrome/browser/chromeos/login/app_launch_signin_screen.h b/chrome/browser/chromeos/login/app_launch_signin_screen.h index 2a89f04..665eddd 100644 --- a/chrome/browser/chromeos/login/app_launch_signin_screen.h +++ b/chrome/browser/chromeos/login/app_launch_signin_screen.h @@ -8,11 +8,11 @@ #include <string> #include "base/memory/ref_counted.h" -#include "chrome/browser/chromeos/login/auth/authenticator.h" #include "chrome/browser/chromeos/login/users/user_manager.h" #include "chrome/browser/signin/screenlock_bridge.h" #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" #include "chromeos/login/auth/auth_status_consumer.h" +#include "chromeos/login/auth/authenticator.h" #include "components/user_manager/user.h" namespace chromeos { diff --git a/chrome/browser/chromeos/login/auth/login_performer.h b/chrome/browser/chromeos/login/auth/login_performer.h index f33cb4d..2af66cb9 100644 --- a/chrome/browser/chromeos/login/auth/login_performer.h +++ b/chrome/browser/chromeos/login/auth/login_performer.h @@ -10,12 +10,12 @@ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" -#include "chrome/browser/chromeos/login/auth/authenticator.h" -#include "chrome/browser/chromeos/login/auth/extended_authenticator.h" #include "chrome/browser/chromeos/login/auth/online_attempt_host.h" #include "chrome/browser/chromeos/policy/wildcard_login_checker.h" #include "chrome/browser/profiles/profile_manager.h" #include "chromeos/login/auth/auth_status_consumer.h" +#include "chromeos/login/auth/authenticator.h" +#include "chromeos/login/auth/extended_authenticator.h" #include "chromeos/login/auth/user_context.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" diff --git a/chrome/browser/chromeos/login/auth/online_attempt.cc b/chrome/browser/chromeos/login/auth/online_attempt.cc index a701ae7..5dfed04 100644 --- a/chrome/browser/chromeos/login/auth/online_attempt.cc +++ b/chrome/browser/chromeos/login/auth/online_attempt.cc @@ -10,8 +10,8 @@ #include "base/logging.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" -#include "chrome/browser/chromeos/login/auth/auth_attempt_state.h" -#include "chrome/browser/chromeos/login/auth/auth_attempt_state_resolver.h" +#include "chromeos/login/auth/auth_attempt_state.h" +#include "chromeos/login/auth/auth_attempt_state_resolver.h" #include "chromeos/login/auth/key.h" #include "chromeos/login/auth/user_context.h" #include "components/user_manager/user_type.h" diff --git a/chrome/browser/chromeos/login/auth/online_attempt_host.cc b/chrome/browser/chromeos/login/auth/online_attempt_host.cc index 8023aee..277e2d8 100644 --- a/chrome/browser/chromeos/login/auth/online_attempt_host.cc +++ b/chrome/browser/chromeos/login/auth/online_attempt_host.cc @@ -5,8 +5,8 @@ #include "chrome/browser/chromeos/login/auth/online_attempt_host.h" #include "base/bind.h" -#include "chrome/browser/chromeos/login/auth/auth_attempt_state.h" #include "chrome/browser/chromeos/login/auth/online_attempt.h" +#include "chromeos/login/auth/auth_attempt_state.h" #include "chromeos/login/auth/user_context.h" #include "components/user_manager/user_type.h" #include "content/public/browser/browser_context.h" diff --git a/chrome/browser/chromeos/login/auth/online_attempt_host.h b/chrome/browser/chromeos/login/auth/online_attempt_host.h index e928c5e..e7d2672 100644 --- a/chrome/browser/chromeos/login/auth/online_attempt_host.h +++ b/chrome/browser/chromeos/login/auth/online_attempt_host.h @@ -10,7 +10,7 @@ #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" -#include "chrome/browser/chromeos/login/auth/auth_attempt_state_resolver.h" +#include "chromeos/login/auth/auth_attempt_state_resolver.h" #include "chromeos/login/auth/user_context.h" namespace content { diff --git a/chrome/browser/chromeos/login/auth/online_attempt_unittest.cc b/chrome/browser/chromeos/login/auth/online_attempt_unittest.cc index 5632210..bb5502e 100644 --- a/chrome/browser/chromeos/login/auth/online_attempt_unittest.cc +++ b/chrome/browser/chromeos/login/auth/online_attempt_unittest.cc @@ -7,12 +7,12 @@ #include "base/bind.h" #include "base/memory/ref_counted.h" #include "base/run_loop.h" -#include "chrome/browser/chromeos/login/auth/auth_attempt_state.h" -#include "chrome/browser/chromeos/login/auth/mock_auth_attempt_state_resolver.h" #include "chrome/browser/chromeos/login/auth/mock_url_fetchers.h" #include "chrome/browser/chromeos/login/auth/online_attempt.h" -#include "chrome/browser/chromeos/login/auth/test_attempt_state.h" #include "chrome/test/base/testing_profile.h" +#include "chromeos/login/auth/auth_attempt_state.h" +#include "chromeos/login/auth/mock_auth_attempt_state_resolver.h" +#include "chromeos/login/auth/test_attempt_state.h" #include "chromeos/login/auth/user_context.h" #include "content/public/browser/browser_thread.h" #include "content/public/test/test_browser_thread_bundle.h" diff --git a/chrome/browser/chromeos/login/auth/parallel_authenticator.h b/chrome/browser/chromeos/login/auth/parallel_authenticator.h index 7052a99..ae3f922 100644 --- a/chrome/browser/chromeos/login/auth/parallel_authenticator.h +++ b/chrome/browser/chromeos/login/auth/parallel_authenticator.h @@ -12,11 +12,11 @@ #include "base/gtest_prod_util.h" #include "base/memory/scoped_ptr.h" #include "base/synchronization/lock.h" -#include "chrome/browser/chromeos/login/auth/auth_attempt_state.h" -#include "chrome/browser/chromeos/login/auth/auth_attempt_state_resolver.h" -#include "chrome/browser/chromeos/login/auth/authenticator.h" -#include "chrome/browser/chromeos/login/auth/test_attempt_state.h" #include "chrome/browser/chromeos/settings/device_settings_service.h" +#include "chromeos/login/auth/auth_attempt_state.h" +#include "chromeos/login/auth/auth_attempt_state_resolver.h" +#include "chromeos/login/auth/authenticator.h" +#include "chromeos/login/auth/test_attempt_state.h" #include "google_apis/gaia/gaia_auth_consumer.h" class AuthFailure; diff --git a/chrome/browser/chromeos/login/auth/parallel_authenticator_unittest.cc b/chrome/browser/chromeos/login/auth/parallel_authenticator_unittest.cc index 3c5f9e8..9985b8d 100644 --- a/chrome/browser/chromeos/login/auth/parallel_authenticator_unittest.cc +++ b/chrome/browser/chromeos/login/auth/parallel_authenticator_unittest.cc @@ -14,7 +14,6 @@ #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" #include "chrome/browser/chromeos/login/auth/mock_url_fetchers.h" -#include "chrome/browser/chromeos/login/auth/test_attempt_state.h" #include "chrome/browser/chromeos/login/users/fake_user_manager.h" #include "chrome/browser/chromeos/login/users/user_manager.h" #include "chrome/browser/chromeos/ownership/owner_settings_service.h" @@ -34,6 +33,7 @@ #include "chromeos/dbus/fake_dbus_thread_manager.h" #include "chromeos/login/auth/key.h" #include "chromeos/login/auth/mock_auth_status_consumer.h" +#include "chromeos/login/auth/test_attempt_state.h" #include "chromeos/login/auth/user_context.h" #include "components/user_manager/user.h" #include "content/public/test/test_browser_thread_bundle.h" diff --git a/chrome/browser/chromeos/login/existing_user_controller_browsertest.cc b/chrome/browser/chromeos/login/existing_user_controller_browsertest.cc index 4772ee7..5cdae17 100644 --- a/chrome/browser/chromeos/login/existing_user_controller_browsertest.cc +++ b/chrome/browser/chromeos/login/existing_user_controller_browsertest.cc @@ -12,8 +12,6 @@ #include "base/memory/ref_counted.h" #include "base/run_loop.h" #include "chrome/browser/chrome_notification_types.h" -#include "chrome/browser/chromeos/login/auth/authenticator.h" -#include "chrome/browser/chromeos/login/auth/mock_authenticator.h" #include "chrome/browser/chromeos/login/auth/mock_url_fetchers.h" #include "chrome/browser/chromeos/login/existing_user_controller.h" #include "chrome/browser/chromeos/login/helper.h" @@ -34,7 +32,10 @@ #include "chrome/test/base/ui_test_utils.h" #include "chromeos/chromeos_switches.h" #include "chromeos/dbus/fake_session_manager_client.h" +#include "chromeos/login/auth/authenticator.h" #include "chromeos/login/auth/key.h" +#include "chromeos/login/auth/mock_authenticator.h" +#include "chromeos/login/auth/mock_authenticator.h" #include "chromeos/login/auth/user_context.h" #include "chromeos/settings/cros_settings_names.h" #include "components/policy/core/common/cloud/cloud_policy_constants.h" diff --git a/chrome/browser/chromeos/login/fake_login_utils.cc b/chrome/browser/chromeos/login/fake_login_utils.cc index f450979..7192688f 100644 --- a/chrome/browser/chromeos/login/fake_login_utils.cc +++ b/chrome/browser/chromeos/login/fake_login_utils.cc @@ -7,7 +7,6 @@ #include "base/command_line.h" #include "base/prefs/pref_service.h" #include "chrome/browser/chrome_notification_types.h" -#include "chrome/browser/chromeos/login/auth/mock_authenticator.h" #include "chrome/browser/chromeos/login/ui/login_display_host.h" #include "chrome/browser/chromeos/login/user_flow.h" #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" @@ -18,6 +17,7 @@ #include "chrome/browser/ui/startup/startup_browser_creator.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/testing_profile.h" +#include "chromeos/login/auth/mock_authenticator.h" #include "chromeos/login/auth/user_context.h" #include "components/user_manager/user.h" #include "content/public/browser/notification_service.h" diff --git a/chrome/browser/chromeos/login/lock/screen_locker.cc b/chrome/browser/chromeos/login/lock/screen_locker.cc index 5e0471c..8f194f4 100644 --- a/chrome/browser/chromeos/login/lock/screen_locker.cc +++ b/chrome/browser/chromeos/login/lock/screen_locker.cc @@ -25,8 +25,6 @@ #include "base/strings/string_util.h" #include "base/timer/timer.h" #include "chrome/browser/chrome_notification_types.h" -#include "chrome/browser/chromeos/login/auth/authenticator.h" -#include "chrome/browser/chromeos/login/auth/extended_authenticator.h" #include "chrome/browser/chromeos/login/auth/login_performer.h" #include "chrome/browser/chromeos/login/lock/webui_screen_locker.h" #include "chrome/browser/chromeos/login/login_utils.h" @@ -42,6 +40,8 @@ #include "chromeos/audio/chromeos_sounds.h" #include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/session_manager_client.h" +#include "chromeos/login/auth/authenticator.h" +#include "chromeos/login/auth/extended_authenticator.h" #include "components/signin/core/browser/signin_manager.h" #include "components/user_manager/user_type.h" #include "content/public/browser/browser_thread.h" diff --git a/chrome/browser/chromeos/login/lock/screen_locker_browsertest.cc b/chrome/browser/chromeos/login/lock/screen_locker_browsertest.cc index e2a556f..49c62e8 100644 --- a/chrome/browser/chromeos/login/lock/screen_locker_browsertest.cc +++ b/chrome/browser/chromeos/login/lock/screen_locker_browsertest.cc @@ -9,7 +9,6 @@ #include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" #include "chrome/browser/chrome_notification_types.h" -#include "chrome/browser/chromeos/login/auth/mock_authenticator.h" #include "chrome/browser/chromeos/login/lock/screen_locker_tester.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/ui/browser.h" @@ -23,6 +22,7 @@ #include "chromeos/dbus/fake_dbus_thread_manager.h" #include "chromeos/dbus/fake_session_manager_client.h" #include "chromeos/login/auth/key.h" +#include "chromeos/login/auth/mock_authenticator.h" #include "chromeos/login/auth/user_context.h" #include "chromeos/login/user_names.h" #include "content/public/browser/notification_service.h" diff --git a/chrome/browser/chromeos/login/lock/screen_locker_tester.cc b/chrome/browser/chromeos/login/lock/screen_locker_tester.cc index 9e670ee..1354e13 100644 --- a/chrome/browser/chromeos/login/lock/screen_locker_tester.cc +++ b/chrome/browser/chromeos/login/lock/screen_locker_tester.cc @@ -10,11 +10,11 @@ #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "base/values.h" -#include "chrome/browser/chromeos/login/auth/mock_authenticator.h" #include "chrome/browser/chromeos/login/lock/screen_locker.h" #include "chrome/browser/chromeos/login/lock/webui_screen_locker.h" #include "chrome/test/base/ui_test_utils.h" #include "chromeos/login/auth/auth_status_consumer.h" +#include "chromeos/login/auth/mock_authenticator.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" diff --git a/chrome/browser/chromeos/login/login_utils_browsertest.cc b/chrome/browser/chromeos/login/login_utils_browsertest.cc index 227bd87..a467b20 100644 --- a/chrome/browser/chromeos/login/login_utils_browsertest.cc +++ b/chrome/browser/chromeos/login/login_utils_browsertest.cc @@ -21,7 +21,6 @@ #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" #include "chrome/browser/chromeos/input_method/input_method_configuration.h" #include "chrome/browser/chromeos/input_method/mock_input_method_manager.h" -#include "chrome/browser/chromeos/login/auth/authenticator.h" #include "chrome/browser/chromeos/login/users/user_manager.h" #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" @@ -51,6 +50,7 @@ #include "chromeos/disks/disk_mount_manager.h" #include "chromeos/disks/mock_disk_mount_manager.h" #include "chromeos/login/auth/auth_status_consumer.h" +#include "chromeos/login/auth/authenticator.h" #include "chromeos/login/auth/key.h" #include "chromeos/login/auth/user_context.h" #include "chromeos/login/login_state.h" diff --git a/chrome/browser/chromeos/login/mock_login_utils.h b/chrome/browser/chromeos/login/mock_login_utils.h index 542fe5e..20d19f6 100644 --- a/chrome/browser/chromeos/login/mock_login_utils.h +++ b/chrome/browser/chromeos/login/mock_login_utils.h @@ -9,10 +9,10 @@ #include "base/command_line.h" #include "base/memory/ref_counted.h" -#include "chrome/browser/chromeos/login/auth/authenticator.h" #include "chrome/browser/chromeos/login/fake_login_utils.h" #include "chrome/browser/chromeos/login/login_utils.h" #include "chrome/browser/chromeos/login/ui/login_display_host.h" +#include "chromeos/login/auth/authenticator.h" #include "google_apis/gaia/gaia_auth_consumer.h" #include "testing/gmock/include/gmock/gmock.h" #include "url/gurl.h" diff --git a/chrome/browser/chromeos/login/session/user_session_manager.h b/chrome/browser/chromeos/login/session/user_session_manager.h index 7328b9b..9344cb8 100644 --- a/chrome/browser/chromeos/login/session/user_session_manager.h +++ b/chrome/browser/chromeos/login/session/user_session_manager.h @@ -12,9 +12,9 @@ #include "base/memory/weak_ptr.h" #include "base/observer_list.h" #include "chrome/browser/chromeos/base/locale_util.h" -#include "chrome/browser/chromeos/login/auth/authenticator.h" #include "chrome/browser/chromeos/login/signin/oauth2_login_manager.h" #include "chromeos/dbus/session_manager_client.h" +#include "chromeos/login/auth/authenticator.h" #include "chromeos/login/auth/user_context.h" #include "components/user_manager/user.h" #include "net/base/network_change_notifier.h" diff --git a/chrome/browser/chromeos/login/supervised/supervised_user_creation_controller_new.h b/chrome/browser/chromeos/login/supervised/supervised_user_creation_controller_new.h index 39ec157..6ba6e1d 100644 --- a/chrome/browser/chromeos/login/supervised/supervised_user_creation_controller_new.h +++ b/chrome/browser/chromeos/login/supervised/supervised_user_creation_controller_new.h @@ -13,9 +13,9 @@ #include "base/strings/string16.h" #include "base/timer/timer.h" #include "base/values.h" -#include "chrome/browser/chromeos/login/auth/extended_authenticator.h" #include "chrome/browser/chromeos/login/supervised/supervised_user_creation_controller.h" #include "chrome/browser/supervised_user/supervised_user_registration_utility.h" +#include "chromeos/login/auth/extended_authenticator.h" class Profile; diff --git a/chrome/browser/chromeos/login/supervised/supervised_user_login_flow.h b/chrome/browser/chromeos/login/supervised/supervised_user_login_flow.h index ea6969d9..0bbe94b 100644 --- a/chrome/browser/chromeos/login/supervised/supervised_user_login_flow.h +++ b/chrome/browser/chromeos/login/supervised/supervised_user_login_flow.h @@ -9,8 +9,8 @@ #include "base/compiler_specific.h" #include "base/memory/weak_ptr.h" #include "base/strings/string16.h" -#include "chrome/browser/chromeos/login/auth/extended_authenticator.h" #include "chrome/browser/chromeos/login/user_flow.h" +#include "chromeos/login/auth/extended_authenticator.h" #include "chromeos/login/auth/user_context.h" namespace chromeos { diff --git a/chrome/browser/chromeos/login/test_login_utils.cc b/chrome/browser/chromeos/login/test_login_utils.cc index b011d7d2..5fbc396 100644 --- a/chrome/browser/chromeos/login/test_login_utils.cc +++ b/chrome/browser/chromeos/login/test_login_utils.cc @@ -5,7 +5,7 @@ #include "chrome/browser/chromeos/login/test_login_utils.h" #include "base/logging.h" -#include "chrome/browser/chromeos/login/auth/mock_authenticator.h" +#include "chromeos/login/auth/mock_authenticator.h" #include "chromeos/login/auth/user_context.h" namespace chromeos { diff --git a/chrome/browser/chromeos/login/test_login_utils.h b/chrome/browser/chromeos/login/test_login_utils.h index 0fd74c6..c3b1a35 100644 --- a/chrome/browser/chromeos/login/test_login_utils.h +++ b/chrome/browser/chromeos/login/test_login_utils.h @@ -6,8 +6,8 @@ #define CHROME_BROWSER_CHROMEOS_LOGIN_TEST_LOGIN_UTILS_H_ #include "base/memory/ref_counted.h" -#include "chrome/browser/chromeos/login/auth/authenticator.h" #include "chrome/browser/chromeos/login/login_utils.h" +#include "chromeos/login/auth/authenticator.h" #include "chromeos/login/auth/user_context.h" #include "google_apis/gaia/google_service_auth_error.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/browser/chromeos/login/wizard_controller_browsertest.cc b/chrome/browser/chromeos/login/wizard_controller_browsertest.cc index cd076d9..7626cdf 100644 --- a/chrome/browser/chromeos/login/wizard_controller_browsertest.cc +++ b/chrome/browser/chromeos/login/wizard_controller_browsertest.cc @@ -19,7 +19,6 @@ #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" #include "chrome/browser/chromeos/base/locale_util.h" #include "chrome/browser/chromeos/geolocation/simple_geolocation_provider.h" -#include "chrome/browser/chromeos/login/auth/mock_authenticator.h" #include "chrome/browser/chromeos/login/enrollment/enrollment_screen.h" #include "chrome/browser/chromeos/login/enrollment/mock_auto_enrollment_check_screen.h" #include "chrome/browser/chromeos/login/enrollment/mock_enrollment_screen.h" @@ -57,6 +56,7 @@ #include "chromeos/dbus/fake_session_manager_client.h" #include "chromeos/login/auth/key.h" #include "chromeos/login/auth/mock_auth_status_consumer.h" +#include "chromeos/login/auth/mock_authenticator.h" #include "chromeos/login/auth/user_context.h" #include "chromeos/network/network_state.h" #include "chromeos/network/network_state_handler.h" diff --git a/chrome/browser/supervised_user/chromeos/manager_password_service.h b/chrome/browser/supervised_user/chromeos/manager_password_service.h index 5d4445d..be5050c 100644 --- a/chrome/browser/supervised_user/chromeos/manager_password_service.h +++ b/chrome/browser/supervised_user/chromeos/manager_password_service.h @@ -10,10 +10,10 @@ #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" -#include "chrome/browser/chromeos/login/auth/extended_authenticator.h" #include "chrome/browser/supervised_user/supervised_user_shared_settings_service.h" #include "chrome/browser/supervised_user/supervised_user_sync_service.h" #include "chrome/browser/supervised_user/supervised_users.h" +#include "chromeos/login/auth/extended_authenticator.h" #include "components/keyed_service/core/keyed_service.h" namespace chromeos { diff --git a/chrome/chrome_browser_chromeos.gypi b/chrome/chrome_browser_chromeos.gypi index 8699a26..49188c2 100644 --- a/chrome/chrome_browser_chromeos.gypi +++ b/chrome/chrome_browser_chromeos.gypi @@ -517,16 +517,8 @@ 'browser/chromeos/login/app_launch_controller.h', 'browser/chromeos/login/app_launch_signin_screen.cc', 'browser/chromeos/login/app_launch_signin_screen.h', - 'browser/chromeos/login/auth/auth_attempt_state.cc', - 'browser/chromeos/login/auth/auth_attempt_state.h', - 'browser/chromeos/login/auth/auth_attempt_state_resolver.cc', - 'browser/chromeos/login/auth/auth_attempt_state_resolver.h', 'browser/chromeos/login/auth/auth_prewarmer.cc', 'browser/chromeos/login/auth/auth_prewarmer.h', - 'browser/chromeos/login/auth/authenticator.cc', - 'browser/chromeos/login/auth/authenticator.h', - 'browser/chromeos/login/auth/extended_authenticator.cc', - 'browser/chromeos/login/auth/extended_authenticator.h', 'browser/chromeos/login/auth/login_performer.cc', 'browser/chromeos/login/auth/login_performer.h', 'browser/chromeos/login/auth/mount_manager.cc', @@ -537,8 +529,6 @@ 'browser/chromeos/login/auth/online_attempt_host.h', 'browser/chromeos/login/auth/parallel_authenticator.cc', 'browser/chromeos/login/auth/parallel_authenticator.h', - 'browser/chromeos/login/auth/test_attempt_state.cc', - 'browser/chromeos/login/auth/test_attempt_state.h', 'browser/chromeos/login/auth/tpm_password_fetcher.cc', 'browser/chromeos/login/auth/tpm_password_fetcher.h', 'browser/chromeos/login/authentication_notification_details.h', diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index a8e47c6..4e70599 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -937,8 +937,6 @@ 'browser/chromeos/input_method/mode_indicator_browsertest.cc', 'browser/chromeos/kiosk_mode/mock_kiosk_mode_settings.cc', 'browser/chromeos/kiosk_mode/mock_kiosk_mode_settings.h', - 'browser/chromeos/login/auth/mock_authenticator.cc', - 'browser/chromeos/login/auth/mock_authenticator.h', 'browser/chromeos/login/crash_restore_browsertest.cc', 'browser/chromeos/login/demo_mode/demo_app_launcher_browsertest.cc', 'browser/chromeos/login/enrollment/enrollment_screen_browsertest.cc', diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi index 5f44e4b..c49b211 100644 --- a/chrome/chrome_tests_unit.gypi +++ b/chrome/chrome_tests_unit.gypi @@ -81,8 +81,6 @@ 'browser/chromeos/input_method/mock_input_method_manager.h', 'browser/chromeos/login/fake_login_utils.cc', 'browser/chromeos/login/fake_login_utils.h', - 'browser/chromeos/login/auth/mock_authenticator.cc', - 'browser/chromeos/login/auth/mock_authenticator.h', 'browser/chromeos/login/auth/mock_url_fetchers.cc', 'browser/chromeos/login/auth/mock_url_fetchers.h', 'browser/chromeos/login/mock_login_utils.cc', @@ -769,8 +767,6 @@ 'browser/chromeos/input_method/input_method_util_unittest.cc', 'browser/chromeos/kiosk_mode/kiosk_mode_idle_logout_unittest.cc', 'browser/chromeos/kiosk_mode/kiosk_mode_settings_unittest.cc', - 'browser/chromeos/login/auth/mock_auth_attempt_state_resolver.cc', - 'browser/chromeos/login/auth/mock_auth_attempt_state_resolver.h', 'browser/chromeos/login/auth/online_attempt_unittest.cc', 'browser/chromeos/login/auth/parallel_authenticator_unittest.cc', 'browser/chromeos/login/existing_user_controller_auto_login_unittest.cc', diff --git a/chromeos/chromeos.gyp b/chromeos/chromeos.gyp index 69e43da..9b07040 100644 --- a/chromeos/chromeos.gyp +++ b/chromeos/chromeos.gyp @@ -64,14 +64,14 @@ 'chromeos_paths.h', 'chromeos_switches.cc', 'chromeos_switches.h', - 'cryptohome/cryptohome_parameters.cc', - 'cryptohome/cryptohome_parameters.h', - 'cryptohome/homedir_methods.cc', - 'cryptohome/homedir_methods.h', 'cryptohome/async_method_caller.cc', 'cryptohome/async_method_caller.h', + 'cryptohome/cryptohome_parameters.cc', + 'cryptohome/cryptohome_parameters.h', 'cryptohome/cryptohome_util.cc', 'cryptohome/cryptohome_util.h', + 'cryptohome/homedir_methods.cc', + 'cryptohome/homedir_methods.h', 'cryptohome/system_salt_getter.cc', 'cryptohome/system_salt_getter.h', 'dbus/audio_node.cc', @@ -157,6 +157,8 @@ 'dbus/fake_debug_daemon_client.h', 'dbus/fake_gsm_sms_client.cc', 'dbus/fake_gsm_sms_client.h', + 'dbus/fake_image_burner_client.cc', + 'dbus/fake_image_burner_client.h', 'dbus/fake_introspectable_client.cc', 'dbus/fake_introspectable_client.h', 'dbus/fake_lorgnette_manager_client.cc', @@ -173,8 +175,6 @@ 'dbus/fake_nfc_record_client.h', 'dbus/fake_nfc_tag_client.cc', 'dbus/fake_nfc_tag_client.h', - 'dbus/fake_image_burner_client.cc', - 'dbus/fake_image_burner_client.h', 'dbus/fake_permission_broker_client.cc', 'dbus/fake_permission_broker_client.h', 'dbus/fake_shill_device_client.cc', @@ -193,6 +193,14 @@ 'dbus/fake_system_clock_client.h', 'dbus/gsm_sms_client.cc', 'dbus/gsm_sms_client.h', + 'dbus/image_burner_client.cc', + 'dbus/image_burner_client.h', + 'dbus/introspectable_client.cc', + 'dbus/introspectable_client.h', + 'dbus/lorgnette_manager_client.cc', + 'dbus/lorgnette_manager_client.h', + 'dbus/modem_messaging_client.cc', + 'dbus/modem_messaging_client.h', 'dbus/nfc_adapter_client.cc', 'dbus/nfc_adapter_client.h', 'dbus/nfc_client_helpers.cc', @@ -207,6 +215,16 @@ 'dbus/nfc_record_client.h', 'dbus/nfc_tag_client.cc', 'dbus/nfc_tag_client.h', + 'dbus/permission_broker_client.cc', + 'dbus/permission_broker_client.h', + 'dbus/pipe_reader.cc', + 'dbus/pipe_reader.h', + 'dbus/power_manager_client.cc', + 'dbus/power_manager_client.h', + 'dbus/power_policy_controller.cc', + 'dbus/power_policy_controller.h', + 'dbus/session_manager_client.cc', + 'dbus/session_manager_client.h', 'dbus/shill_client_helper.cc', 'dbus/shill_client_helper.h', 'dbus/shill_device_client.cc', @@ -219,24 +237,6 @@ 'dbus/shill_profile_client.h', 'dbus/shill_service_client.cc', 'dbus/shill_service_client.h', - 'dbus/image_burner_client.cc', - 'dbus/image_burner_client.h', - 'dbus/introspectable_client.cc', - 'dbus/introspectable_client.h', - 'dbus/lorgnette_manager_client.cc', - 'dbus/lorgnette_manager_client.h', - 'dbus/modem_messaging_client.cc', - 'dbus/modem_messaging_client.h', - 'dbus/permission_broker_client.cc', - 'dbus/permission_broker_client.h', - 'dbus/pipe_reader.cc', - 'dbus/pipe_reader.h', - 'dbus/power_manager_client.cc', - 'dbus/power_manager_client.h', - 'dbus/power_policy_controller.cc', - 'dbus/power_policy_controller.h', - 'dbus/session_manager_client.cc', - 'dbus/session_manager_client.h', 'dbus/sms_client.cc', 'dbus/sms_client.h', 'dbus/system_clock_client.cc', @@ -249,32 +249,44 @@ 'disks/disk_mount_manager.h', 'ime/component_extension_ime_manager.cc', 'ime/component_extension_ime_manager.h', + 'ime/composition_text.cc', + 'ime/composition_text.h', 'ime/extension_ime_util.cc', 'ime/extension_ime_util.h', 'ime/fake_ime_keyboard.cc', 'ime/fake_ime_keyboard.h', - 'ime/composition_text.cc', - 'ime/composition_text.h', + 'ime/ime_keyboard.h', + 'ime/ime_keyboard_ozone.cc', + 'ime/ime_keyboard_x11.cc', 'ime/input_method_delegate.h', 'ime/input_method_descriptor.cc', 'ime/input_method_descriptor.h', 'ime/input_method_manager.cc', 'ime/input_method_manager.h', 'ime/input_method_whitelist.cc', - 'ime/ime_keyboard.h', - 'ime/ime_keyboard_ozone.cc', - 'ime/ime_keyboard_x11.cc', 'ime/input_method_whitelist.h', + 'login/auth/auth_attempt_state.cc', + 'login/auth/auth_attempt_state.h', + 'login/auth/auth_attempt_state_resolver.cc', + 'login/auth/auth_attempt_state_resolver.h', 'login/auth/auth_status_consumer.cc', 'login/auth/auth_status_consumer.h', + 'login/auth/authenticator.cc', + 'login/auth/authenticator.h', + 'login/auth/extended_authenticator.cc', + 'login/auth/extended_authenticator.h', 'login/auth/key.cc', 'login/auth/key.h', + 'login/auth/test_attempt_state.cc', + 'login/auth/test_attempt_state.h', 'login/auth/user_context.cc', 'login/auth/user_context.h', 'login/login_state.cc', 'login/login_state.h', 'login/user_names.cc', 'login/user_names.h', + 'login_event_recorder.cc', + 'login_event_recorder.h', 'network/certificate_pattern.cc', 'network/certificate_pattern.h', 'network/client_cert_resolver.cc', @@ -283,6 +295,8 @@ 'network/client_cert_util.h', 'network/device_state.cc', 'network/device_state.h', + 'network/dhcp_proxy_script_fetcher_chromeos.cc', + 'network/dhcp_proxy_script_fetcher_chromeos.h', 'network/geolocation_handler.cc', 'network/geolocation_handler.h', 'network/host_resolver_impl_chromeos.cc', @@ -356,10 +370,10 @@ 'network/onc/onc_utils.h', 'network/onc/onc_validator.cc', 'network/onc/onc_validator.h', - 'network/policy_util.cc', - 'network/policy_util.h', 'network/policy_applicator.cc', 'network/policy_applicator.h', + 'network/policy_util.cc', + 'network/policy_util.h', 'network/portal_detector/network_portal_detector.cc', 'network/portal_detector/network_portal_detector.h', 'network/portal_detector/network_portal_detector_strategy.cc', @@ -368,8 +382,6 @@ 'network/shill_property_handler.h', 'network/shill_property_util.cc', 'network/shill_property_util.h', - 'network/dhcp_proxy_script_fetcher_chromeos.cc', - 'network/dhcp_proxy_script_fetcher_chromeos.h', 'process_proxy/process_output_watcher.cc', 'process_proxy/process_output_watcher.h', 'process_proxy/process_proxy.cc', @@ -439,8 +451,12 @@ 'disks/mock_disk_mount_manager.h', 'ime/mock_component_extension_ime_manager_delegate.cc', 'ime/mock_component_extension_ime_manager_delegate.h', + 'login/auth/mock_auth_attempt_state_resolver.cc', + 'login/auth/mock_auth_attempt_state_resolver.h', 'login/auth/mock_auth_status_consumer.cc', 'login/auth/mock_auth_status_consumer.h', + 'login/auth/mock_authenticator.cc', + 'login/auth/mock_authenticator.h', 'network/fake_network_device_handler.cc', 'network/fake_network_device_handler.h', 'network/mock_managed_network_configuration_handler.cc', diff --git a/chrome/browser/chromeos/login/auth/auth_attempt_state.cc b/chromeos/login/auth/auth_attempt_state.cc index c64b22b..f4717a4 100644 --- a/chrome/browser/chromeos/login/auth/auth_attempt_state.cc +++ b/chromeos/login/auth/auth_attempt_state.cc @@ -2,16 +2,13 @@ // 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/auth_attempt_state.h" +#include "chromeos/login/auth/auth_attempt_state.h" #include <string> -#include "content/public/browser/browser_thread.h" #include "google_apis/gaia/gaia_auth_consumer.h" #include "google_apis/gaia/gaia_auth_fetcher.h" -using content::BrowserThread; - namespace chromeos { AuthAttemptState::AuthAttemptState(const UserContext& user_context, @@ -34,10 +31,10 @@ AuthAttemptState::AuthAttemptState(const UserContext& user_context, username_hash_valid_(true) { } -AuthAttemptState::~AuthAttemptState() {} +AuthAttemptState::~AuthAttemptState() { +} void AuthAttemptState::RecordOnlineLoginStatus(const AuthFailure& outcome) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); online_complete_ = true; online_outcome_ = outcome; // We're either going to not try again, or try again with HOSTED @@ -46,86 +43,71 @@ void AuthAttemptState::RecordOnlineLoginStatus(const AuthFailure& outcome) { } void AuthAttemptState::DisableHosted() { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); hosted_policy_ = GaiaAuthFetcher::HostedAccountsNotAllowed; } void AuthAttemptState::RecordCryptohomeStatus( bool cryptohome_outcome, cryptohome::MountError cryptohome_code) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); cryptohome_complete_ = true; cryptohome_outcome_ = cryptohome_outcome; cryptohome_code_ = cryptohome_code; } void AuthAttemptState::RecordUsernameHash(const std::string& username_hash) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); user_context.SetUserIDHash(username_hash); username_hash_obtained_ = true; username_hash_valid_ = true; } void AuthAttemptState::RecordUsernameHashFailed() { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); username_hash_obtained_ = true; username_hash_valid_ = false; } void AuthAttemptState::UsernameHashRequested() { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); username_hash_obtained_ = false; } void AuthAttemptState::ResetCryptohomeStatus() { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); cryptohome_complete_ = false; cryptohome_outcome_ = false; cryptohome_code_ = cryptohome::MOUNT_ERROR_NONE; } bool AuthAttemptState::online_complete() { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); return online_complete_; } const AuthFailure& AuthAttemptState::online_outcome() { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); return online_outcome_; } bool AuthAttemptState::is_first_time_user() { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); return is_first_time_user_; } GaiaAuthFetcher::HostedAccountsSetting AuthAttemptState::hosted_policy() { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); return hosted_policy_; } bool AuthAttemptState::cryptohome_complete() { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); return cryptohome_complete_; } bool AuthAttemptState::cryptohome_outcome() { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); return cryptohome_outcome_; } cryptohome::MountError AuthAttemptState::cryptohome_code() { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); return cryptohome_code_; } bool AuthAttemptState::username_hash_obtained() { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); return username_hash_obtained_; } bool AuthAttemptState::username_hash_valid() { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); return username_hash_obtained_; } diff --git a/chrome/browser/chromeos/login/auth/auth_attempt_state.h b/chromeos/login/auth/auth_attempt_state.h index a264c4a..04b0cbb 100644 --- a/chrome/browser/chromeos/login/auth/auth_attempt_state.h +++ b/chromeos/login/auth/auth_attempt_state.h @@ -2,11 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_AUTH_ATTEMPT_STATE_H_ -#define CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_AUTH_ATTEMPT_STATE_H_ +#ifndef CHROMEOS_LOGIN_AUTH_AUTH_ATTEMPT_STATE_H_ +#define CHROMEOS_LOGIN_AUTH_AUTH_ATTEMPT_STATE_H_ #include <string> +#include "chromeos/chromeos_export.h" #include "chromeos/login/auth/auth_status_consumer.h" #include "chromeos/login/auth/user_context.h" #include "components/user_manager/user_type.h" @@ -18,7 +19,7 @@ namespace chromeos { // Tracks the state associated with a single attempt to log in to chromium OS. // Enforces that methods are only called on the UI thread. -class AuthAttemptState { +class CHROMEOS_EXPORT AuthAttemptState { public: // Used to initialize for a login attempt. AuthAttemptState(const UserContext& user_context, @@ -114,4 +115,4 @@ class AuthAttemptState { } // namespace chromeos -#endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_AUTH_ATTEMPT_STATE_H_ +#endif // CHROMEOS_LOGIN_AUTH_AUTH_ATTEMPT_STATE_H_ diff --git a/chrome/browser/chromeos/login/auth/auth_attempt_state_resolver.cc b/chromeos/login/auth/auth_attempt_state_resolver.cc index 14deda8..b8def0d 100644 --- a/chrome/browser/chromeos/login/auth/auth_attempt_state_resolver.cc +++ b/chromeos/login/auth/auth_attempt_state_resolver.cc @@ -2,12 +2,14 @@ // 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/auth_attempt_state_resolver.h" +#include "chromeos/login/auth/auth_attempt_state_resolver.h" namespace chromeos { -AuthAttemptStateResolver::AuthAttemptStateResolver() {} +AuthAttemptStateResolver::AuthAttemptStateResolver() { +} -AuthAttemptStateResolver::~AuthAttemptStateResolver() {} +AuthAttemptStateResolver::~AuthAttemptStateResolver() { +} } // namespace chromeos diff --git a/chrome/browser/chromeos/login/auth/auth_attempt_state_resolver.h b/chromeos/login/auth/auth_attempt_state_resolver.h index 18bf5ef..303739d 100644 --- a/chrome/browser/chromeos/login/auth/auth_attempt_state_resolver.h +++ b/chromeos/login/auth/auth_attempt_state_resolver.h @@ -2,12 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_AUTH_ATTEMPT_STATE_RESOLVER_H_ -#define CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_AUTH_ATTEMPT_STATE_RESOLVER_H_ +#ifndef CHROMEOS_LOGIN_AUTH_AUTH_ATTEMPT_STATE_RESOLVER_H_ +#define CHROMEOS_LOGIN_AUTH_AUTH_ATTEMPT_STATE_RESOLVER_H_ + +#include "chromeos/chromeos_export.h" namespace chromeos { -class AuthAttemptStateResolver { +class CHROMEOS_EXPORT AuthAttemptStateResolver { public: AuthAttemptStateResolver(); virtual ~AuthAttemptStateResolver(); @@ -18,4 +20,4 @@ class AuthAttemptStateResolver { } // namespace chromeos -#endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_AUTH_ATTEMPT_STATE_RESOLVER_H_ +#endif // CHROMEOS_LOGIN_AUTH_AUTH_ATTEMPT_STATE_RESOLVER_H_ diff --git a/chrome/browser/chromeos/login/auth/authenticator.cc b/chromeos/login/auth/authenticator.cc index 94ad5ca..fb642fa 100644 --- a/chrome/browser/chromeos/login/auth/authenticator.cc +++ b/chromeos/login/auth/authenticator.cc @@ -2,7 +2,7 @@ // 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/authenticator.h" +#include "chromeos/login/auth/authenticator.h" namespace chromeos { @@ -12,7 +12,8 @@ Authenticator::Authenticator(AuthStatusConsumer* consumer) : consumer_(consumer), authentication_profile_(NULL) { } -Authenticator::~Authenticator() {} +Authenticator::~Authenticator() { +} void Authenticator::SetConsumer(AuthStatusConsumer* consumer) { consumer_ = consumer; diff --git a/chrome/browser/chromeos/login/auth/authenticator.h b/chromeos/login/auth/authenticator.h index 69257fd..b5eb31c 100644 --- a/chrome/browser/chromeos/login/auth/authenticator.h +++ b/chromeos/login/auth/authenticator.h @@ -2,13 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_AUTHENTICATOR_H_ -#define CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_AUTHENTICATOR_H_ +#ifndef CHROMEOS_LOGIN_AUTH_AUTHENTICATOR_H_ +#define CHROMEOS_LOGIN_AUTH_AUTHENTICATOR_H_ #include <string> #include "base/basictypes.h" #include "base/memory/ref_counted.h" +#include "chromeos/chromeos_export.h" #include "chromeos/login/auth/auth_status_consumer.h" #include "google_apis/gaia/gaia_auth_consumer.h" @@ -23,7 +24,8 @@ class UserContext; // 1. On successful authentication, will call consumer_->OnAuthSuccess(). // 2. On failure, will call consumer_->OnAuthFailure(). // 3. On password change, will call consumer_->OnPasswordChangeDetected(). -class Authenticator : public base::RefCountedThreadSafe<Authenticator> { +class CHROMEOS_EXPORT Authenticator + : public base::RefCountedThreadSafe<Authenticator> { public: explicit Authenticator(AuthStatusConsumer* consumer); @@ -44,8 +46,7 @@ class Authenticator : public base::RefCountedThreadSafe<Authenticator> { virtual void AuthenticateToUnlock(const UserContext& user_context) = 0; // Initiates supervised user login. - virtual void LoginAsSupervisedUser( - const UserContext& user_context) = 0; + virtual void LoginAsSupervisedUser(const UserContext& user_context) = 0; // Initiates retail mode login. virtual void LoginRetailMode() = 0; @@ -79,8 +80,7 @@ class Authenticator : public base::RefCountedThreadSafe<Authenticator> { // Call this method to migrate the user's encrypted data // forward to use his new password. |old_password| is the password // his data was last encrypted with. - virtual void RecoverEncryptedData( - const std::string& old_password) = 0; + virtual void RecoverEncryptedData(const std::string& old_password) = 0; // Call this method to erase the user's encrypted data // and create a new cryptohome. @@ -107,4 +107,4 @@ class Authenticator : public base::RefCountedThreadSafe<Authenticator> { } // namespace chromeos -#endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_AUTHENTICATOR_H_ +#endif // CHROMEOS_LOGIN_AUTH_AUTHENTICATOR_H_ diff --git a/chrome/browser/chromeos/login/auth/extended_authenticator.cc b/chromeos/login/auth/extended_authenticator.cc index 271a9c1..549888d 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()) diff --git a/chrome/browser/chromeos/login/auth/extended_authenticator.h b/chromeos/login/auth/extended_authenticator.h index bea88b0..589989f 100644 --- a/chrome/browser/chromeos/login/auth/extended_authenticator.h +++ b/chromeos/login/auth/extended_authenticator.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_EXTENDED_AUTHENTICATOR_H_ -#define CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_EXTENDED_AUTHENTICATOR_H_ +#ifndef CHROMEOS_LOGIN_AUTH_EXTENDED_AUTHENTICATOR_H_ +#define CHROMEOS_LOGIN_AUTH_EXTENDED_AUTHENTICATOR_H_ #include <string> @@ -12,6 +12,7 @@ #include "base/compiler_specific.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" +#include "chromeos/chromeos_export.h" #include "chromeos/cryptohome/cryptohome_parameters.h" #include "third_party/cros_system_api/dbus/service_constants.h" @@ -26,7 +27,7 @@ class UserContext; // Typical flow: // AuthenticateToMount() calls cryptohomed to perform offline login, // AuthenticateToCreate() calls cryptohomed to create new cryptohome. -class ExtendedAuthenticator +class CHROMEOS_EXPORT ExtendedAuthenticator : public base::RefCountedThreadSafe<ExtendedAuthenticator> { public: enum AuthState { @@ -158,4 +159,4 @@ class ExtendedAuthenticator } // namespace chromeos -#endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_EXTENDED_AUTHENTICATOR_H_ +#endif // CHROMEOS_LOGIN_AUTH_EXTENDED_AUTHENTICATOR_H_ diff --git a/chrome/browser/chromeos/login/auth/mock_auth_attempt_state_resolver.cc b/chromeos/login/auth/mock_auth_attempt_state_resolver.cc index 37d4246..d14dffc 100644 --- a/chrome/browser/chromeos/login/auth/mock_auth_attempt_state_resolver.cc +++ b/chromeos/login/auth/mock_auth_attempt_state_resolver.cc @@ -2,12 +2,14 @@ // 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/mock_auth_attempt_state_resolver.h" +#include "chromeos/login/auth/mock_auth_attempt_state_resolver.h" namespace chromeos { -MockAuthAttemptStateResolver::MockAuthAttemptStateResolver() {} +MockAuthAttemptStateResolver::MockAuthAttemptStateResolver() { +} -MockAuthAttemptStateResolver::~MockAuthAttemptStateResolver() {} +MockAuthAttemptStateResolver::~MockAuthAttemptStateResolver() { +} } // namespace chromeos diff --git a/chrome/browser/chromeos/login/auth/mock_auth_attempt_state_resolver.h b/chromeos/login/auth/mock_auth_attempt_state_resolver.h index ec380e4..f96545d 100644 --- a/chrome/browser/chromeos/login/auth/mock_auth_attempt_state_resolver.h +++ b/chromeos/login/auth/mock_auth_attempt_state_resolver.h @@ -2,25 +2,28 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_MOCK_AUTH_ATTEMPT_STATE_RESOLVER_H_ -#define CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_MOCK_AUTH_ATTEMPT_STATE_RESOLVER_H_ +#ifndef CHROMEOS_LOGIN_AUTH_MOCK_AUTH_ATTEMPT_STATE_RESOLVER_H_ +#define CHROMEOS_LOGIN_AUTH_MOCK_AUTH_ATTEMPT_STATE_RESOLVER_H_ #include "base/basictypes.h" -#include "chrome/browser/chromeos/login/auth/auth_attempt_state_resolver.h" +#include "chromeos/chromeos_export.h" +#include "chromeos/login/auth/auth_attempt_state_resolver.h" #include "testing/gmock/include/gmock/gmock.h" namespace chromeos { -class MockAuthAttemptStateResolver : public AuthAttemptStateResolver { +class CHROMEOS_EXPORT MockAuthAttemptStateResolver + : public AuthAttemptStateResolver { public: MockAuthAttemptStateResolver(); virtual ~MockAuthAttemptStateResolver(); MOCK_METHOD0(Resolve, void(void)); + private: DISALLOW_COPY_AND_ASSIGN(MockAuthAttemptStateResolver); }; } // namespace chromeos -#endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_MOCK_AUTH_ATTEMPT_STATE_RESOLVER_H_ +#endif // CHROMEOS_LOGIN_AUTH_MOCK_AUTH_ATTEMPT_STATE_RESOLVER_H_ diff --git a/chrome/browser/chromeos/login/auth/mock_authenticator.cc b/chromeos/login/auth/mock_authenticator.cc index 29536b3..3fcc746 100644 --- a/chrome/browser/chromeos/login/auth/mock_authenticator.cc +++ b/chromeos/login/auth/mock_authenticator.cc @@ -2,19 +2,19 @@ // 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/mock_authenticator.h" +#include "chromeos/login/auth/mock_authenticator.h" #include "base/bind.h" +#include "base/location.h" #include "base/logging.h" -#include "content/public/browser/browser_thread.h" - -using content::BrowserThread; namespace chromeos { MockAuthenticator::MockAuthenticator(AuthStatusConsumer* consumer, const UserContext& expected_user_context) - : Authenticator(consumer), expected_user_context_(expected_user_context) { + : Authenticator(consumer), + expected_user_context_(expected_user_context), + message_loop_(base::MessageLoopProxy::current()) { } void MockAuthenticator::CompleteLogin(Profile* profile, @@ -27,29 +27,24 @@ void MockAuthenticator::CompleteLogin(Profile* profile, void MockAuthenticator::AuthenticateToLogin(Profile* profile, const UserContext& user_context) { if (user_context == expected_user_context_) { - BrowserThread::PostTask( - BrowserThread::UI, - FROM_HERE, - base::Bind(&MockAuthenticator::OnAuthSuccess, this)); + message_loop_->PostTask( + FROM_HERE, base::Bind(&MockAuthenticator::OnAuthSuccess, this)); return; } GoogleServiceAuthError error( GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); - BrowserThread::PostTask( - BrowserThread::UI, + message_loop_->PostTask( FROM_HERE, base::Bind(&MockAuthenticator::OnAuthFailure, this, AuthFailure::FromNetworkAuthFailure(error))); } -void MockAuthenticator::AuthenticateToUnlock( - const UserContext& user_context) { +void MockAuthenticator::AuthenticateToUnlock(const UserContext& user_context) { AuthenticateToLogin(NULL /* not used */, user_context); } -void MockAuthenticator::LoginAsSupervisedUser( - const UserContext& user_context) { +void MockAuthenticator::LoginAsSupervisedUser(const UserContext& user_context) { UserContext new_user_context = user_context; new_user_context.SetUserIDHash(user_context.GetUserID()); consumer_->OnAuthSuccess(new_user_context); diff --git a/chrome/browser/chromeos/login/auth/mock_authenticator.h b/chromeos/login/auth/mock_authenticator.h index 4bd3482..19646f5 100644 --- a/chrome/browser/chromeos/login/auth/mock_authenticator.h +++ b/chromeos/login/auth/mock_authenticator.h @@ -2,12 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_MOCK_AUTHENTICATOR_H_ -#define CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_MOCK_AUTHENTICATOR_H_ +#ifndef CHROMEOS_LOGIN_AUTH_MOCK_AUTHENTICATOR_H_ +#define CHROMEOS_LOGIN_AUTH_MOCK_AUTHENTICATOR_H_ #include <string> -#include "chrome/browser/chromeos/login/auth/authenticator.h" +#include "base/message_loop/message_loop_proxy.h" +#include "chromeos/chromeos_export.h" +#include "chromeos/login/auth/authenticator.h" #include "chromeos/login/auth/user_context.h" #include "testing/gtest/include/gtest/gtest.h" @@ -17,7 +19,7 @@ namespace chromeos { class AuthStatusConsumer; -class MockAuthenticator : public Authenticator { +class CHROMEOS_EXPORT MockAuthenticator : public Authenticator { public: MockAuthenticator(AuthStatusConsumer* consumer, const UserContext& expected_user_context); @@ -28,8 +30,7 @@ class MockAuthenticator : public Authenticator { virtual void AuthenticateToLogin(Profile* profile, const UserContext& user_context) OVERRIDE; virtual void AuthenticateToUnlock(const UserContext& user_context) OVERRIDE; - virtual void LoginAsSupervisedUser( - const UserContext& user_context) OVERRIDE; + virtual void LoginAsSupervisedUser(const UserContext& user_context) OVERRIDE; virtual void LoginRetailMode() OVERRIDE; virtual void LoginOffTheRecord() OVERRIDE; virtual void LoginAsPublicAccount(const std::string& username) OVERRIDE; @@ -38,8 +39,7 @@ class MockAuthenticator : public Authenticator { virtual void OnRetailModeAuthSuccess() OVERRIDE; virtual void OnAuthSuccess() OVERRIDE; virtual void OnAuthFailure(const AuthFailure& failure) OVERRIDE; - virtual void RecoverEncryptedData( - const std::string& old_password) OVERRIDE; + virtual void RecoverEncryptedData(const std::string& old_password) OVERRIDE; virtual void ResyncEncryptedData() OVERRIDE; virtual void SetExpectedCredentials(const UserContext& user_context); @@ -49,10 +49,11 @@ class MockAuthenticator : public Authenticator { private: UserContext expected_user_context_; + scoped_refptr<base::MessageLoopProxy> message_loop_; DISALLOW_COPY_AND_ASSIGN(MockAuthenticator); }; } // namespace chromeos -#endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_MOCK_AUTHENTICATOR_H_ +#endif // CHROMEOS_LOGIN_AUTH_MOCK_AUTHENTICATOR_H_ diff --git a/chrome/browser/chromeos/login/auth/test_attempt_state.cc b/chromeos/login/auth/test_attempt_state.cc index 315e31d..a2ff719 100644 --- a/chrome/browser/chromeos/login/auth/test_attempt_state.cc +++ b/chromeos/login/auth/test_attempt_state.cc @@ -2,7 +2,7 @@ // 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/test_attempt_state.h" +#include "chromeos/login/auth/test_attempt_state.h" #include "components/user_manager/user_type.h" #include "google_apis/gaia/gaia_auth_consumer.h" @@ -18,7 +18,8 @@ TestAttemptState::TestAttemptState(const UserContext& credentials, user_is_new) { } -TestAttemptState::~TestAttemptState() {} +TestAttemptState::~TestAttemptState() { +} void TestAttemptState::PresetOnlineLoginStatus(const AuthFailure& outcome) { online_complete_ = true; diff --git a/chrome/browser/chromeos/login/auth/test_attempt_state.h b/chromeos/login/auth/test_attempt_state.h index f8e755a..43e51ee 100644 --- a/chrome/browser/chromeos/login/auth/test_attempt_state.h +++ b/chromeos/login/auth/test_attempt_state.h @@ -2,11 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_TEST_ATTEMPT_STATE_H_ -#define CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_TEST_ATTEMPT_STATE_H_ +#ifndef CHROMEOS_LOGIN_AUTH_TEST_ATTEMPT_STATE_H_ +#define CHROMEOS_LOGIN_AUTH_TEST_ATTEMPT_STATE_H_ #include "base/compiler_specific.h" -#include "chrome/browser/chromeos/login/auth/auth_attempt_state.h" +#include "chromeos/chromeos_export.h" +#include "chromeos/login/auth/auth_attempt_state.h" #include "chromeos/login/auth/auth_status_consumer.h" #include "google_apis/gaia/gaia_auth_consumer.h" @@ -14,7 +15,7 @@ namespace chromeos { class UserContext; -class TestAttemptState : public AuthAttemptState { +class CHROMEOS_EXPORT TestAttemptState : public AuthAttemptState { public: TestAttemptState(const UserContext& credentials, const bool user_is_new); @@ -45,4 +46,4 @@ class TestAttemptState : public AuthAttemptState { } // namespace chromeos -#endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_TEST_ATTEMPT_STATE_H_ +#endif // CHROMEOS_LOGIN_AUTH_TEST_ATTEMPT_STATE_H_ diff --git a/chromeos/login_event_recorder.cc b/chromeos/login_event_recorder.cc new file mode 100644 index 0000000..e2e2e3f --- /dev/null +++ b/chromeos/login_event_recorder.cc @@ -0,0 +1,37 @@ +// Copyright 2014 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 "chromeos/login_event_recorder.h" + +#include <vector> + +#include "base/lazy_instance.h" + +namespace chromeos { + +static base::LazyInstance<LoginEventRecorder> g_login_event_recorder = + LAZY_INSTANCE_INITIALIZER; + +LoginEventRecorder::LoginEventRecorder() : delegate_(NULL) { +} + +LoginEventRecorder::~LoginEventRecorder() { +} + +// static +LoginEventRecorder* LoginEventRecorder::Get() { + return g_login_event_recorder.Pointer(); +} + +void LoginEventRecorder::SetDelegate(LoginEventRecorder::Delegate* delegate) { + delegate_ = delegate; +} + +void LoginEventRecorder::AddLoginTimeMarker(const std::string& marker_name, + bool send_to_uma) { + if (delegate_) + delegate_->AddLoginTimeMarker(marker_name, send_to_uma); +} + +} // namespace chromeos diff --git a/chromeos/login_event_recorder.h b/chromeos/login_event_recorder.h new file mode 100644 index 0000000..ec695b4 --- /dev/null +++ b/chromeos/login_event_recorder.h @@ -0,0 +1,45 @@ +// Copyright 2014 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. + +#ifndef CHROMEOS_LOGIN_EVENT_RECORDER_H_ +#define CHROMEOS_LOGIN_EVENT_RECORDER_H_ + +#include <string> + +#include "base/macros.h" +#include "chromeos/chromeos_export.h" + +namespace chromeos { + +// LoginEventRecorder records the bootimes of Chrome OS. +// Actual implementation is handled by delegate. +class CHROMEOS_EXPORT LoginEventRecorder { + public: + class Delegate { + public: + virtual void AddLoginTimeMarker(const std::string& marker_name, + bool send_to_uma) = 0; + }; + LoginEventRecorder(); + virtual ~LoginEventRecorder(); + + static LoginEventRecorder* Get(); + + void SetDelegate(Delegate* delegate); + + // Add a time marker for login. A timeline will be dumped to + // /tmp/login-times-sent after login is done. If |send_to_uma| is true + // the time between this marker and the last will be sent to UMA with + // the identifier BootTime.|marker_name|. + void AddLoginTimeMarker(const std::string& marker_name, bool send_to_uma); + + private: + Delegate* delegate_; + + DISALLOW_COPY_AND_ASSIGN(LoginEventRecorder); +}; + +} // namespace chromeos + +#endif // CHROMEOS_LOGIN_EVENT_RECORDER_H_ |