| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 #include <sys/types.h> | 10 #include <sys/types.h> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <utility> | 12 #include <utility> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/bind.h" | 15 #include "base/bind.h" |
| 16 #include "base/callback_helpers.h" | 16 #include "base/callback_helpers.h" |
| 17 #include "base/command_line.h" | 17 #include "base/command_line.h" |
| 18 #include "base/json/json_string_value_serializer.h" |
| 18 #include "base/location.h" | 19 #include "base/location.h" |
| 19 #include "base/logging.h" | 20 #include "base/logging.h" |
| 20 #include "base/macros.h" | 21 #include "base/macros.h" |
| 21 #include "base/metrics/histogram_macros.h" | 22 #include "base/metrics/histogram_macros.h" |
| 22 #include "base/single_thread_task_runner.h" | 23 #include "base/single_thread_task_runner.h" |
| 23 #include "base/strings/utf_string_conversions.h" | 24 #include "base/strings/utf_string_conversions.h" |
| 24 #include "base/task_scheduler/post_task.h" | 25 #include "base/task_scheduler/post_task.h" |
| 25 #include "base/threading/sequenced_worker_pool.h" | 26 #include "base/threading/sequenced_worker_pool.h" |
| 26 #include "base/threading/thread_task_runner_handle.h" | 27 #include "base/threading/thread_task_runner_handle.h" |
| 27 #include "chrome/browser/browser_process.h" | 28 #include "chrome/browser/browser_process.h" |
| (...skipping 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1270 remora_controller_->OnNetworkConnectivityChanged( | 1271 remora_controller_->OnNetworkConnectivityChanged( |
| 1271 pairing_chromeos::HostPairingController::CONNECTIVITY_CONNECTING); | 1272 pairing_chromeos::HostPairingController::CONNECTIVITY_CONNECTING); |
| 1272 | 1273 |
| 1273 NetworkScreen* network_screen = NetworkScreen::Get(screen_manager()); | 1274 NetworkScreen* network_screen = NetworkScreen::Get(screen_manager()); |
| 1274 const chromeos::NetworkState* network_state = chromeos::NetworkHandler::Get() | 1275 const chromeos::NetworkState* network_state = chromeos::NetworkHandler::Get() |
| 1275 ->network_state_handler() | 1276 ->network_state_handler() |
| 1276 ->DefaultNetwork(); | 1277 ->DefaultNetwork(); |
| 1277 | 1278 |
| 1278 if (NetworkAllowUpdate(network_state)) { | 1279 if (NetworkAllowUpdate(network_state)) { |
| 1279 network_screen->CreateAndConnectNetworkFromOnc( | 1280 network_screen->CreateAndConnectNetworkFromOnc( |
| 1280 onc_spec, base::Bind(&base::DoNothing), base::Bind(&base::DoNothing)); | 1281 onc_spec, base::Bind(&base::DoNothing), |
| 1282 network_handler::ErrorCallback()); |
| 1281 } else { | 1283 } else { |
| 1282 network_screen->CreateAndConnectNetworkFromOnc( | 1284 network_screen->CreateAndConnectNetworkFromOnc( |
| 1283 onc_spec, base::Bind(&WizardController::OnSetHostNetworkSuccessful, | 1285 onc_spec, base::Bind(&WizardController::OnSetHostNetworkSuccessful, |
| 1284 weak_factory_.GetWeakPtr()), | 1286 weak_factory_.GetWeakPtr()), |
| 1285 base::Bind(&WizardController::OnSetHostNetworkFailed, | 1287 base::Bind(&WizardController::OnSetHostNetworkFailed, |
| 1286 weak_factory_.GetWeakPtr())); | 1288 weak_factory_.GetWeakPtr())); |
| 1287 } | 1289 } |
| 1288 } | 1290 } |
| 1289 | 1291 |
| 1290 void WizardController::RebootHostRequested() { | 1292 void WizardController::RebootHostRequested() { |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1518 SetControllerDetectedPref(true); | 1520 SetControllerDetectedPref(true); |
| 1519 ShowHostPairingScreen(); | 1521 ShowHostPairingScreen(); |
| 1520 } | 1522 } |
| 1521 | 1523 |
| 1522 void WizardController::OnSetHostNetworkSuccessful() { | 1524 void WizardController::OnSetHostNetworkSuccessful() { |
| 1523 remora_controller_->OnNetworkConnectivityChanged( | 1525 remora_controller_->OnNetworkConnectivityChanged( |
| 1524 pairing_chromeos::HostPairingController::CONNECTIVITY_CONNECTED); | 1526 pairing_chromeos::HostPairingController::CONNECTIVITY_CONNECTED); |
| 1525 InitiateOOBEUpdate(); | 1527 InitiateOOBEUpdate(); |
| 1526 } | 1528 } |
| 1527 | 1529 |
| 1528 void WizardController::OnSetHostNetworkFailed() { | 1530 void WizardController::OnSetHostNetworkFailed( |
| 1531 const std::string& error_name, |
| 1532 std::unique_ptr<base::DictionaryValue> error_data) { |
| 1533 std::string error_message; |
| 1534 JSONStringValueSerializer serializer(&error_message); |
| 1535 serializer.Serialize(*error_data); |
| 1536 error_message = error_name + ": " + error_message; |
| 1537 |
| 1538 remora_controller_->SetErrorCodeAndMessage( |
| 1539 static_cast<int>( |
| 1540 pairing_chromeos::HostPairingController::ErrorCode::NETWORK_ERROR), |
| 1541 error_message); |
| 1542 |
| 1529 remora_controller_->OnNetworkConnectivityChanged( | 1543 remora_controller_->OnNetworkConnectivityChanged( |
| 1530 pairing_chromeos::HostPairingController::CONNECTIVITY_NONE); | 1544 pairing_chromeos::HostPairingController::CONNECTIVITY_NONE); |
| 1531 } | 1545 } |
| 1532 | 1546 |
| 1533 void WizardController::StartEnrollmentScreen(bool force_interactive) { | 1547 void WizardController::StartEnrollmentScreen(bool force_interactive) { |
| 1534 VLOG(1) << "Showing enrollment screen." | 1548 VLOG(1) << "Showing enrollment screen." |
| 1535 << " Forcing interactive enrollment: " << force_interactive << "."; | 1549 << " Forcing interactive enrollment: " << force_interactive << "."; |
| 1536 | 1550 |
| 1537 // Determine the effective enrollment configuration. If there is a valid | 1551 // Determine the effective enrollment configuration. If there is a valid |
| 1538 // prescribed configuration, use that. If not, figure out which variant of | 1552 // prescribed configuration, use that. If not, figure out which variant of |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1552 SetCurrentScreen(screen); | 1566 SetCurrentScreen(screen); |
| 1553 } | 1567 } |
| 1554 | 1568 |
| 1555 AutoEnrollmentController* WizardController::GetAutoEnrollmentController() { | 1569 AutoEnrollmentController* WizardController::GetAutoEnrollmentController() { |
| 1556 if (!auto_enrollment_controller_) | 1570 if (!auto_enrollment_controller_) |
| 1557 auto_enrollment_controller_ = base::MakeUnique<AutoEnrollmentController>(); | 1571 auto_enrollment_controller_ = base::MakeUnique<AutoEnrollmentController>(); |
| 1558 return auto_enrollment_controller_.get(); | 1572 return auto_enrollment_controller_.get(); |
| 1559 } | 1573 } |
| 1560 | 1574 |
| 1561 } // namespace chromeos | 1575 } // namespace chromeos |
| OLD | NEW |