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 "base/values.h" | 7 #include "base/values.h" |
8 #include "chrome/browser/chromeos/login/help_app_launcher.h" | 8 #include "chrome/browser/chromeos/login/help_app_launcher.h" |
9 #include "chrome/browser/chromeos/login/login_utils.h" | 9 #include "chrome/browser/chromeos/login/login_utils.h" |
10 #include "chrome/browser/chromeos/login/screens/user_selection_screen.h" | 10 #include "chrome/browser/chromeos/login/screens/user_selection_screen.h" |
11 #include "chrome/browser/signin/screenlock_bridge.h" | 11 #include "chrome/browser/signin/screenlock_bridge.h" |
12 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" | 12 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" |
13 #include "chrome/grit/generated_resources.h" | 13 #include "chrome/grit/generated_resources.h" |
| 14 #include "components/user_manager/user_manager.h" |
14 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
15 #include "content/public/browser/web_ui.h" | 16 #include "content/public/browser/web_ui.h" |
16 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
17 | 18 |
18 namespace chromeos { | 19 namespace chromeos { |
19 | 20 |
20 UserManager* AppLaunchSigninScreen::test_user_manager_ = NULL; | 21 user_manager::UserManager* AppLaunchSigninScreen::test_user_manager_ = NULL; |
21 | 22 |
22 AppLaunchSigninScreen::AppLaunchSigninScreen( | 23 AppLaunchSigninScreen::AppLaunchSigninScreen( |
23 OobeUI* oobe_ui, Delegate* delegate) | 24 OobeUI* oobe_ui, Delegate* delegate) |
24 : oobe_ui_(oobe_ui), | 25 : oobe_ui_(oobe_ui), |
25 delegate_(delegate), | 26 delegate_(delegate), |
26 webui_handler_(NULL) { | 27 webui_handler_(NULL) { |
27 } | 28 } |
28 | 29 |
29 AppLaunchSigninScreen::~AppLaunchSigninScreen() { | 30 AppLaunchSigninScreen::~AppLaunchSigninScreen() { |
30 oobe_ui_->ResetSigninScreenHandlerDelegate(); | 31 oobe_ui_->ResetSigninScreenHandlerDelegate(); |
31 } | 32 } |
32 | 33 |
33 void AppLaunchSigninScreen::Show() { | 34 void AppLaunchSigninScreen::Show() { |
34 InitOwnerUserList(); | 35 InitOwnerUserList(); |
35 oobe_ui_->web_ui()->CallJavascriptFunction( | 36 oobe_ui_->web_ui()->CallJavascriptFunction( |
36 "login.AccountPickerScreen.setShouldShowApps", | 37 "login.AccountPickerScreen.setShouldShowApps", |
37 base::FundamentalValue(false)); | 38 base::FundamentalValue(false)); |
38 oobe_ui_->ShowSigninScreen(LoginScreenContext(), this, NULL); | 39 oobe_ui_->ShowSigninScreen(LoginScreenContext(), this, NULL); |
39 } | 40 } |
40 | 41 |
41 void AppLaunchSigninScreen::InitOwnerUserList() { | 42 void AppLaunchSigninScreen::InitOwnerUserList() { |
42 UserManager* user_manager = GetUserManager(); | 43 user_manager::UserManager* user_manager = GetUserManager(); |
43 const std::string& owner_email = user_manager->GetOwnerEmail(); | 44 const std::string& owner_email = user_manager->GetOwnerEmail(); |
44 const user_manager::UserList& all_users = user_manager->GetUsers(); | 45 const user_manager::UserList& all_users = user_manager->GetUsers(); |
45 | 46 |
46 owner_user_list_.clear(); | 47 owner_user_list_.clear(); |
47 for (user_manager::UserList::const_iterator it = all_users.begin(); | 48 for (user_manager::UserList::const_iterator it = all_users.begin(); |
48 it != all_users.end(); | 49 it != all_users.end(); |
49 ++it) { | 50 ++it) { |
50 user_manager::User* user = *it; | 51 user_manager::User* user = *it; |
51 if (user->email() == owner_email) { | 52 if (user->email() == owner_email) { |
52 owner_user_list_.push_back(user); | 53 owner_user_list_.push_back(user); |
53 break; | 54 break; |
54 } | 55 } |
55 } | 56 } |
56 } | 57 } |
57 | 58 |
58 // static | 59 // static |
59 void AppLaunchSigninScreen::SetUserManagerForTesting( | 60 void AppLaunchSigninScreen::SetUserManagerForTesting( |
60 UserManager* user_manager) { | 61 user_manager::UserManager* user_manager) { |
61 test_user_manager_ = user_manager; | 62 test_user_manager_ = user_manager; |
62 } | 63 } |
63 | 64 |
64 UserManager* AppLaunchSigninScreen::GetUserManager() { | 65 user_manager::UserManager* AppLaunchSigninScreen::GetUserManager() { |
65 return test_user_manager_ ? test_user_manager_ : UserManager::Get(); | 66 return test_user_manager_ ? test_user_manager_ |
| 67 : user_manager::UserManager::Get(); |
66 } | 68 } |
67 | 69 |
68 void AppLaunchSigninScreen::CancelPasswordChangedFlow() { | 70 void AppLaunchSigninScreen::CancelPasswordChangedFlow() { |
69 NOTREACHED(); | 71 NOTREACHED(); |
70 } | 72 } |
71 | 73 |
72 void AppLaunchSigninScreen::CancelUserAdding() { | 74 void AppLaunchSigninScreen::CancelUserAdding() { |
73 NOTREACHED(); | 75 NOTREACHED(); |
74 } | 76 } |
75 | 77 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 ScreenlockBridge::LockHandler::AuthType auth_type) { | 219 ScreenlockBridge::LockHandler::AuthType auth_type) { |
218 return; | 220 return; |
219 } | 221 } |
220 | 222 |
221 ScreenlockBridge::LockHandler::AuthType AppLaunchSigninScreen::GetAuthType( | 223 ScreenlockBridge::LockHandler::AuthType AppLaunchSigninScreen::GetAuthType( |
222 const std::string& username) const { | 224 const std::string& username) const { |
223 return ScreenlockBridge::LockHandler::OFFLINE_PASSWORD; | 225 return ScreenlockBridge::LockHandler::OFFLINE_PASSWORD; |
224 } | 226 } |
225 | 227 |
226 } // namespace chromeos | 228 } // namespace chromeos |
OLD | NEW |