Chromium Code Reviews| Index: chrome/browser/ui/ash/network_connect_delegate_chromeos.cc |
| diff --git a/chrome/browser/ui/ash/network_connect_delegate_chromeos.cc b/chrome/browser/ui/ash/network_connect_delegate_chromeos.cc |
| index d509ce2015800dbe338491aa0b66d3296da67990..ff018adc130c15d20c4b8d94682358c73c1df99b 100644 |
| --- a/chrome/browser/ui/ash/network_connect_delegate_chromeos.cc |
| +++ b/chrome/browser/ui/ash/network_connect_delegate_chromeos.cc |
| @@ -15,6 +15,11 @@ |
| #include "chrome/browser/chromeos/sim_dialog_delegate.h" |
| #include "chrome/browser/ui/ash/system_tray_client.h" |
| #include "chrome/browser/ui/webui/chromeos/mobile_setup_dialog.h" |
| +#include "chromeos/network/network_handler.h" |
| +#include "chromeos/network/network_state.h" |
| +#include "chromeos/network/network_state_handler.h" |
| + |
| +namespace chromeos { |
| namespace { |
| @@ -41,21 +46,31 @@ gfx::NativeWindow GetNativeWindow() { |
| container_id); |
| } |
| +std::string GetServicePathFromNetworkId(const std::string& network_id) { |
|
James Cook
2016/10/18 23:26:25
Can you put this in a static function in SystemTra
stevenjb
2016/10/19 17:06:44
Moved to the dialog code.
|
| + const NetworkState* network = |
| + NetworkHandler::Get()->network_state_handler()->GetNetworkStateFromGuid( |
| + network_id); |
| + if (!network) { |
| + LOG(ERROR) << "Network ID not found: " << network_id; |
| + return ""; |
|
James Cook
2016/10/18 23:26:25
nit: std::string()
stevenjb
2016/10/19 17:06:44
Acknowledged.
|
| + } |
| + return network->path(); |
| +} |
| + |
| } // namespace |
| -namespace chromeos { |
| +NetworkConnectDelegateChromeOS::NetworkConnectDelegateChromeOS() {} |
| -NetworkConnectDelegateChromeOS::NetworkConnectDelegateChromeOS() { |
| -} |
| - |
| -NetworkConnectDelegateChromeOS::~NetworkConnectDelegateChromeOS() { |
| -} |
| +NetworkConnectDelegateChromeOS::~NetworkConnectDelegateChromeOS() {} |
| void NetworkConnectDelegateChromeOS::ShowNetworkConfigure( |
| const std::string& network_id) { |
| if (!IsUIAvailable()) |
| return; |
| - NetworkConfigView::Show(network_id, GetNativeWindow()); |
| + std::string service_path = GetServicePathFromNetworkId(network_id); |
| + if (service_path.empty()) |
| + return; |
| + NetworkConfigView::Show(service_path, GetNativeWindow()); |
| } |
| void NetworkConnectDelegateChromeOS::ShowNetworkSettingsForGuid( |
| @@ -80,9 +95,12 @@ void NetworkConnectDelegateChromeOS::ShowMobileSimDialog() { |
| } |
| void NetworkConnectDelegateChromeOS::ShowMobileSetupDialog( |
| - const std::string& service_path) { |
| + const std::string& network_id) { |
| if (!IsUIAvailable()) |
| return; |
| + std::string service_path = GetServicePathFromNetworkId(network_id); |
| + if (service_path.empty()) |
| + return; |
| MobileSetupDialog::Show(service_path); |
| } |