| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "ash/system/chromeos/network/network_connect.h" | 5 #include "ash/system/chromeos/network/network_connect.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/system/chromeos/network/network_observer.h" | 8 #include "ash/system/chromeos/network/network_observer.h" |
| 9 #include "ash/system/chromeos/network/network_state_notifier.h" | 9 #include "ash/system/chromeos/network/network_state_notifier.h" |
| 10 #include "ash/system/tray/system_tray_delegate.h" | 10 #include "ash/system/tray/system_tray_delegate.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 ash::Shell::GetInstance()->system_tray_delegate()->ConfigureNetwork( | 40 ash::Shell::GetInstance()->system_tray_delegate()->ConfigureNetwork( |
| 41 service_path); | 41 service_path); |
| 42 return; | 42 return; |
| 43 } | 43 } |
| 44 if (error_name == NetworkConnectionHandler::kErrorConnected || | 44 if (error_name == NetworkConnectionHandler::kErrorConnected || |
| 45 error_name == NetworkConnectionHandler::kErrorConnecting) { | 45 error_name == NetworkConnectionHandler::kErrorConnecting) { |
| 46 ash::Shell::GetInstance()->system_tray_delegate()->ShowNetworkSettings( | 46 ash::Shell::GetInstance()->system_tray_delegate()->ShowNetworkSettings( |
| 47 service_path); | 47 service_path); |
| 48 return; | 48 return; |
| 49 } | 49 } |
| 50 // Shill does not always provide a helpful error. In this case, show the |
| 51 // configuration UI and a notification. See crbug.com/217033 for an example. |
| 52 if (error_name == NetworkConnectionHandler::kErrorConnectFailed) { |
| 53 ash::Shell::GetInstance()->system_tray_delegate()->ConfigureNetwork( |
| 54 service_path); |
| 55 } |
| 50 ash::Shell::GetInstance()->system_tray_notifier()->network_state_notifier()-> | 56 ash::Shell::GetInstance()->system_tray_notifier()->network_state_notifier()-> |
| 51 ShowNetworkConnectError(error_name, service_path); | 57 ShowNetworkConnectError(error_name, service_path); |
| 52 } | 58 } |
| 53 | 59 |
| 54 void OnConnectSucceeded(const std::string& service_path) { | 60 void OnConnectSucceeded(const std::string& service_path) { |
| 55 VLOG(1) << "Connect Succeeded for " << service_path; | 61 VLOG(1) << "Connect Succeeded for " << service_path; |
| 62 ash::Shell::GetInstance()->system_tray_notifier()->NotifyClearNetworkMessage( |
| 63 NetworkObserver::ERROR_CONNECT_FAILED); |
| 56 } | 64 } |
| 57 | 65 |
| 58 } // namespace | 66 } // namespace |
| 59 | 67 |
| 60 namespace network_connect { | 68 namespace network_connect { |
| 61 | 69 |
| 62 void ConnectToNetwork(const std::string& service_path) { | 70 void ConnectToNetwork(const std::string& service_path) { |
| 63 const NetworkState* network = NetworkHandler::Get()->network_state_handler()-> | 71 const NetworkState* network = NetworkHandler::Get()->network_state_handler()-> |
| 64 GetNetworkState(service_path); | 72 GetNetworkState(service_path); |
| 65 if (!network) | 73 if (!network) |
| 66 return; | 74 return; |
| 67 ash::Shell::GetInstance()->system_tray_notifier()->NotifyClearNetworkMessage( | 75 ash::Shell::GetInstance()->system_tray_notifier()->NotifyClearNetworkMessage( |
| 68 NetworkObserver::ERROR_CONNECT_FAILED); | 76 NetworkObserver::ERROR_CONNECT_FAILED); |
| 69 NetworkHandler::Get()->network_connection_handler()->ConnectToNetwork( | 77 NetworkHandler::Get()->network_connection_handler()->ConnectToNetwork( |
| 70 service_path, | 78 service_path, |
| 71 base::Bind(&OnConnectSucceeded, service_path), | 79 base::Bind(&OnConnectSucceeded, service_path), |
| 72 base::Bind(&OnConnectFailed, service_path), | 80 base::Bind(&OnConnectFailed, service_path), |
| 73 false /* ignore_error_state */); | 81 false /* ignore_error_state */); |
| 74 } | 82 } |
| 75 | 83 |
| 76 } // network_connect | 84 } // network_connect |
| 77 } // ash | 85 } // ash |
| OLD | NEW |