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 AppLaunchSigninScreen::AppLaunchSigninScreen( | 16 AppLaunchSigninScreen::AppLaunchSigninScreen( |
17 OobeUI* oobe_ui, Delegate* delegate) | 17 OobeUI* oobe_ui, Delegate* delegate) |
18 : oobe_ui_(oobe_ui), | 18 : oobe_ui_(oobe_ui), |
19 delegate_(delegate), | 19 delegate_(delegate), |
20 webui_handler_(NULL) { | 20 webui_handler_(NULL), |
| 21 user_manager_for_testing_(NULL) { |
21 } | 22 } |
22 | 23 |
23 AppLaunchSigninScreen::~AppLaunchSigninScreen() { | 24 AppLaunchSigninScreen::~AppLaunchSigninScreen() { |
24 oobe_ui_->ResetSigninScreenHandlerDelegate(); | 25 oobe_ui_->ResetSigninScreenHandlerDelegate(); |
25 } | 26 } |
26 | 27 |
27 void AppLaunchSigninScreen::Show() { | 28 void AppLaunchSigninScreen::Show() { |
28 InitOwnerUserList(); | 29 InitOwnerUserList(); |
29 oobe_ui_->ShowSigninScreen(this, NULL); | 30 oobe_ui_->ShowSigninScreen(this, NULL); |
30 } | 31 } |
31 | 32 |
32 void AppLaunchSigninScreen::InitOwnerUserList() { | 33 void AppLaunchSigninScreen::InitOwnerUserList() { |
33 UserManager* user_manager = UserManager::Get(); | 34 UserManager* user_manager = GetUserManager(); |
34 const std::string& owner_email = user_manager->GetOwnerEmail(); | 35 const std::string& owner_email = user_manager->GetOwnerEmail(); |
35 const UserList& all_users = user_manager->GetUsers(); | 36 const UserList& all_users = user_manager->GetUsers(); |
36 | 37 |
37 owner_user_list_.clear(); | 38 owner_user_list_.clear(); |
38 for (UserList::const_iterator it = all_users.begin(); | 39 for (UserList::const_iterator it = all_users.begin(); |
39 it != all_users.end(); | 40 it != all_users.end(); |
40 ++it) { | 41 ++it) { |
41 User* user = *it; | 42 User* user = *it; |
42 if (user->email() == owner_email) { | 43 if (user->email() == owner_email) { |
43 owner_user_list_.push_back(user); | 44 owner_user_list_.push_back(user); |
44 break; | 45 break; |
45 } | 46 } |
46 } | 47 } |
47 } | 48 } |
48 | 49 |
| 50 UserManager* AppLaunchSigninScreen::GetUserManager() { |
| 51 return user_manager_for_testing_ ? |
| 52 user_manager_for_testing_ : UserManager::Get(); |
| 53 } |
| 54 |
49 void AppLaunchSigninScreen::CancelPasswordChangedFlow() { | 55 void AppLaunchSigninScreen::CancelPasswordChangedFlow() { |
50 NOTREACHED(); | 56 NOTREACHED(); |
51 } | 57 } |
52 | 58 |
53 void AppLaunchSigninScreen::CancelUserAdding() { | 59 void AppLaunchSigninScreen::CancelUserAdding() { |
54 NOTREACHED(); | 60 NOTREACHED(); |
55 } | 61 } |
56 | 62 |
57 void AppLaunchSigninScreen::CreateAccount() { | 63 void AppLaunchSigninScreen::CreateAccount() { |
58 NOTREACHED(); | 64 NOTREACHED(); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT_OFFLINE); | 190 HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT_OFFLINE); |
185 } | 191 } |
186 | 192 |
187 void AppLaunchSigninScreen::OnLoginSuccess(const UserContext& user_context, | 193 void AppLaunchSigninScreen::OnLoginSuccess(const UserContext& user_context, |
188 bool pending_requests, | 194 bool pending_requests, |
189 bool using_oauth) { | 195 bool using_oauth) { |
190 delegate_->OnOwnerSigninSuccess(); | 196 delegate_->OnOwnerSigninSuccess(); |
191 } | 197 } |
192 | 198 |
193 } // namespace chromeos | 199 } // namespace chromeos |
OLD | NEW |