| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/login/existing_user_controller.h" | 5 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "chrome/browser/chromeos/login/login_display_host.h" | 21 #include "chrome/browser/chromeos/login/login_display_host.h" |
| 22 #include "chrome/browser/chromeos/login/views_login_display.h" | 22 #include "chrome/browser/chromeos/login/views_login_display.h" |
| 23 #include "chrome/browser/chromeos/login/wizard_accessibility_helper.h" | 23 #include "chrome/browser/chromeos/login/wizard_accessibility_helper.h" |
| 24 #include "chrome/browser/chromeos/login/wizard_controller.h" | 24 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 25 #include "chrome/browser/chromeos/status/status_area_view.h" | 25 #include "chrome/browser/chromeos/status/status_area_view.h" |
| 26 #include "chrome/browser/chromeos/user_cros_settings_provider.h" | 26 #include "chrome/browser/chromeos/user_cros_settings_provider.h" |
| 27 #include "chrome/browser/google/google_util.h" | 27 #include "chrome/browser/google/google_util.h" |
| 28 #include "chrome/browser/prefs/pref_service.h" | 28 #include "chrome/browser/prefs/pref_service.h" |
| 29 #include "chrome/browser/profiles/profile_manager.h" | 29 #include "chrome/browser/profiles/profile_manager.h" |
| 30 #include "chrome/browser/ui/views/window.h" | 30 #include "chrome/browser/ui/views/window.h" |
| 31 #include "chrome/common/chrome_notification_types.h" |
| 31 #include "chrome/common/chrome_switches.h" | 32 #include "chrome/common/chrome_switches.h" |
| 32 #include "chrome/common/net/gaia/google_service_auth_error.h" | 33 #include "chrome/common/net/gaia/google_service_auth_error.h" |
| 33 #include "chrome/common/pref_names.h" | 34 #include "chrome/common/pref_names.h" |
| 35 #include "content/common/content_notification_types.h" |
| 34 #include "content/common/notification_service.h" | 36 #include "content/common/notification_service.h" |
| 35 #include "content/common/notification_type.h" | |
| 36 #include "grit/generated_resources.h" | 37 #include "grit/generated_resources.h" |
| 37 #include "ui/base/l10n/l10n_util.h" | 38 #include "ui/base/l10n/l10n_util.h" |
| 38 #include "views/widget/widget.h" | 39 #include "views/widget/widget.h" |
| 39 | 40 |
| 40 namespace chromeos { | 41 namespace chromeos { |
| 41 | 42 |
| 42 namespace { | 43 namespace { |
| 43 | 44 |
| 44 // Url for setting up sync authentication. | 45 // Url for setting up sync authentication. |
| 45 const char kSettingsSyncLoginURL[] = "chrome://settings/personal"; | 46 const char kSettingsSyncLoginURL[] = "chrome://settings/personal"; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 73 host_(host), | 74 host_(host), |
| 74 num_login_attempts_(0), | 75 num_login_attempts_(0), |
| 75 user_settings_(new UserCrosSettingsProvider), | 76 user_settings_(new UserCrosSettingsProvider), |
| 76 method_factory_(this) { | 77 method_factory_(this) { |
| 77 DCHECK(current_controller_ == NULL); | 78 DCHECK(current_controller_ == NULL); |
| 78 current_controller_ = this; | 79 current_controller_ = this; |
| 79 | 80 |
| 80 login_display_ = host_->CreateLoginDisplay(this); | 81 login_display_ = host_->CreateLoginDisplay(this); |
| 81 | 82 |
| 82 registrar_.Add(this, | 83 registrar_.Add(this, |
| 83 NotificationType::LOGIN_USER_IMAGE_CHANGED, | 84 chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED, |
| 84 NotificationService::AllSources()); | 85 NotificationService::AllSources()); |
| 85 } | 86 } |
| 86 | 87 |
| 87 void ExistingUserController::Init(const UserVector& users) { | 88 void ExistingUserController::Init(const UserVector& users) { |
| 88 UserVector filtered_users; | 89 UserVector filtered_users; |
| 89 if (UserCrosSettingsProvider::cached_show_users_on_signin()) { | 90 if (UserCrosSettingsProvider::cached_show_users_on_signin()) { |
| 90 for (size_t i = 0; i < users.size(); ++i) | 91 for (size_t i = 0; i < users.size(); ++i) |
| 91 // TODO(xiyuan): Clean user profile whose email is not in whitelist. | 92 // TODO(xiyuan): Clean user profile whose email is not in whitelist. |
| 92 if (UserCrosSettingsProvider::cached_allow_new_user() || | 93 if (UserCrosSettingsProvider::cached_allow_new_user() || |
| 93 UserCrosSettingsProvider::IsEmailInCachedWhitelist( | 94 UserCrosSettingsProvider::IsEmailInCachedWhitelist( |
| (...skipping 13 matching lines...) Expand all Loading... |
| 107 LoginUtils::Get()->PrewarmAuthentication(); | 108 LoginUtils::Get()->PrewarmAuthentication(); |
| 108 if (CrosLibrary::Get()->EnsureLoaded()) | 109 if (CrosLibrary::Get()->EnsureLoaded()) |
| 109 CrosLibrary::Get()->GetLoginLibrary()->EmitLoginPromptReady(); | 110 CrosLibrary::Get()->GetLoginLibrary()->EmitLoginPromptReady(); |
| 110 StartAutomaticFreeDiskSpaceControl(); | 111 StartAutomaticFreeDiskSpaceControl(); |
| 111 } | 112 } |
| 112 | 113 |
| 113 //////////////////////////////////////////////////////////////////////////////// | 114 //////////////////////////////////////////////////////////////////////////////// |
| 114 // ExistingUserController, NotificationObserver implementation: | 115 // ExistingUserController, NotificationObserver implementation: |
| 115 // | 116 // |
| 116 | 117 |
| 117 void ExistingUserController::Observe(NotificationType type, | 118 void ExistingUserController::Observe(int type, |
| 118 const NotificationSource& source, | 119 const NotificationSource& source, |
| 119 const NotificationDetails& details) { | 120 const NotificationDetails& details) { |
| 120 if (type != NotificationType::LOGIN_USER_IMAGE_CHANGED) | 121 if (type != chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED) |
| 121 return; | 122 return; |
| 122 | 123 |
| 123 UserManager::User* user = Details<UserManager::User>(details).ptr(); | 124 UserManager::User* user = Details<UserManager::User>(details).ptr(); |
| 124 login_display_->OnUserImageChanged(user); | 125 login_display_->OnUserImageChanged(user); |
| 125 } | 126 } |
| 126 | 127 |
| 127 //////////////////////////////////////////////////////////////////////////////// | 128 //////////////////////////////////////////////////////////////////////////////// |
| 128 // ExistingUserController, private: | 129 // ExistingUserController, private: |
| 129 | 130 |
| 130 ExistingUserController::~ExistingUserController() { | 131 ExistingUserController::~ExistingUserController() { |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 } | 520 } |
| 520 if (CrosLibrary::Get()->EnsureLoaded()) { | 521 if (CrosLibrary::Get()->EnsureLoaded()) { |
| 521 CryptohomeLibrary* cryptohomed = CrosLibrary::Get()->GetCryptohomeLibrary(); | 522 CryptohomeLibrary* cryptohomed = CrosLibrary::Get()->GetCryptohomeLibrary(); |
| 522 cryptohomed->AsyncSetOwnerUser( | 523 cryptohomed->AsyncSetOwnerUser( |
| 523 UserCrosSettingsProvider::cached_owner(), NULL); | 524 UserCrosSettingsProvider::cached_owner(), NULL); |
| 524 cryptohomed->AsyncDoAutomaticFreeDiskSpaceControl(NULL); | 525 cryptohomed->AsyncDoAutomaticFreeDiskSpaceControl(NULL); |
| 525 } | 526 } |
| 526 } | 527 } |
| 527 | 528 |
| 528 } // namespace chromeos | 529 } // namespace chromeos |
| OLD | NEW |