OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/supervised/supervised_user_login_flow.h" | 5 #include "chrome/browser/chromeos/login/supervised/supervised_user_login_flow.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/command_line.h" |
8 #include "base/logging.h" | 9 #include "base/logging.h" |
9 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
10 #include "base/prefs/pref_registry_simple.h" | 11 #include "base/prefs/pref_registry_simple.h" |
11 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
12 #include "base/values.h" | 13 #include "base/values.h" |
13 #include "chrome/browser/chromeos/login/login_utils.h" | 14 #include "chrome/browser/chromeos/login/login_utils.h" |
14 #include "chrome/browser/chromeos/login/supervised/supervised_user_authenticatio
n.h" | 15 #include "chrome/browser/chromeos/login/supervised/supervised_user_authenticatio
n.h" |
15 #include "chrome/browser/chromeos/login/supervised/supervised_user_constants.h" | 16 #include "chrome/browser/chromeos/login/supervised/supervised_user_constants.h" |
16 #include "chrome/browser/chromeos/login/supervised/supervised_user_creation_scre
en.h" | 17 #include "chrome/browser/chromeos/login/supervised/supervised_user_creation_scre
en.h" |
17 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 18 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
18 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | 19 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
19 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" | 20 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" |
20 #include "chrome/browser/chromeos/login/wizard_controller.h" | 21 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 22 #include "chrome/common/chrome_switches.h" |
21 #include "chromeos/login/auth/key.h" | 23 #include "chromeos/login/auth/key.h" |
22 #include "components/user_manager/user_manager.h" | 24 #include "components/user_manager/user_manager.h" |
23 #include "content/public/browser/browser_thread.h" | 25 #include "content/public/browser/browser_thread.h" |
24 | 26 |
25 using content::BrowserThread; | 27 using content::BrowserThread; |
26 | 28 |
27 namespace chromeos { | 29 namespace chromeos { |
28 | 30 |
29 SupervisedUserLoginFlow::SupervisedUserLoginFlow( | 31 SupervisedUserLoginFlow::SupervisedUserLoginFlow( |
30 const std::string& user_id) | 32 const std::string& user_id) |
31 : ExtendedUserFlow(user_id), | 33 : ExtendedUserFlow(user_id), |
32 data_loaded_(false), | 34 data_loaded_(false), |
33 weak_factory_(this) { | 35 weak_factory_(this) { |
34 } | 36 } |
35 | 37 |
36 SupervisedUserLoginFlow::~SupervisedUserLoginFlow() {} | 38 SupervisedUserLoginFlow::~SupervisedUserLoginFlow() {} |
37 | 39 |
| 40 void SupervisedUserLoginFlow::AppendAdditionalCommandLineSwitches() { |
| 41 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); |
| 42 if (user_manager->IsCurrentUserNew()) { |
| 43 // Supervised users should launch into empty desktop on first run. |
| 44 CommandLine::ForCurrentProcess()->AppendSwitch(::switches::kSilentLaunch); |
| 45 } |
| 46 } |
| 47 |
38 bool SupervisedUserLoginFlow::CanLockScreen() { | 48 bool SupervisedUserLoginFlow::CanLockScreen() { |
39 return true; | 49 return true; |
40 } | 50 } |
41 | 51 |
42 bool SupervisedUserLoginFlow::ShouldLaunchBrowser() { | 52 bool SupervisedUserLoginFlow::ShouldLaunchBrowser() { |
43 return data_loaded_; | 53 return data_loaded_; |
44 } | 54 } |
45 | 55 |
46 bool SupervisedUserLoginFlow::ShouldSkipPostLoginScreens() { | 56 bool SupervisedUserLoginFlow::ShouldSkipPostLoginScreens() { |
47 return true; | 57 return true; |
48 } | 58 } |
49 | 59 |
50 bool SupervisedUserLoginFlow::HandleLoginFailure(const AuthFailure& failure) { | 60 bool SupervisedUserLoginFlow::HandleLoginFailure(const AuthFailure& failure) { |
51 return false; | 61 return false; |
52 } | 62 } |
53 | 63 |
54 bool SupervisedUserLoginFlow::HandlePasswordChangeDetected() { | 64 bool SupervisedUserLoginFlow::HandlePasswordChangeDetected() { |
55 return false; | 65 return false; |
56 } | 66 } |
57 | 67 |
58 void SupervisedUserLoginFlow::HandleOAuthTokenStatusChange( | |
59 user_manager::User::OAuthTokenStatus status) { | |
60 } | |
61 | |
62 void SupervisedUserLoginFlow::OnSyncSetupDataLoaded( | 68 void SupervisedUserLoginFlow::OnSyncSetupDataLoaded( |
63 const std::string& token) { | 69 const std::string& token) { |
64 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 70 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
65 ConfigureSync(token); | 71 ConfigureSync(token); |
66 } | 72 } |
67 | 73 |
68 void SupervisedUserLoginFlow::ConfigureSync(const std::string& token) { | 74 void SupervisedUserLoginFlow::ConfigureSync(const std::string& token) { |
69 data_loaded_ = true; | 75 data_loaded_ = true; |
70 | 76 |
71 // TODO(antrim): add error handling (no token loaded). | 77 // TODO(antrim): add error handling (no token loaded). |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 void SupervisedUserLoginFlow::LaunchExtraSteps( | 255 void SupervisedUserLoginFlow::LaunchExtraSteps( |
250 Profile* profile) { | 256 Profile* profile) { |
251 profile_ = profile; | 257 profile_ = profile; |
252 ChromeUserManager::Get()->GetSupervisedUserManager()->LoadSupervisedUserToken( | 258 ChromeUserManager::Get()->GetSupervisedUserManager()->LoadSupervisedUserToken( |
253 profile, | 259 profile, |
254 base::Bind(&SupervisedUserLoginFlow::OnSyncSetupDataLoaded, | 260 base::Bind(&SupervisedUserLoginFlow::OnSyncSetupDataLoaded, |
255 weak_factory_.GetWeakPtr())); | 261 weak_factory_.GetWeakPtr())); |
256 } | 262 } |
257 | 263 |
258 } // namespace chromeos | 264 } // namespace chromeos |
OLD | NEW |