| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/app_launch_signin_screen.h" | 5 #include "chrome/browser/chromeos/login/app_launch_signin_screen.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chromeos/login/help_app_launcher.h" | 7 #include "chrome/browser/chromeos/login/help_app_launcher.h" |
| 8 #include "chrome/browser/chromeos/login/login_utils.h" | 8 #include "chrome/browser/chromeos/login/login_utils.h" |
| 9 #include "chrome/browser/chromeos/login/user.h" | 9 #include "chrome/browser/chromeos/login/user.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| 11 #include "grit/generated_resources.h" | 11 #include "grit/generated_resources.h" |
| 12 #include "ui/base/l10n/l10n_util.h" | 12 #include "ui/base/l10n/l10n_util.h" |
| 13 | 13 |
| 14 namespace chromeos { | 14 namespace chromeos { |
| 15 | 15 |
| 16 UserManager* AppLaunchSigninScreen::test_user_manager_ = NULL; |
| 17 |
| 16 AppLaunchSigninScreen::AppLaunchSigninScreen( | 18 AppLaunchSigninScreen::AppLaunchSigninScreen( |
| 17 OobeUI* oobe_ui, Delegate* delegate) | 19 OobeUI* oobe_ui, Delegate* delegate) |
| 18 : oobe_ui_(oobe_ui), | 20 : oobe_ui_(oobe_ui), |
| 19 delegate_(delegate), | 21 delegate_(delegate), |
| 20 webui_handler_(NULL) { | 22 webui_handler_(NULL) { |
| 21 } | 23 } |
| 22 | 24 |
| 23 AppLaunchSigninScreen::~AppLaunchSigninScreen() { | 25 AppLaunchSigninScreen::~AppLaunchSigninScreen() { |
| 24 oobe_ui_->ResetSigninScreenHandlerDelegate(); | 26 oobe_ui_->ResetSigninScreenHandlerDelegate(); |
| 25 } | 27 } |
| 26 | 28 |
| 27 void AppLaunchSigninScreen::Show() { | 29 void AppLaunchSigninScreen::Show() { |
| 28 InitOwnerUserList(); | 30 InitOwnerUserList(); |
| 29 oobe_ui_->ShowSigninScreen(this, NULL); | 31 oobe_ui_->ShowSigninScreen(this, NULL); |
| 30 } | 32 } |
| 31 | 33 |
| 32 void AppLaunchSigninScreen::InitOwnerUserList() { | 34 void AppLaunchSigninScreen::InitOwnerUserList() { |
| 33 UserManager* user_manager = UserManager::Get(); | 35 UserManager* user_manager = GetUserManager(); |
| 34 const std::string& owner_email = user_manager->GetOwnerEmail(); | 36 const std::string& owner_email = user_manager->GetOwnerEmail(); |
| 35 const UserList& all_users = user_manager->GetUsers(); | 37 const UserList& all_users = user_manager->GetUsers(); |
| 36 | 38 |
| 37 owner_user_list_.clear(); | 39 owner_user_list_.clear(); |
| 38 for (UserList::const_iterator it = all_users.begin(); | 40 for (UserList::const_iterator it = all_users.begin(); |
| 39 it != all_users.end(); | 41 it != all_users.end(); |
| 40 ++it) { | 42 ++it) { |
| 41 User* user = *it; | 43 User* user = *it; |
| 42 if (user->email() == owner_email) { | 44 if (user->email() == owner_email) { |
| 43 owner_user_list_.push_back(user); | 45 owner_user_list_.push_back(user); |
| 44 break; | 46 break; |
| 45 } | 47 } |
| 46 } | 48 } |
| 47 } | 49 } |
| 48 | 50 |
| 51 // static |
| 52 void AppLaunchSigninScreen::SetUserManagerForTesting( |
| 53 UserManager* user_manager) { |
| 54 test_user_manager_ = user_manager; |
| 55 } |
| 56 |
| 57 UserManager* AppLaunchSigninScreen::GetUserManager() { |
| 58 return test_user_manager_ ? test_user_manager_ : UserManager::Get(); |
| 59 } |
| 60 |
| 49 void AppLaunchSigninScreen::CancelPasswordChangedFlow() { | 61 void AppLaunchSigninScreen::CancelPasswordChangedFlow() { |
| 50 NOTREACHED(); | 62 NOTREACHED(); |
| 51 } | 63 } |
| 52 | 64 |
| 53 void AppLaunchSigninScreen::CancelUserAdding() { | 65 void AppLaunchSigninScreen::CancelUserAdding() { |
| 54 NOTREACHED(); | 66 NOTREACHED(); |
| 55 } | 67 } |
| 56 | 68 |
| 57 void AppLaunchSigninScreen::CreateAccount() { | 69 void AppLaunchSigninScreen::CreateAccount() { |
| 58 NOTREACHED(); | 70 NOTREACHED(); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT_OFFLINE); | 196 HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT_OFFLINE); |
| 185 } | 197 } |
| 186 | 198 |
| 187 void AppLaunchSigninScreen::OnLoginSuccess(const UserContext& user_context, | 199 void AppLaunchSigninScreen::OnLoginSuccess(const UserContext& user_context, |
| 188 bool pending_requests, | 200 bool pending_requests, |
| 189 bool using_oauth) { | 201 bool using_oauth) { |
| 190 delegate_->OnOwnerSigninSuccess(); | 202 delegate_->OnOwnerSigninSuccess(); |
| 191 } | 203 } |
| 192 | 204 |
| 193 } // namespace chromeos | 205 } // namespace chromeos |
| OLD | NEW |