OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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/ui/ash/network_connect_delegate_chromeos.h" | 5 #include "chrome/browser/chromeos/net/network_connect_delegate_chromeos.h" |
6 | 6 |
7 #include "ash/common/session/session_state_delegate.h" | 7 #include "ash/common/session/session_state_delegate.h" |
8 #include "ash/common/wm_shell.h" | 8 #include "ash/common/wm_shell.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "chrome/browser/chromeos/enrollment_dialog_view.h" | 10 #include "chrome/browser/chromeos/enrollment_dialog_view.h" |
| 11 #include "chrome/browser/chromeos/net/network_state_notifier.h" |
11 #include "chrome/browser/chromeos/sim_dialog_delegate.h" | 12 #include "chrome/browser/chromeos/sim_dialog_delegate.h" |
12 #include "chrome/browser/ui/ash/system_tray_client.h" | 13 #include "chrome/browser/ui/ash/system_tray_client.h" |
13 #include "chrome/browser/ui/webui/chromeos/mobile_setup_dialog.h" | 14 #include "chrome/browser/ui/webui/chromeos/mobile_setup_dialog.h" |
14 | 15 |
15 namespace { | 16 namespace { |
16 | 17 |
17 bool IsUIAvailable() { | 18 bool IsUIAvailable() { |
18 return ash::WmShell::HasInstance() && | 19 return ash::WmShell::HasInstance() && |
19 !ash::WmShell::Get()->GetSessionStateDelegate()->IsScreenLocked(); | 20 !ash::WmShell::Get()->GetSessionStateDelegate()->IsScreenLocked(); |
20 } | 21 } |
21 | 22 |
22 gfx::NativeWindow GetNativeWindow() { | 23 gfx::NativeWindow GetNativeWindow() { |
23 int container_id = SystemTrayClient::GetDialogParentContainerId(); | 24 int container_id = SystemTrayClient::GetDialogParentContainerId(); |
24 return ash::Shell::GetContainer(ash::Shell::GetPrimaryRootWindow(), | 25 return ash::Shell::GetContainer(ash::Shell::GetPrimaryRootWindow(), |
25 container_id); | 26 container_id); |
26 } | 27 } |
27 | 28 |
28 } // namespace | 29 } // namespace |
29 | 30 |
30 namespace chromeos { | 31 namespace chromeos { |
31 | 32 |
32 NetworkConnectDelegateChromeOS::NetworkConnectDelegateChromeOS() {} | 33 NetworkConnectDelegateChromeOS::NetworkConnectDelegateChromeOS() |
| 34 : network_state_notifier_(new NetworkStateNotifier()) {} |
33 | 35 |
34 NetworkConnectDelegateChromeOS::~NetworkConnectDelegateChromeOS() {} | 36 NetworkConnectDelegateChromeOS::~NetworkConnectDelegateChromeOS() {} |
35 | 37 |
36 void NetworkConnectDelegateChromeOS::ShowNetworkConfigure( | 38 void NetworkConnectDelegateChromeOS::ShowNetworkConfigure( |
37 const std::string& network_id) { | 39 const std::string& network_id) { |
38 if (!IsUIAvailable()) | 40 if (!IsUIAvailable()) |
39 return; | 41 return; |
40 SystemTrayClient::Get()->ShowNetworkConfigure(network_id); | 42 SystemTrayClient::Get()->ShowNetworkConfigure(network_id); |
41 } | 43 } |
42 | 44 |
(...skipping 18 matching lines...) Expand all Loading... |
61 SimDialogDelegate::SIM_DIALOG_UNLOCK); | 63 SimDialogDelegate::SIM_DIALOG_UNLOCK); |
62 } | 64 } |
63 | 65 |
64 void NetworkConnectDelegateChromeOS::ShowMobileSetupDialog( | 66 void NetworkConnectDelegateChromeOS::ShowMobileSetupDialog( |
65 const std::string& network_id) { | 67 const std::string& network_id) { |
66 if (!IsUIAvailable()) | 68 if (!IsUIAvailable()) |
67 return; | 69 return; |
68 MobileSetupDialog::ShowByNetworkId(network_id); | 70 MobileSetupDialog::ShowByNetworkId(network_id); |
69 } | 71 } |
70 | 72 |
| 73 void NetworkConnectDelegateChromeOS::ShowNetworkConnectError( |
| 74 const std::string& error_name, |
| 75 const std::string& network_id) { |
| 76 network_state_notifier_->ShowNetworkConnectError(error_name, network_id); |
| 77 } |
| 78 |
| 79 void NetworkConnectDelegateChromeOS::ShowMobileActivationError( |
| 80 const std::string& network_id) { |
| 81 network_state_notifier_->ShowMobileActivationError(network_id); |
| 82 } |
| 83 |
71 } // namespace chromeos | 84 } // namespace chromeos |
OLD | NEW |