| 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/ui/ash/network_connect_delegate_chromeos.h" |
| 6 | 6 |
| 7 #include "ash/common/login_status.h" | |
| 8 #include "ash/common/session/session_state_delegate.h" | 7 #include "ash/common/session/session_state_delegate.h" |
| 9 #include "ash/common/shell_window_ids.h" | |
| 10 #include "ash/common/system/tray/system_tray_delegate.h" | |
| 11 #include "ash/common/wm_shell.h" | 8 #include "ash/common/wm_shell.h" |
| 12 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 13 #include "chrome/browser/chromeos/enrollment_dialog_view.h" | 10 #include "chrome/browser/chromeos/enrollment_dialog_view.h" |
| 14 #include "chrome/browser/chromeos/options/network_config_view.h" | 11 #include "chrome/browser/chromeos/options/network_config_view.h" |
| 15 #include "chrome/browser/chromeos/sim_dialog_delegate.h" | 12 #include "chrome/browser/chromeos/sim_dialog_delegate.h" |
| 16 #include "chrome/browser/ui/ash/system_tray_client.h" | 13 #include "chrome/browser/ui/ash/system_tray_client.h" |
| 17 #include "chrome/browser/ui/webui/chromeos/mobile_setup_dialog.h" | 14 #include "chrome/browser/ui/webui/chromeos/mobile_setup_dialog.h" |
| 18 | 15 |
| 19 namespace { | 16 namespace { |
| 20 | 17 |
| 21 bool IsUIAvailable() { | 18 bool IsUIAvailable() { |
| 22 return ash::WmShell::HasInstance() && | 19 return ash::WmShell::HasInstance() && |
| 23 !ash::WmShell::Get()->GetSessionStateDelegate()->IsScreenLocked(); | 20 !ash::WmShell::Get()->GetSessionStateDelegate()->IsScreenLocked(); |
| 24 } | 21 } |
| 25 | 22 |
| 26 gfx::NativeWindow GetNativeWindow() { | 23 gfx::NativeWindow GetNativeWindow() { |
| 27 ash::WmShell* wm_shell = ash::WmShell::Get(); | 24 int container_id = SystemTrayClient::GetDialogParentContainerId(); |
| 28 const bool session_started = | |
| 29 wm_shell->GetSessionStateDelegate()->IsActiveUserSessionStarted(); | |
| 30 const ash::LoginStatus login_status = | |
| 31 wm_shell->system_tray_delegate()->GetUserLoginStatus(); | |
| 32 const bool is_in_secondary_login_screen = | |
| 33 wm_shell->GetSessionStateDelegate()->IsInSecondaryLoginScreen(); | |
| 34 | |
| 35 int container_id = | |
| 36 (!session_started || login_status == ash::LoginStatus::NOT_LOGGED_IN || | |
| 37 login_status == ash::LoginStatus::LOCKED || is_in_secondary_login_screen) | |
| 38 ? ash::kShellWindowId_LockSystemModalContainer | |
| 39 : ash::kShellWindowId_SystemModalContainer; | |
| 40 return ash::Shell::GetContainer(ash::Shell::GetPrimaryRootWindow(), | 25 return ash::Shell::GetContainer(ash::Shell::GetPrimaryRootWindow(), |
| 41 container_id); | 26 container_id); |
| 42 } | 27 } |
| 43 | 28 |
| 44 } // namespace | 29 } // namespace |
| 45 | 30 |
| 46 namespace chromeos { | 31 namespace chromeos { |
| 47 | 32 |
| 48 NetworkConnectDelegateChromeOS::NetworkConnectDelegateChromeOS() { | 33 NetworkConnectDelegateChromeOS::NetworkConnectDelegateChromeOS() { |
| 49 } | 34 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 80 } | 65 } |
| 81 | 66 |
| 82 void NetworkConnectDelegateChromeOS::ShowMobileSetupDialog( | 67 void NetworkConnectDelegateChromeOS::ShowMobileSetupDialog( |
| 83 const std::string& service_path) { | 68 const std::string& service_path) { |
| 84 if (!IsUIAvailable()) | 69 if (!IsUIAvailable()) |
| 85 return; | 70 return; |
| 86 MobileSetupDialog::Show(service_path); | 71 MobileSetupDialog::Show(service_path); |
| 87 } | 72 } |
| 88 | 73 |
| 89 } // namespace chromeos | 74 } // namespace chromeos |
| OLD | NEW |