OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/enrollment/enterprise_enrollment_screen.
h" | 5 #include "chrome/browser/chromeos/login/enrollment/enterprise_enrollment_screen.
h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/chromeos/cros/cros_library.h" | 12 #include "chrome/browser/chromeos/cros/cros_library.h" |
13 #include "chrome/browser/chromeos/cros/cryptohome_library.h" | 13 #include "chrome/browser/chromeos/cros/cryptohome_library.h" |
14 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" | |
15 #include "chrome/browser/chromeos/dbus/session_manager_client.h" | |
16 #include "chrome/browser/chromeos/login/authenticator.h" | 14 #include "chrome/browser/chromeos/login/authenticator.h" |
17 #include "chrome/browser/chromeos/login/screen_observer.h" | 15 #include "chrome/browser/chromeos/login/screen_observer.h" |
18 #include "chrome/browser/policy/auto_enrollment_client.h" | 16 #include "chrome/browser/policy/auto_enrollment_client.h" |
19 #include "chrome/browser/policy/browser_policy_connector.h" | 17 #include "chrome/browser/policy/browser_policy_connector.h" |
20 #include "chrome/browser/policy/cloud_policy_data_store.h" | 18 #include "chrome/browser/policy/cloud_policy_data_store.h" |
21 #include "chrome/browser/policy/enterprise_metrics.h" | 19 #include "chrome/browser/policy/enterprise_metrics.h" |
22 | 20 |
23 namespace chromeos { | 21 namespace chromeos { |
24 | 22 |
25 namespace { | 23 namespace { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 } | 71 } |
74 | 72 |
75 void EnterpriseEnrollmentScreen::OnOAuthTokenAvailable( | 73 void EnterpriseEnrollmentScreen::OnOAuthTokenAvailable( |
76 const std::string& user, | 74 const std::string& user, |
77 const std::string& token) { | 75 const std::string& token) { |
78 user_ = Authenticator::Canonicalize(user); | 76 user_ = Authenticator::Canonicalize(user); |
79 RegisterForDevicePolicy(token); | 77 RegisterForDevicePolicy(token); |
80 } | 78 } |
81 | 79 |
82 void EnterpriseEnrollmentScreen::OnConfirmationClosed(bool go_back_to_signin) { | 80 void EnterpriseEnrollmentScreen::OnConfirmationClosed(bool go_back_to_signin) { |
83 // If the machine has been put in KIOSK mode we have to restart the session | |
84 // here to go in the proper KIOSK mode login screen. | |
85 if (g_browser_process->browser_policy_connector()-> | |
86 GetDeviceCloudPolicyDataStore()->device_mode() == | |
87 policy::DEVICE_MODE_KIOSK) { | |
88 DBusThreadManager::Get()->GetSessionManagerClient()->StopSession(); | |
89 return; | |
90 } | |
91 | |
92 get_screen_observer()->OnExit(go_back_to_signin ? | 81 get_screen_observer()->OnExit(go_back_to_signin ? |
93 ScreenObserver::ENTERPRISE_ENROLLMENT_COMPLETED : | 82 ScreenObserver::ENTERPRISE_ENROLLMENT_COMPLETED : |
94 ScreenObserver::ENTERPRISE_AUTO_MAGIC_ENROLLMENT_COMPLETED); | 83 ScreenObserver::ENTERPRISE_AUTO_MAGIC_ENROLLMENT_COMPLETED); |
95 } | 84 } |
96 | 85 |
97 bool EnterpriseEnrollmentScreen::IsAutoEnrollment(std::string* user) { | 86 bool EnterpriseEnrollmentScreen::IsAutoEnrollment(std::string* user) { |
98 if (is_auto_enrollment_) | 87 if (is_auto_enrollment_) |
99 *user = user_; | 88 *user = user_; |
100 return is_auto_enrollment_; | 89 return is_auto_enrollment_; |
101 } | 90 } |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 // and notify us of progress through CloudPolicySubsystem::Observer. | 215 // and notify us of progress through CloudPolicySubsystem::Observer. |
227 connector->RegisterForDevicePolicy(user_, token, is_auto_enrollment_); | 216 connector->RegisterForDevicePolicy(user_, token, is_auto_enrollment_); |
228 return; | 217 return; |
229 } | 218 } |
230 NOTREACHED(); | 219 NOTREACHED(); |
231 if (is_showing_) | 220 if (is_showing_) |
232 actor_->ShowFatalEnrollmentError(); | 221 actor_->ShowFatalEnrollmentError(); |
233 } | 222 } |
234 | 223 |
235 } // namespace chromeos | 224 } // namespace chromeos |
OLD | NEW |