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::SupportsEarlyRestartToApplyFlags() { | 60 bool SupervisedUserLoginFlow::SupportsEarlyRestartToApplyFlags() { |
51 return false; | 61 return false; |
52 } | 62 } |
53 | 63 |
54 bool SupervisedUserLoginFlow::HandleLoginFailure(const AuthFailure& failure) { | 64 bool SupervisedUserLoginFlow::HandleLoginFailure(const AuthFailure& failure) { |
55 return false; | 65 return false; |
56 } | 66 } |
57 | 67 |
58 bool SupervisedUserLoginFlow::HandlePasswordChangeDetected() { | 68 bool SupervisedUserLoginFlow::HandlePasswordChangeDetected() { |
59 return false; | 69 return false; |
60 } | 70 } |
61 | 71 |
62 void SupervisedUserLoginFlow::HandleOAuthTokenStatusChange( | |
63 user_manager::User::OAuthTokenStatus status) { | |
64 } | |
65 | |
66 void SupervisedUserLoginFlow::OnSyncSetupDataLoaded( | 72 void SupervisedUserLoginFlow::OnSyncSetupDataLoaded( |
67 const std::string& token) { | 73 const std::string& token) { |
68 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 74 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
69 ConfigureSync(token); | 75 ConfigureSync(token); |
70 } | 76 } |
71 | 77 |
72 void SupervisedUserLoginFlow::ConfigureSync(const std::string& token) { | 78 void SupervisedUserLoginFlow::ConfigureSync(const std::string& token) { |
73 data_loaded_ = true; | 79 data_loaded_ = true; |
74 | 80 |
75 // TODO(antrim): add error handling (no token loaded). | 81 // TODO(antrim): add error handling (no token loaded). |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 void SupervisedUserLoginFlow::LaunchExtraSteps( | 259 void SupervisedUserLoginFlow::LaunchExtraSteps( |
254 Profile* profile) { | 260 Profile* profile) { |
255 profile_ = profile; | 261 profile_ = profile; |
256 ChromeUserManager::Get()->GetSupervisedUserManager()->LoadSupervisedUserToken( | 262 ChromeUserManager::Get()->GetSupervisedUserManager()->LoadSupervisedUserToken( |
257 profile, | 263 profile, |
258 base::Bind(&SupervisedUserLoginFlow::OnSyncSetupDataLoaded, | 264 base::Bind(&SupervisedUserLoginFlow::OnSyncSetupDataLoaded, |
259 weak_factory_.GetWeakPtr())); | 265 weak_factory_.GetWeakPtr())); |
260 } | 266 } |
261 | 267 |
262 } // namespace chromeos | 268 } // namespace chromeos |
OLD | NEW |