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/sim_dialog_delegate.h" | |
12 #include "chrome/browser/ui/ash/system_tray_client.h" | |
13 #include "chrome/browser/ui/webui/chromeos/mobile_setup_dialog.h" | |
14 | |
15 namespace { | |
16 | |
17 bool IsUIAvailable() { | |
18 return ash::WmShell::HasInstance() && | |
19 !ash::WmShell::Get()->GetSessionStateDelegate()->IsScreenLocked(); | |
20 } | |
21 | |
22 gfx::NativeWindow GetNativeWindow() { | |
23 int container_id = SystemTrayClient::GetDialogParentContainerId(); | |
24 return ash::Shell::GetContainer(ash::Shell::GetPrimaryRootWindow(), | |
25 container_id); | |
26 } | |
27 | |
28 } // namespace | |
29 | |
30 namespace chromeos { | |
31 | |
32 NetworkConnectDelegateChromeOS::NetworkConnectDelegateChromeOS() {} | |
33 | |
34 NetworkConnectDelegateChromeOS::~NetworkConnectDelegateChromeOS() {} | |
35 | |
36 void NetworkConnectDelegateChromeOS::ShowNetworkConfigure( | |
37 const std::string& network_id) { | |
38 if (!IsUIAvailable()) | |
39 return; | |
40 SystemTrayClient::Get()->ShowNetworkConfigure(network_id); | |
41 } | |
42 | |
43 void NetworkConnectDelegateChromeOS::ShowNetworkSettings( | |
44 const std::string& network_id) { | |
45 if (!IsUIAvailable()) | |
46 return; | |
47 SystemTrayClient::Get()->ShowNetworkSettings(network_id); | |
48 } | |
49 | |
50 bool NetworkConnectDelegateChromeOS::ShowEnrollNetwork( | |
51 const std::string& network_id) { | |
52 if (!IsUIAvailable()) | |
53 return false; | |
54 return enrollment::CreateDialog(network_id, GetNativeWindow()); | |
55 } | |
56 | |
57 void NetworkConnectDelegateChromeOS::ShowMobileSimDialog() { | |
58 if (!IsUIAvailable()) | |
59 return; | |
60 SimDialogDelegate::ShowDialog(GetNativeWindow(), | |
61 SimDialogDelegate::SIM_DIALOG_UNLOCK); | |
62 } | |
63 | |
64 void NetworkConnectDelegateChromeOS::ShowMobileSetupDialog( | |
65 const std::string& network_id) { | |
66 if (!IsUIAvailable()) | |
67 return; | |
68 MobileSetupDialog::ShowByNetworkId(network_id); | |
69 } | |
70 | |
71 } // namespace chromeos | |
OLD | NEW |