| 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/wizard_controller.h" | 5 #include "chrome/browser/chromeos/login/wizard_controller.h" | 
| 6 | 6 | 
| 7 #include <signal.h> | 7 #include <signal.h> | 
| 8 #include <stdlib.h> | 8 #include <stdlib.h> | 
| 9 #include <sys/types.h> | 9 #include <sys/types.h> | 
| 10 | 10 | 
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 53 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 53 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 
| 54 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" | 54 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" | 
| 55 #include "chrome/browser/chromeos/settings/cros_settings.h" | 55 #include "chrome/browser/chromeos/settings/cros_settings.h" | 
| 56 #include "chrome/browser/chromeos/system/device_disabling_manager.h" | 56 #include "chrome/browser/chromeos/system/device_disabling_manager.h" | 
| 57 #include "chrome/browser/lifetime/application_lifetime.h" | 57 #include "chrome/browser/lifetime/application_lifetime.h" | 
| 58 #include "chrome/browser/metrics/metrics_reporting_state.h" | 58 #include "chrome/browser/metrics/metrics_reporting_state.h" | 
| 59 #include "chrome/browser/profiles/profile.h" | 59 #include "chrome/browser/profiles/profile.h" | 
| 60 #include "chrome/browser/profiles/profile_manager.h" | 60 #include "chrome/browser/profiles/profile_manager.h" | 
| 61 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 61 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 
| 62 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" | 62 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" | 
|  | 63 #include "chrome/browser/ui/webui/help/help_utils_chromeos.h" | 
| 63 #include "chrome/common/chrome_constants.h" | 64 #include "chrome/common/chrome_constants.h" | 
| 64 #include "chrome/common/pref_names.h" | 65 #include "chrome/common/pref_names.h" | 
| 65 #include "chromeos/audio/cras_audio_handler.h" | 66 #include "chromeos/audio/cras_audio_handler.h" | 
| 66 #include "chromeos/chromeos_constants.h" | 67 #include "chromeos/chromeos_constants.h" | 
| 67 #include "chromeos/chromeos_switches.h" | 68 #include "chromeos/chromeos_switches.h" | 
| 68 #include "chromeos/dbus/dbus_thread_manager.h" | 69 #include "chromeos/dbus/dbus_thread_manager.h" | 
| 69 #include "chromeos/dbus/session_manager_client.h" | 70 #include "chromeos/dbus/session_manager_client.h" | 
| 70 #include "chromeos/geolocation/simple_geolocation_provider.h" | 71 #include "chromeos/geolocation/simple_geolocation_provider.h" | 
| 71 #include "chromeos/network/network_state.h" | 72 #include "chromeos/network/network_state.h" | 
| 72 #include "chromeos/network/network_state_handler.h" | 73 #include "chromeos/network/network_state_handler.h" | 
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 145   return base::CommandLine::ForCurrentProcess()->HasSwitch( | 146   return base::CommandLine::ForCurrentProcess()->HasSwitch( | 
| 146       chromeos::switches::kOobeBootstrappingSlave); | 147       chromeos::switches::kOobeBootstrappingSlave); | 
| 147 } | 148 } | 
| 148 | 149 | 
| 149 // Checks if the device is a "Master" device in the bootstrapping process. | 150 // Checks if the device is a "Master" device in the bootstrapping process. | 
| 150 bool IsBootstrappingMaster() { | 151 bool IsBootstrappingMaster() { | 
| 151   return base::CommandLine::ForCurrentProcess()->HasSwitch( | 152   return base::CommandLine::ForCurrentProcess()->HasSwitch( | 
| 152       chromeos::switches::kOobeBootstrappingMaster); | 153       chromeos::switches::kOobeBootstrappingMaster); | 
| 153 } | 154 } | 
| 154 | 155 | 
|  | 156 bool NetworkAllowUpdate(const chromeos::NetworkState* network) { | 
|  | 157   if (!network || !network->IsConnectedState()) | 
|  | 158     return false; | 
|  | 159   if (network->type() == shill::kTypeBluetooth || | 
|  | 160       (network->type() == shill::kTypeCellular && | 
|  | 161        !help_utils_chromeos::IsUpdateOverCellularAllowed())) { | 
|  | 162     return false; | 
|  | 163   } | 
|  | 164   return true; | 
|  | 165 } | 
|  | 166 | 
| 155 #if defined(GOOGLE_CHROME_BUILD) | 167 #if defined(GOOGLE_CHROME_BUILD) | 
| 156 void InitializeCrashReporter() { | 168 void InitializeCrashReporter() { | 
| 157   // The crash reporter initialization needs IO to complete. | 169   // The crash reporter initialization needs IO to complete. | 
| 158   DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); | 170   DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); | 
| 159   breakpad::InitCrashReporter(std::string()); | 171   breakpad::InitCrashReporter(std::string()); | 
| 160 } | 172 } | 
| 161 #endif | 173 #endif | 
| 162 | 174 | 
| 163 }  // namespace | 175 }  // namespace | 
| 164 | 176 | 
| (...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1097     StartupUtils::MarkEulaAccepted(); | 1109     StartupUtils::MarkEulaAccepted(); | 
| 1098   SetUsageStatisticsReporting(send_reports); | 1110   SetUsageStatisticsReporting(send_reports); | 
| 1099 | 1111 | 
| 1100   NetworkScreen* network_screen = NetworkScreen::Get(this); | 1112   NetworkScreen* network_screen = NetworkScreen::Get(this); | 
| 1101   network_screen->SetApplicationLocaleAndInputMethod(lang, keyboard_layout); | 1113   network_screen->SetApplicationLocaleAndInputMethod(lang, keyboard_layout); | 
| 1102   network_screen->SetTimezone(timezone); | 1114   network_screen->SetTimezone(timezone); | 
| 1103 } | 1115 } | 
| 1104 | 1116 | 
| 1105 void WizardController::AddNetworkRequested(const std::string& onc_spec) { | 1117 void WizardController::AddNetworkRequested(const std::string& onc_spec) { | 
| 1106   NetworkScreen* network_screen = NetworkScreen::Get(this); | 1118   NetworkScreen* network_screen = NetworkScreen::Get(this); | 
| 1107   network_screen->CreateAndConnectNetworkFromOnc(onc_spec); | 1119   const chromeos::NetworkState* network_state = chromeos::NetworkHandler::Get() | 
| 1108   InitiateOOBEUpdate(); | 1120                                                     ->network_state_handler() | 
|  | 1121                                                     ->DefaultNetwork(); | 
|  | 1122 | 
|  | 1123   if (NetworkAllowUpdate(network_state)) { | 
|  | 1124     // Don't block the OOBE update and the following enrollment process. | 
|  | 1125     InitiateOOBEUpdate(); | 
|  | 1126     network_screen->CreateAndConnectNetworkFromOnc( | 
|  | 1127         onc_spec, base::Bind(&base::DoNothing), base::Bind(&base::DoNothing)); | 
|  | 1128   } else { | 
|  | 1129     network_screen->CreateAndConnectNetworkFromOnc( | 
|  | 1130         onc_spec, base::Bind(&WizardController::InitiateOOBEUpdate, | 
|  | 1131                              weak_factory_.GetWeakPtr()), | 
|  | 1132         base::Bind(&WizardController::OnSetHostNetworkFailed, | 
|  | 1133                    weak_factory_.GetWeakPtr())); | 
|  | 1134   } | 
| 1109 } | 1135 } | 
| 1110 | 1136 | 
| 1111 void WizardController::OnEnableDebuggingScreenRequested() { | 1137 void WizardController::OnEnableDebuggingScreenRequested() { | 
| 1112   if (!login_screen_started()) | 1138   if (!login_screen_started()) | 
| 1113     AdvanceToScreen(WizardController::kEnableDebuggingScreenName); | 1139     AdvanceToScreen(WizardController::kEnableDebuggingScreenName); | 
| 1114 } | 1140 } | 
| 1115 | 1141 | 
| 1116 void WizardController::OnAccessibilityStatusChanged( | 1142 void WizardController::OnAccessibilityStatusChanged( | 
| 1117     const AccessibilityStatusEventDetails& details) { | 1143     const AccessibilityStatusEventDetails& details) { | 
| 1118   enum AccessibilityNotificationType type = details.notification_type; | 1144   enum AccessibilityNotificationType type = details.notification_type; | 
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1332   if (IsBootstrappingSlave()) { | 1358   if (IsBootstrappingSlave()) { | 
| 1333     g_browser_process->platform_part() | 1359     g_browser_process->platform_part() | 
| 1334         ->browser_policy_connector_chromeos() | 1360         ->browser_policy_connector_chromeos() | 
| 1335         ->GetDeviceCloudPolicyManager() | 1361         ->GetDeviceCloudPolicyManager() | 
| 1336         ->SetDeviceEnrollmentAutoStart(); | 1362         ->SetDeviceEnrollmentAutoStart(); | 
| 1337   } | 1363   } | 
| 1338 | 1364 | 
| 1339   ShowHostPairingScreen(); | 1365   ShowHostPairingScreen(); | 
| 1340 } | 1366 } | 
| 1341 | 1367 | 
|  | 1368 void WizardController::OnSetHostNetworkFailed() { | 
|  | 1369   remora_controller_->OnNetworkConnectivityChanged( | 
|  | 1370       pairing_chromeos::HostPairingController::CONNECTIVITY_NONE); | 
|  | 1371 } | 
|  | 1372 | 
| 1342 void WizardController::StartEnrollmentScreen() { | 1373 void WizardController::StartEnrollmentScreen() { | 
| 1343   VLOG(1) << "Showing enrollment screen."; | 1374   VLOG(1) << "Showing enrollment screen."; | 
| 1344 | 1375 | 
| 1345   // Determine the effective enrollment configuration. If there is a valid | 1376   // Determine the effective enrollment configuration. If there is a valid | 
| 1346   // prescribed configuration, use that. If not, figure out which variant of | 1377   // prescribed configuration, use that. If not, figure out which variant of | 
| 1347   // manual enrollment is taking place. | 1378   // manual enrollment is taking place. | 
| 1348   policy::EnrollmentConfig effective_config = prescribed_enrollment_config_; | 1379   policy::EnrollmentConfig effective_config = prescribed_enrollment_config_; | 
| 1349   if (!effective_config.should_enroll()) { | 1380   if (!effective_config.should_enroll()) { | 
| 1350     effective_config.mode = | 1381     effective_config.mode = | 
| 1351         prescribed_enrollment_config_.management_domain.empty() | 1382         prescribed_enrollment_config_.management_domain.empty() | 
| 1352             ? policy::EnrollmentConfig::MODE_MANUAL | 1383             ? policy::EnrollmentConfig::MODE_MANUAL | 
| 1353             : policy::EnrollmentConfig::MODE_MANUAL_REENROLLMENT; | 1384             : policy::EnrollmentConfig::MODE_MANUAL_REENROLLMENT; | 
| 1354   } | 1385   } | 
| 1355 | 1386 | 
| 1356   EnrollmentScreen* screen = EnrollmentScreen::Get(this); | 1387   EnrollmentScreen* screen = EnrollmentScreen::Get(this); | 
| 1357   screen->SetParameters(effective_config, shark_controller_.get()); | 1388   screen->SetParameters(effective_config, shark_controller_.get()); | 
| 1358   SetStatusAreaVisible(true); | 1389   SetStatusAreaVisible(true); | 
| 1359   SetCurrentScreen(screen); | 1390   SetCurrentScreen(screen); | 
| 1360 } | 1391 } | 
| 1361 | 1392 | 
| 1362 }  // namespace chromeos | 1393 }  // namespace chromeos | 
| OLD | NEW | 
|---|