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 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1310 remora_controller_->OnNetworkConnectivityChanged( | 1311 remora_controller_->OnNetworkConnectivityChanged( |
1311 pairing_chromeos::HostPairingController::CONNECTIVITY_CONNECTING); | 1312 pairing_chromeos::HostPairingController::CONNECTIVITY_CONNECTING); |
1312 | 1313 |
1313 NetworkScreen* network_screen = NetworkScreen::Get(screen_manager()); | 1314 NetworkScreen* network_screen = NetworkScreen::Get(screen_manager()); |
1314 const chromeos::NetworkState* network_state = chromeos::NetworkHandler::Get() | 1315 const chromeos::NetworkState* network_state = chromeos::NetworkHandler::Get() |
1315 ->network_state_handler() | 1316 ->network_state_handler() |
1316 ->DefaultNetwork(); | 1317 ->DefaultNetwork(); |
1317 | 1318 |
1318 if (NetworkAllowUpdate(network_state)) { | 1319 if (NetworkAllowUpdate(network_state)) { |
1319 network_screen->CreateAndConnectNetworkFromOnc( | 1320 network_screen->CreateAndConnectNetworkFromOnc( |
1320 onc_spec, base::Bind(&base::DoNothing), base::Bind(&base::DoNothing)); | 1321 onc_spec, base::Bind(&base::DoNothing), |
| 1322 network_handler::ErrorCallback()); |
1321 } else { | 1323 } else { |
1322 network_screen->CreateAndConnectNetworkFromOnc( | 1324 network_screen->CreateAndConnectNetworkFromOnc( |
1323 onc_spec, base::Bind(&WizardController::OnSetHostNetworkSuccessful, | 1325 onc_spec, base::Bind(&WizardController::OnSetHostNetworkSuccessful, |
1324 weak_factory_.GetWeakPtr()), | 1326 weak_factory_.GetWeakPtr()), |
1325 base::Bind(&WizardController::OnSetHostNetworkFailed, | 1327 base::Bind(&WizardController::OnSetHostNetworkFailed, |
1326 weak_factory_.GetWeakPtr())); | 1328 weak_factory_.GetWeakPtr())); |
1327 } | 1329 } |
1328 } | 1330 } |
1329 | 1331 |
1330 void WizardController::RebootHostRequested() { | 1332 void WizardController::RebootHostRequested() { |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1610 SetControllerDetectedPref(true); | 1612 SetControllerDetectedPref(true); |
1611 ShowHostPairingScreen(); | 1613 ShowHostPairingScreen(); |
1612 } | 1614 } |
1613 | 1615 |
1614 void WizardController::OnSetHostNetworkSuccessful() { | 1616 void WizardController::OnSetHostNetworkSuccessful() { |
1615 remora_controller_->OnNetworkConnectivityChanged( | 1617 remora_controller_->OnNetworkConnectivityChanged( |
1616 pairing_chromeos::HostPairingController::CONNECTIVITY_CONNECTED); | 1618 pairing_chromeos::HostPairingController::CONNECTIVITY_CONNECTED); |
1617 InitiateOOBEUpdate(); | 1619 InitiateOOBEUpdate(); |
1618 } | 1620 } |
1619 | 1621 |
1620 void WizardController::OnSetHostNetworkFailed() { | 1622 void WizardController::OnSetHostNetworkFailed( |
| 1623 const std::string& error_name, |
| 1624 std::unique_ptr<base::DictionaryValue> error_data) { |
| 1625 std::string error_message; |
| 1626 JSONStringValueSerializer serializer(&error_message); |
| 1627 serializer.Serialize(*error_data); |
| 1628 error_message = error_name + ": " + error_message; |
| 1629 |
| 1630 remora_controller_->SetErrorCodeAndMessage( |
| 1631 static_cast<int>( |
| 1632 pairing_chromeos::HostPairingController::ErrorCode::NETWORK_ERROR), |
| 1633 error_message); |
| 1634 |
1621 remora_controller_->OnNetworkConnectivityChanged( | 1635 remora_controller_->OnNetworkConnectivityChanged( |
1622 pairing_chromeos::HostPairingController::CONNECTIVITY_NONE); | 1636 pairing_chromeos::HostPairingController::CONNECTIVITY_NONE); |
1623 } | 1637 } |
1624 | 1638 |
1625 void WizardController::StartEnrollmentScreen(bool force_interactive) { | 1639 void WizardController::StartEnrollmentScreen(bool force_interactive) { |
1626 VLOG(1) << "Showing enrollment screen." | 1640 VLOG(1) << "Showing enrollment screen." |
1627 << " Forcing interactive enrollment: " << force_interactive << "."; | 1641 << " Forcing interactive enrollment: " << force_interactive << "."; |
1628 | 1642 |
1629 // Determine the effective enrollment configuration. If there is a valid | 1643 // Determine the effective enrollment configuration. If there is a valid |
1630 // prescribed configuration, use that. If not, figure out which variant of | 1644 // prescribed configuration, use that. If not, figure out which variant of |
(...skipping 13 matching lines...) Expand all Loading... |
1644 SetCurrentScreen(screen); | 1658 SetCurrentScreen(screen); |
1645 } | 1659 } |
1646 | 1660 |
1647 AutoEnrollmentController* WizardController::GetAutoEnrollmentController() { | 1661 AutoEnrollmentController* WizardController::GetAutoEnrollmentController() { |
1648 if (!auto_enrollment_controller_) | 1662 if (!auto_enrollment_controller_) |
1649 auto_enrollment_controller_ = base::MakeUnique<AutoEnrollmentController>(); | 1663 auto_enrollment_controller_ = base::MakeUnique<AutoEnrollmentController>(); |
1650 return auto_enrollment_controller_.get(); | 1664 return auto_enrollment_controller_.get(); |
1651 } | 1665 } |
1652 | 1666 |
1653 } // namespace chromeos | 1667 } // namespace chromeos |
OLD | NEW |