Cast: Stop logging kVideoFrameSentToEncoder and rename a couple events.
[chromium-blink-merge.git] / chrome / browser / chromeos / login / app_launch_signin_screen.cc
blobd2a91f0b6452d455f46c4592b5824bef35980253
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
3 // found in the LICENSE file.
5 #include "chrome/browser/chromeos/login/app_launch_signin_screen.h"
7 #include "base/values.h"
8 #include "chrome/browser/chromeos/login/help_app_launcher.h"
9 #include "chrome/browser/chromeos/login/login_utils.h"
10 #include "chrome/browser/chromeos/login/user.h"
11 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h"
12 #include "content/public/browser/browser_thread.h"
13 #include "content/public/browser/web_ui.h"
14 #include "grit/generated_resources.h"
15 #include "ui/base/l10n/l10n_util.h"
17 namespace chromeos {
19 UserManager* AppLaunchSigninScreen::test_user_manager_ = NULL;
21 AppLaunchSigninScreen::AppLaunchSigninScreen(
22 OobeUI* oobe_ui, Delegate* delegate)
23 : oobe_ui_(oobe_ui),
24 delegate_(delegate),
25 webui_handler_(NULL) {
28 AppLaunchSigninScreen::~AppLaunchSigninScreen() {
29 oobe_ui_->ResetSigninScreenHandlerDelegate();
32 void AppLaunchSigninScreen::Show() {
33 InitOwnerUserList();
34 oobe_ui_->web_ui()->CallJavascriptFunction(
35 "login.AccountPickerScreen.setShouldShowApps",
36 base::FundamentalValue(false));
37 oobe_ui_->ShowSigninScreen(LoginScreenContext(), this, NULL);
40 void AppLaunchSigninScreen::InitOwnerUserList() {
41 UserManager* user_manager = GetUserManager();
42 const std::string& owner_email = user_manager->GetOwnerEmail();
43 const UserList& all_users = user_manager->GetUsers();
45 owner_user_list_.clear();
46 for (UserList::const_iterator it = all_users.begin();
47 it != all_users.end();
48 ++it) {
49 User* user = *it;
50 if (user->email() == owner_email) {
51 owner_user_list_.push_back(user);
52 break;
57 // static
58 void AppLaunchSigninScreen::SetUserManagerForTesting(
59 UserManager* user_manager) {
60 test_user_manager_ = user_manager;
63 UserManager* AppLaunchSigninScreen::GetUserManager() {
64 return test_user_manager_ ? test_user_manager_ : UserManager::Get();
67 void AppLaunchSigninScreen::CancelPasswordChangedFlow() {
68 NOTREACHED();
71 void AppLaunchSigninScreen::CancelUserAdding() {
72 NOTREACHED();
75 void AppLaunchSigninScreen::CreateAccount() {
76 NOTREACHED();
79 void AppLaunchSigninScreen::CompleteLogin(const UserContext& user_context) {
80 NOTREACHED();
83 void AppLaunchSigninScreen::Login(const UserContext& user_context) {
84 // Note: LoginUtils::CreateAuthenticator doesn't necessarily create
85 // a new Authenticator object, and could reuse an existing one.
86 authenticator_ = LoginUtils::Get()->CreateAuthenticator(this);
87 content::BrowserThread::PostTask(
88 content::BrowserThread::UI, FROM_HERE,
89 base::Bind(&Authenticator::AuthenticateToUnlock,
90 authenticator_.get(),
91 user_context));
94 void AppLaunchSigninScreen::LoginAsRetailModeUser() {
95 NOTREACHED();
98 void AppLaunchSigninScreen::LoginAsGuest() {
99 NOTREACHED();
102 void AppLaunchSigninScreen::MigrateUserData(const std::string& old_password) {
103 NOTREACHED();
106 void AppLaunchSigninScreen::LoginAsPublicAccount(const std::string& username) {
107 NOTREACHED();
110 void AppLaunchSigninScreen::LoadWallpaper(const std::string& username) {
113 void AppLaunchSigninScreen::LoadSigninWallpaper() {
116 void AppLaunchSigninScreen::OnSigninScreenReady() {
119 void AppLaunchSigninScreen::RemoveUser(const std::string& username) {
120 NOTREACHED();
123 void AppLaunchSigninScreen::ResyncUserData() {
124 NOTREACHED();
127 void AppLaunchSigninScreen::ShowEnterpriseEnrollmentScreen() {
128 NOTREACHED();
131 void AppLaunchSigninScreen::ShowKioskEnableScreen() {
132 NOTREACHED();
135 void AppLaunchSigninScreen::ShowKioskAutolaunchScreen() {
136 NOTREACHED();
139 void AppLaunchSigninScreen::ShowWrongHWIDScreen() {
140 NOTREACHED();
143 void AppLaunchSigninScreen::SetWebUIHandler(
144 LoginDisplayWebUIHandler* webui_handler) {
145 webui_handler_ = webui_handler;
148 void AppLaunchSigninScreen::ShowSigninScreenForCreds(
149 const std::string& username,
150 const std::string& password) {
151 NOTREACHED();
154 const UserList& AppLaunchSigninScreen::GetUsers() const {
155 return owner_user_list_;
158 bool AppLaunchSigninScreen::IsShowGuest() const {
159 return false;
162 bool AppLaunchSigninScreen::IsShowUsers() const {
163 return true;
166 bool AppLaunchSigninScreen::IsShowNewUser() const {
167 return false;
170 bool AppLaunchSigninScreen::IsSigninInProgress() const {
171 // Return true to suppress network processing in the signin screen.
172 return true;
175 bool AppLaunchSigninScreen::IsUserSigninCompleted() const {
176 return false;
179 void AppLaunchSigninScreen::SetDisplayEmail(const std::string& email) {
180 return;
183 void AppLaunchSigninScreen::Signout() {
184 NOTREACHED();
187 void AppLaunchSigninScreen::LoginAsKioskApp(const std::string& app_id,
188 bool diagnostic_mode) {
189 NOTREACHED();
192 void AppLaunchSigninScreen::OnLoginFailure(const LoginFailure& error) {
193 LOG(ERROR) << "Unlock failure: " << error.reason();
194 webui_handler_->ClearAndEnablePassword();
195 webui_handler_->ShowError(
197 l10n_util::GetStringUTF8(IDS_LOGIN_ERROR_AUTHENTICATING_KIOSK),
198 std::string(),
199 HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT_OFFLINE);
202 void AppLaunchSigninScreen::OnLoginSuccess(const UserContext& user_context) {
203 delegate_->OnOwnerSigninSuccess();
206 } // namespace chromeos