| 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 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1269 remora_controller_->OnNetworkConnectivityChanged( | 1270 remora_controller_->OnNetworkConnectivityChanged( |
| 1270 pairing_chromeos::HostPairingController::CONNECTIVITY_CONNECTING); | 1271 pairing_chromeos::HostPairingController::CONNECTIVITY_CONNECTING); |
| 1271 | 1272 |
| 1272 NetworkScreen* network_screen = NetworkScreen::Get(screen_manager()); | 1273 NetworkScreen* network_screen = NetworkScreen::Get(screen_manager()); |
| 1273 const chromeos::NetworkState* network_state = chromeos::NetworkHandler::Get() | 1274 const chromeos::NetworkState* network_state = chromeos::NetworkHandler::Get() |
| 1274 ->network_state_handler() | 1275 ->network_state_handler() |
| 1275 ->DefaultNetwork(); | 1276 ->DefaultNetwork(); |
| 1276 | 1277 |
| 1277 if (NetworkAllowUpdate(network_state)) { | 1278 if (NetworkAllowUpdate(network_state)) { |
| 1278 network_screen->CreateAndConnectNetworkFromOnc( | 1279 network_screen->CreateAndConnectNetworkFromOnc( |
| 1279 onc_spec, base::Bind(&base::DoNothing), base::Bind(&base::DoNothing)); | 1280 onc_spec, base::Bind(&base::DoNothing), |
| 1281 network_handler::ErrorCallback()); |
| 1280 } else { | 1282 } else { |
| 1281 network_screen->CreateAndConnectNetworkFromOnc( | 1283 network_screen->CreateAndConnectNetworkFromOnc( |
| 1282 onc_spec, base::Bind(&WizardController::OnSetHostNetworkSuccessful, | 1284 onc_spec, base::Bind(&WizardController::OnSetHostNetworkSuccessful, |
| 1283 weak_factory_.GetWeakPtr()), | 1285 weak_factory_.GetWeakPtr()), |
| 1284 base::Bind(&WizardController::OnSetHostNetworkFailed, | 1286 base::Bind(&WizardController::OnSetHostNetworkFailed, |
| 1285 weak_factory_.GetWeakPtr())); | 1287 weak_factory_.GetWeakPtr())); |
| 1286 } | 1288 } |
| 1287 } | 1289 } |
| 1288 | 1290 |
| 1289 void WizardController::OnEnableDebuggingScreenRequested() { | 1291 void WizardController::OnEnableDebuggingScreenRequested() { |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1513 SetControllerDetectedPref(true); | 1515 SetControllerDetectedPref(true); |
| 1514 ShowHostPairingScreen(); | 1516 ShowHostPairingScreen(); |
| 1515 } | 1517 } |
| 1516 | 1518 |
| 1517 void WizardController::OnSetHostNetworkSuccessful() { | 1519 void WizardController::OnSetHostNetworkSuccessful() { |
| 1518 remora_controller_->OnNetworkConnectivityChanged( | 1520 remora_controller_->OnNetworkConnectivityChanged( |
| 1519 pairing_chromeos::HostPairingController::CONNECTIVITY_CONNECTED); | 1521 pairing_chromeos::HostPairingController::CONNECTIVITY_CONNECTED); |
| 1520 InitiateOOBEUpdate(); | 1522 InitiateOOBEUpdate(); |
| 1521 } | 1523 } |
| 1522 | 1524 |
| 1523 void WizardController::OnSetHostNetworkFailed() { | 1525 void WizardController::OnSetHostNetworkFailed( |
| 1526 const std::string& error_name, |
| 1527 std::unique_ptr<base::DictionaryValue> error_data) { |
| 1528 std::string error_message; |
| 1529 JSONStringValueSerializer serializer(&error_message); |
| 1530 serializer.Serialize(*error_data); |
| 1531 error_message = error_name + ": " + error_message; |
| 1532 |
| 1533 remora_controller_->SetErrorCodeAndMessage( |
| 1534 pairing_chromeos::HostPairingController::NETWORK_ERROR, error_message); |
| 1535 |
| 1524 remora_controller_->OnNetworkConnectivityChanged( | 1536 remora_controller_->OnNetworkConnectivityChanged( |
| 1525 pairing_chromeos::HostPairingController::CONNECTIVITY_NONE); | 1537 pairing_chromeos::HostPairingController::CONNECTIVITY_NONE); |
| 1526 } | 1538 } |
| 1527 | 1539 |
| 1528 void WizardController::StartEnrollmentScreen(bool force_interactive) { | 1540 void WizardController::StartEnrollmentScreen(bool force_interactive) { |
| 1529 VLOG(1) << "Showing enrollment screen." | 1541 VLOG(1) << "Showing enrollment screen." |
| 1530 << " Forcing interactive enrollment: " << force_interactive << "."; | 1542 << " Forcing interactive enrollment: " << force_interactive << "."; |
| 1531 | 1543 |
| 1532 // Determine the effective enrollment configuration. If there is a valid | 1544 // Determine the effective enrollment configuration. If there is a valid |
| 1533 // prescribed configuration, use that. If not, figure out which variant of | 1545 // prescribed configuration, use that. If not, figure out which variant of |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1547 SetCurrentScreen(screen); | 1559 SetCurrentScreen(screen); |
| 1548 } | 1560 } |
| 1549 | 1561 |
| 1550 AutoEnrollmentController* WizardController::GetAutoEnrollmentController() { | 1562 AutoEnrollmentController* WizardController::GetAutoEnrollmentController() { |
| 1551 if (!auto_enrollment_controller_) | 1563 if (!auto_enrollment_controller_) |
| 1552 auto_enrollment_controller_ = base::MakeUnique<AutoEnrollmentController>(); | 1564 auto_enrollment_controller_ = base::MakeUnique<AutoEnrollmentController>(); |
| 1553 return auto_enrollment_controller_.get(); | 1565 return auto_enrollment_controller_.get(); |
| 1554 } | 1566 } |
| 1555 | 1567 |
| 1556 } // namespace chromeos | 1568 } // namespace chromeos |
| OLD | NEW |