| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/ui/ash/network_connect_delegate_chromeos.h" | |
| 6 | |
| 7 #include "ash/common/session/session_state_delegate.h" | |
| 8 #include "ash/common/wm_shell.h" | |
| 9 #include "ash/shell.h" | |
| 10 #include "chrome/browser/chromeos/enrollment_dialog_view.h" | |
| 11 #include "chrome/browser/chromeos/options/network_config_view.h" | |
| 12 #include "chrome/browser/chromeos/sim_dialog_delegate.h" | |
| 13 #include "chrome/browser/ui/ash/system_tray_client.h" | |
| 14 #include "chrome/browser/ui/webui/chromeos/mobile_setup_dialog.h" | |
| 15 | |
| 16 namespace { | |
| 17 | |
| 18 bool IsUIAvailable() { | |
| 19 return ash::WmShell::HasInstance() && | |
| 20 !ash::WmShell::Get()->GetSessionStateDelegate()->IsScreenLocked(); | |
| 21 } | |
| 22 | |
| 23 gfx::NativeWindow GetNativeWindow() { | |
| 24 int container_id = SystemTrayClient::GetDialogParentContainerId(); | |
| 25 return ash::Shell::GetContainer(ash::Shell::GetPrimaryRootWindow(), | |
| 26 container_id); | |
| 27 } | |
| 28 | |
| 29 } // namespace | |
| 30 | |
| 31 namespace chromeos { | |
| 32 | |
| 33 NetworkConnectDelegateChromeOS::NetworkConnectDelegateChromeOS() {} | |
| 34 | |
| 35 NetworkConnectDelegateChromeOS::~NetworkConnectDelegateChromeOS() {} | |
| 36 | |
| 37 void NetworkConnectDelegateChromeOS::ShowNetworkConfigure( | |
| 38 const std::string& network_id) { | |
| 39 if (!IsUIAvailable()) | |
| 40 return; | |
| 41 NetworkConfigView::ShowByNetworkId(network_id, GetNativeWindow()); | |
| 42 } | |
| 43 | |
| 44 void NetworkConnectDelegateChromeOS::ShowNetworkSettings( | |
| 45 const std::string& network_id) { | |
| 46 if (!IsUIAvailable()) | |
| 47 return; | |
| 48 SystemTrayClient::Get()->ShowNetworkSettings(network_id); | |
| 49 } | |
| 50 | |
| 51 bool NetworkConnectDelegateChromeOS::ShowEnrollNetwork( | |
| 52 const std::string& network_id) { | |
| 53 if (!IsUIAvailable()) | |
| 54 return false; | |
| 55 return enrollment::CreateDialog(network_id, GetNativeWindow()); | |
| 56 } | |
| 57 | |
| 58 void NetworkConnectDelegateChromeOS::ShowMobileSimDialog() { | |
| 59 if (!IsUIAvailable()) | |
| 60 return; | |
| 61 SimDialogDelegate::ShowDialog(GetNativeWindow(), | |
| 62 SimDialogDelegate::SIM_DIALOG_UNLOCK); | |
| 63 } | |
| 64 | |
| 65 void NetworkConnectDelegateChromeOS::ShowMobileSetupDialog( | |
| 66 const std::string& network_id) { | |
| 67 if (!IsUIAvailable()) | |
| 68 return; | |
| 69 MobileSetupDialog::ShowByNetworkId(network_id); | |
| 70 } | |
| 71 | |
| 72 } // namespace chromeos | |
| OLD | NEW |