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