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/auth/parallel_authenticator.h" | 5 #include "chrome/browser/chromeos/login/auth/parallel_authenticator.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "chrome/browser/chrome_notification_types.h" | 11 #include "chrome/browser/chrome_notification_types.h" |
12 #include "chrome/browser/chromeos/boot_times_loader.h" | 12 #include "chrome/browser/chromeos/boot_times_loader.h" |
13 | |
Nikita (slow)
2014/07/07 21:05:40
nit: drop empty line
Denis Kuznetsov (DE-MUC)
2014/07/08 11:08:28
Done.
| |
13 #include "chrome/browser/chromeos/login/auth/authentication_notification_details .h" | 14 #include "chrome/browser/chromeos/login/auth/authentication_notification_details .h" |
14 #include "chrome/browser/chromeos/login/auth/key.h" | |
15 #include "chrome/browser/chromeos/login/auth/login_status_consumer.h" | 15 #include "chrome/browser/chromeos/login/auth/login_status_consumer.h" |
16 #include "chrome/browser/chromeos/login/auth/user_context.h" | |
17 #include "chrome/browser/chromeos/login/users/user_manager.h" | 16 #include "chrome/browser/chromeos/login/users/user_manager.h" |
18 #include "chrome/browser/chromeos/ownership/owner_settings_service.h" | 17 #include "chrome/browser/chromeos/ownership/owner_settings_service.h" |
19 #include "chrome/browser/chromeos/ownership/owner_settings_service_factory.h" | 18 #include "chrome/browser/chromeos/ownership/owner_settings_service_factory.h" |
20 #include "chrome/browser/chromeos/settings/cros_settings.h" | 19 #include "chrome/browser/chromeos/settings/cros_settings.h" |
21 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
22 #include "chromeos/cryptohome/async_method_caller.h" | 21 #include "chromeos/cryptohome/async_method_caller.h" |
23 #include "chromeos/cryptohome/system_salt_getter.h" | 22 #include "chromeos/cryptohome/system_salt_getter.h" |
24 #include "chromeos/dbus/cryptohome_client.h" | 23 #include "chromeos/dbus/cryptohome_client.h" |
25 #include "chromeos/dbus/dbus_thread_manager.h" | 24 #include "chromeos/dbus/dbus_thread_manager.h" |
25 #include "chromeos/login/auth/key.h" | |
26 #include "chromeos/login/auth/user_context.h" | |
26 #include "chromeos/login/login_state.h" | 27 #include "chromeos/login/login_state.h" |
28 #include "chromeos/login/user_names.h" | |
27 #include "components/user_manager/user_type.h" | 29 #include "components/user_manager/user_type.h" |
28 #include "content/public/browser/browser_thread.h" | 30 #include "content/public/browser/browser_thread.h" |
29 #include "content/public/browser/notification_service.h" | 31 #include "content/public/browser/notification_service.h" |
30 #include "third_party/cros_system_api/dbus/service_constants.h" | 32 #include "third_party/cros_system_api/dbus/service_constants.h" |
31 | |
32 using content::BrowserThread; | 33 using content::BrowserThread; |
Nikita (slow)
2014/07/07 21:05:40
nit: insert empty line
Denis Kuznetsov (DE-MUC)
2014/07/08 11:08:28
Done.
| |
33 | 34 |
34 namespace chromeos { | 35 namespace chromeos { |
35 | 36 |
36 namespace { | 37 namespace { |
37 | 38 |
38 // Hashes |key| with |system_salt| if it its type is KEY_TYPE_PASSWORD_PLAIN. | 39 // Hashes |key| with |system_salt| if it its type is KEY_TYPE_PASSWORD_PLAIN. |
39 // Returns the keys unmodified otherwise. | 40 // Returns the keys unmodified otherwise. |
40 scoped_ptr<Key> TransformKeyIfNeeded(const Key& key, | 41 scoped_ptr<Key> TransformKeyIfNeeded(const Key& key, |
41 const std::string& system_salt) { | 42 const std::string& system_salt) { |
42 scoped_ptr<Key> result(new Key(key)); | 43 scoped_ptr<Key> result(new Key(key)); |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
315 current_state_.get(), | 316 current_state_.get(), |
316 scoped_refptr<ParallelAuthenticator>(this), | 317 scoped_refptr<ParallelAuthenticator>(this), |
317 cryptohome::MOUNT_FLAGS_NONE)); | 318 cryptohome::MOUNT_FLAGS_NONE)); |
318 } | 319 } |
319 | 320 |
320 void ParallelAuthenticator::LoginRetailMode() { | 321 void ParallelAuthenticator::LoginRetailMode() { |
321 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 322 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
322 // Note: |kRetailModeUserEMail| is used in other places to identify a retail | 323 // Note: |kRetailModeUserEMail| is used in other places to identify a retail |
323 // mode session. | 324 // mode session. |
324 current_state_.reset( | 325 current_state_.reset( |
325 new AuthAttemptState(UserContext(UserManager::kRetailModeUserName), | 326 new AuthAttemptState(UserContext(chromeos::login::kRetailModeUserName), |
326 user_manager::USER_TYPE_RETAIL_MODE, | 327 user_manager::USER_TYPE_RETAIL_MODE, |
327 false, // unlock | 328 false, // unlock |
328 false, // online_complete | 329 false, // online_complete |
329 false)); // user_is_new | 330 false)); // user_is_new |
330 remove_user_data_on_failure_ = false; | 331 remove_user_data_on_failure_ = false; |
331 ephemeral_mount_attempted_ = true; | 332 ephemeral_mount_attempted_ = true; |
332 MountGuest(current_state_.get(), | 333 MountGuest(current_state_.get(), |
333 scoped_refptr<ParallelAuthenticator>(this)); | 334 scoped_refptr<ParallelAuthenticator>(this)); |
334 } | 335 } |
335 | 336 |
336 void ParallelAuthenticator::LoginOffTheRecord() { | 337 void ParallelAuthenticator::LoginOffTheRecord() { |
337 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 338 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
338 current_state_.reset( | 339 current_state_.reset( |
339 new AuthAttemptState(UserContext(UserManager::kGuestUserName), | 340 new AuthAttemptState(UserContext(chromeos::login::kGuestUserName), |
340 user_manager::USER_TYPE_GUEST, | 341 user_manager::USER_TYPE_GUEST, |
341 false, // unlock | 342 false, // unlock |
342 false, // online_complete | 343 false, // online_complete |
343 false)); // user_is_new | 344 false)); // user_is_new |
344 remove_user_data_on_failure_ = false; | 345 remove_user_data_on_failure_ = false; |
345 ephemeral_mount_attempted_ = true; | 346 ephemeral_mount_attempted_ = true; |
346 MountGuest(current_state_.get(), | 347 MountGuest(current_state_.get(), |
347 scoped_refptr<ParallelAuthenticator>(this)); | 348 scoped_refptr<ParallelAuthenticator>(this)); |
348 } | 349 } |
349 | 350 |
(...skipping 13 matching lines...) Expand all Loading... | |
363 scoped_refptr<ParallelAuthenticator>(this), | 364 scoped_refptr<ParallelAuthenticator>(this), |
364 cryptohome::CREATE_IF_MISSING | cryptohome::ENSURE_EPHEMERAL)); | 365 cryptohome::CREATE_IF_MISSING | cryptohome::ENSURE_EPHEMERAL)); |
365 } | 366 } |
366 | 367 |
367 void ParallelAuthenticator::LoginAsKioskAccount( | 368 void ParallelAuthenticator::LoginAsKioskAccount( |
368 const std::string& app_user_id, | 369 const std::string& app_user_id, |
369 bool use_guest_mount) { | 370 bool use_guest_mount) { |
370 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 371 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
371 | 372 |
372 const std::string user_id = | 373 const std::string user_id = |
373 use_guest_mount ? UserManager::kGuestUserName : app_user_id; | 374 use_guest_mount ? chromeos::login::kGuestUserName : app_user_id; |
374 current_state_.reset(new AuthAttemptState(UserContext(user_id), | 375 current_state_.reset(new AuthAttemptState(UserContext(user_id), |
375 user_manager::USER_TYPE_KIOSK_APP, | 376 user_manager::USER_TYPE_KIOSK_APP, |
376 false, // unlock | 377 false, // unlock |
377 false, // online_complete | 378 false, // online_complete |
378 false)); // user_is_new | 379 false)); // user_is_new |
379 | 380 |
380 remove_user_data_on_failure_ = true; | 381 remove_user_data_on_failure_ = true; |
381 if (!use_guest_mount) { | 382 if (!use_guest_mount) { |
382 MountPublic(current_state_.get(), | 383 MountPublic(current_state_.get(), |
383 scoped_refptr<ParallelAuthenticator>(this), | 384 scoped_refptr<ParallelAuthenticator>(this), |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
814 Resolve(); | 815 Resolve(); |
815 } | 816 } |
816 | 817 |
817 void ParallelAuthenticator::SetOwnerState(bool owner_check_finished, | 818 void ParallelAuthenticator::SetOwnerState(bool owner_check_finished, |
818 bool check_result) { | 819 bool check_result) { |
819 owner_is_verified_ = owner_check_finished; | 820 owner_is_verified_ = owner_check_finished; |
820 user_can_login_ = check_result; | 821 user_can_login_ = check_result; |
821 } | 822 } |
822 | 823 |
823 } // namespace chromeos | 824 } // namespace chromeos |
OLD | NEW |