Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Side by Side Diff: chrome/browser/chromeos/login/existing_user_controller.cc

Issue 9466005: Make sure the device recovers from policy loss in the consumer case. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/existing_user_controller.h" 5 #include "chrome/browser/chromeos/login/existing_user_controller.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/message_loop.h" 13 #include "base/message_loop.h"
14 #include "base/metrics/histogram.h" 14 #include "base/metrics/histogram.h"
15 #include "base/string_util.h" 15 #include "base/string_util.h"
16 #include "base/stringprintf.h" 16 #include "base/stringprintf.h"
17 #include "base/utf_string_conversions.h" 17 #include "base/utf_string_conversions.h"
18 #include "base/values.h" 18 #include "base/values.h"
19 #include "chrome/browser/browser_process.h" 19 #include "chrome/browser/browser_process.h"
20 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" 20 #include "chrome/browser/chromeos/accessibility/accessibility_util.h"
21 #include "chrome/browser/chromeos/boot_times_loader.h" 21 #include "chrome/browser/chromeos/boot_times_loader.h"
22 #include "chrome/browser/chromeos/cros_settings.h" 22 #include "chrome/browser/chromeos/cros_settings.h"
23 #include "chrome/browser/chromeos/cros/cros_library.h" 23 #include "chrome/browser/chromeos/cros/cros_library.h"
24 #include "chrome/browser/chromeos/cros/network_library.h" 24 #include "chrome/browser/chromeos/cros/network_library.h"
25 #include "chrome/browser/chromeos/customization_document.h" 25 #include "chrome/browser/chromeos/customization_document.h"
26 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" 26 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h"
27 #include "chrome/browser/chromeos/dbus/power_manager_client.h"
27 #include "chrome/browser/chromeos/dbus/session_manager_client.h" 28 #include "chrome/browser/chromeos/dbus/session_manager_client.h"
28 #include "chrome/browser/chromeos/login/helper.h" 29 #include "chrome/browser/chromeos/login/helper.h"
29 #include "chrome/browser/chromeos/login/login_display_host.h" 30 #include "chrome/browser/chromeos/login/login_display_host.h"
30 #include "chrome/browser/chromeos/login/login_utils.h" 31 #include "chrome/browser/chromeos/login/login_utils.h"
31 #include "chrome/browser/chromeos/login/user_manager.h" 32 #include "chrome/browser/chromeos/login/user_manager.h"
32 #include "chrome/browser/chromeos/login/wizard_controller.h" 33 #include "chrome/browser/chromeos/login/wizard_controller.h"
33 #include "chrome/browser/chromeos/system/statistics_provider.h" 34 #include "chrome/browser/chromeos/system/statistics_provider.h"
34 #include "chrome/browser/google/google_util.h" 35 #include "chrome/browser/google/google_util.h"
35 #include "chrome/browser/policy/browser_policy_connector.h" 36 #include "chrome/browser/policy/browser_policy_connector.h"
36 #include "chrome/browser/prefs/pref_service.h" 37 #include "chrome/browser/prefs/pref_service.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 // accessibility is enabled). 86 // accessibility is enabled).
86 const char kChromeVoxTutorialURLPattern[] = 87 const char kChromeVoxTutorialURLPattern[] =
87 "http://www.chromevox.com/tutorial/index.html?lang=%s"; 88 "http://www.chromevox.com/tutorial/index.html?lang=%s";
88 89
89 // Landing URL when launching Guest mode to fix captive portal. 90 // Landing URL when launching Guest mode to fix captive portal.
90 const char kCaptivePortalLaunchURL[] = "http://www.google.com/"; 91 const char kCaptivePortalLaunchURL[] = "http://www.google.com/";
91 92
92 // Delay for transferring the auth cache to the system profile. 93 // Delay for transferring the auth cache to the system profile.
93 const long int kAuthCacheTransferDelayMs = 2000; 94 const long int kAuthCacheTransferDelayMs = 2000;
94 95
96 // Delay for rebooting the machine if safe-modelogin has failed.
97 const long int kSafeModeRebootDelayMs = 30000;
98
95 // Makes a call to the policy subsystem to reload the policy when we detect 99 // Makes a call to the policy subsystem to reload the policy when we detect
96 // authentication change. 100 // authentication change.
97 void RefreshPoliciesOnUIThread() { 101 void RefreshPoliciesOnUIThread() {
98 if (g_browser_process->browser_policy_connector()) 102 if (g_browser_process->browser_policy_connector())
99 g_browser_process->browser_policy_connector()->RefreshPolicies(); 103 g_browser_process->browser_policy_connector()->RefreshPolicies();
100 } 104 }
101 105
102 // Copies any authentication details that were entered in the login profile in 106 // Copies any authentication details that were entered in the login profile in
103 // the mail profile to make sure all subsystems of Chrome can access the network 107 // the mail profile to make sure all subsystems of Chrome can access the network
104 // with the provided authentication which are possibly for a proxy server. 108 // with the provided authentication which are possibly for a proxy server.
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 // ExistingUserController, LoginPerformer::Delegate implementation: 454 // ExistingUserController, LoginPerformer::Delegate implementation:
451 // 455 //
452 456
453 void ExistingUserController::OnLoginFailure(const LoginFailure& failure) { 457 void ExistingUserController::OnLoginFailure(const LoginFailure& failure) {
454 is_login_in_progress_ = false; 458 is_login_in_progress_ = false;
455 offline_failed_ = true; 459 offline_failed_ = true;
456 460
457 guest_mode_url_ = GURL::EmptyGURL(); 461 guest_mode_url_ = GURL::EmptyGURL();
458 std::string error = failure.GetErrorString(); 462 std::string error = failure.GetErrorString();
459 463
460 if (!online_succeeded_for_.empty()) { 464 if (failure.reason() == LoginFailure::OWNER_REQUIRED) {
465 ShowError(IDS_LOGIN_ERROR_OWNER_REQUIRED, error);
466 content::BrowserThread::PostDelayedTask(
467 content::BrowserThread::UI, FROM_HERE,
468 base::Bind(&PowerManagerClient::RequestRestart,
Chris Masone 2012/02/24 18:49:45 Is this going to reboot the machine? That's proba
pastarmovj 2012/03/13 15:21:55 True. I changed it to session restart instead whic
469 base::Unretained(DBusThreadManager::Get()->
470 GetPowerManagerClient())),
471 kSafeModeRebootDelayMs);
472 } else if (!online_succeeded_for_.empty()) {
461 ShowGaiaPasswordChanged(online_succeeded_for_); 473 ShowGaiaPasswordChanged(online_succeeded_for_);
462 } else { 474 } else {
463 // Check networking after trying to login in case user is 475 // Check networking after trying to login in case user is
464 // cached locally or the local admin account. 476 // cached locally or the local admin account.
465 bool is_known_user = 477 bool is_known_user =
466 UserManager::Get()->IsKnownUser(last_login_attempt_username_); 478 UserManager::Get()->IsKnownUser(last_login_attempt_username_);
467 NetworkLibrary* network = CrosLibrary::Get()->GetNetworkLibrary(); 479 NetworkLibrary* network = CrosLibrary::Get()->GetNetworkLibrary();
468 if (!network) { 480 if (!network) {
469 ShowError(IDS_LOGIN_ERROR_NO_NETWORK_LIBRARY, error); 481 ShowError(IDS_LOGIN_ERROR_NO_NETWORK_LIBRARY, error);
470 } else if (!network->Connected()) { 482 } else if (!network->Connected()) {
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 // changed. 803 // changed.
792 UserManager::Get()->SaveUserOAuthStatus(username, 804 UserManager::Get()->SaveUserOAuthStatus(username,
793 User::OAUTH_TOKEN_STATUS_INVALID); 805 User::OAUTH_TOKEN_STATUS_INVALID);
794 806
795 login_display_->SetUIEnabled(true); 807 login_display_->SetUIEnabled(true);
796 SetStatusAreaEnabled(true); 808 SetStatusAreaEnabled(true);
797 login_display_->ShowGaiaPasswordChanged(username); 809 login_display_->ShowGaiaPasswordChanged(username);
798 } 810 }
799 811
800 } // namespace chromeos 812 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698