OLD | NEW |
---|---|
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/arc_kiosk_controller.h" | 5 #include "chrome/browser/chromeos/login/arc_kiosk_controller.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 #include "base/timer/timer.h" | 9 #include "base/timer/timer.h" |
10 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h" | 10 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h" |
(...skipping 15 matching lines...) Expand all Loading... | |
26 | 26 |
27 ArcKioskController::ArcKioskController(LoginDisplayHost* host, OobeUI* oobe_ui) | 27 ArcKioskController::ArcKioskController(LoginDisplayHost* host, OobeUI* oobe_ui) |
28 : host_(host), | 28 : host_(host), |
29 arc_kiosk_splash_screen_view_(oobe_ui->GetArcKioskSplashScreenView()), | 29 arc_kiosk_splash_screen_view_(oobe_ui->GetArcKioskSplashScreenView()), |
30 weak_ptr_factory_(this) {} | 30 weak_ptr_factory_(this) {} |
31 | 31 |
32 ArcKioskController::~ArcKioskController() { | 32 ArcKioskController::~ArcKioskController() { |
33 arc_kiosk_splash_screen_view_->SetDelegate(nullptr); | 33 arc_kiosk_splash_screen_view_->SetDelegate(nullptr); |
34 } | 34 } |
35 | 35 |
36 void ArcKioskController::StartArcKiosk(const AccountId& account_id) { | 36 void ArcKioskController::StartArcKiosk(const AccountId& account_id, |
37 bool is_auto_launch) { | |
37 DVLOG(1) << "Starting ARC Kiosk for account: " << account_id.GetUserEmail(); | 38 DVLOG(1) << "Starting ARC Kiosk for account: " << account_id.GetUserEmail(); |
38 | 39 |
39 host_->GetWebUILoginView()->SetUIEnabled(true); | 40 host_->GetWebUILoginView()->SetUIEnabled(true); |
40 | 41 |
41 arc_kiosk_splash_screen_view_->SetDelegate(this); | 42 arc_kiosk_splash_screen_view_->SetDelegate(this); |
42 arc_kiosk_splash_screen_view_->Show(); | 43 arc_kiosk_splash_screen_view_->Show(); |
43 splash_wait_timer_.Start(FROM_HERE, kArcKioskSplashScreenMinTime, | 44 splash_wait_timer_.Start(FROM_HERE, kArcKioskSplashScreenMinTime, |
44 base::Bind(&ArcKioskController::CloseSplashScreen, | 45 base::Bind(&ArcKioskController::CloseSplashScreen, |
45 weak_ptr_factory_.GetWeakPtr())); | 46 weak_ptr_factory_.GetWeakPtr())); |
46 | 47 |
48 if (is_auto_launch) { | |
Ivan Šandrk
2017/03/16 18:30:43
If I rely on auto_launch_account_id_, I can skip t
| |
49 int auto_launch_delay = -1; | |
Luis Héctor Chávez
2017/03/16 19:42:30
nit: why not do
int auto_launch_delay = 0;
CrosSe
Ivan Šandrk
2017/03/16 22:32:50
I guess I was going by this code and tried replica
| |
50 if (!CrosSettings::Get()->GetInteger( | |
51 kAccountsPrefDeviceLocalAccountAutoLoginDelay, | |
Luis Héctor Chávez
2017/03/16 19:42:30
dumb question: can you not get this from ArcKioskA
Ivan Šandrk
2017/03/16 22:32:49
Good question! It did cross my mind actually, that
| |
52 &auto_launch_delay)) { | |
53 auto_launch_delay = 0; | |
54 } | |
55 | |
56 // Mark arc kiosk app launched with zero delay. | |
57 if (auto_launch_delay == 0) | |
58 ArcKioskAppManager::Get()->SetWasAutoLaunchedWithZeroDelay(account_id); | |
59 } | |
60 | |
47 login_performer_ = base::MakeUnique<ChromeLoginPerformer>(this); | 61 login_performer_ = base::MakeUnique<ChromeLoginPerformer>(this); |
48 login_performer_->LoginAsArcKioskAccount(account_id); | 62 login_performer_->LoginAsArcKioskAccount(account_id); |
49 } | 63 } |
50 | 64 |
51 void ArcKioskController::CleanUp() { | 65 void ArcKioskController::CleanUp() { |
52 splash_wait_timer_.Stop(); | 66 splash_wait_timer_.Stop(); |
53 // Delegate is registered only when |profile_| is set. | 67 // Delegate is registered only when |profile_| is set. |
54 if (profile_) | 68 if (profile_) |
55 ArcKioskAppService::Get(profile_)->SetDelegate(nullptr); | 69 ArcKioskAppService::Get(profile_)->SetDelegate(nullptr); |
56 if (host_) | 70 if (host_) |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
127 CloseSplashScreen(); | 141 CloseSplashScreen(); |
128 } | 142 } |
129 | 143 |
130 void ArcKioskController::OnCancelArcKioskLaunch() { | 144 void ArcKioskController::OnCancelArcKioskLaunch() { |
131 KioskAppLaunchError::Save(KioskAppLaunchError::USER_CANCEL); | 145 KioskAppLaunchError::Save(KioskAppLaunchError::USER_CANCEL); |
132 CleanUp(); | 146 CleanUp(); |
133 chrome::AttemptUserExit(); | 147 chrome::AttemptUserExit(); |
134 } | 148 } |
135 | 149 |
136 } // namespace chromeos | 150 } // namespace chromeos |
OLD | NEW |