Chromium Code Reviews| 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" | 7 #include "ash/common/login_status.h" |
| 8 #include "ash/common/session/session_state_delegate.h" | 8 #include "ash/common/session/session_state_delegate.h" |
| 9 #include "ash/common/shell_window_ids.h" | 9 #include "ash/common/shell_window_ids.h" |
| 10 #include "ash/common/system/tray/system_tray_delegate.h" | 10 #include "ash/common/system/tray/system_tray_delegate.h" |
| 11 #include "ash/common/wm_shell.h" | 11 #include "ash/common/wm_shell.h" |
| 12 #include "ash/shell.h" | 12 #include "ash/shell.h" |
| 13 #include "chrome/browser/chromeos/enrollment_dialog_view.h" | 13 #include "chrome/browser/chromeos/enrollment_dialog_view.h" |
| 14 #include "chrome/browser/chromeos/options/network_config_view.h" | 14 #include "chrome/browser/chromeos/options/network_config_view.h" |
| 15 #include "chrome/browser/chromeos/sim_dialog_delegate.h" | 15 #include "chrome/browser/chromeos/sim_dialog_delegate.h" |
| 16 #include "chrome/browser/ui/webui/chromeos/mobile_setup_dialog.h" | 16 #include "chrome/browser/ui/webui/chromeos/mobile_setup_dialog.h" |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 bool IsUIAvailable() { | 20 bool IsUIAvailable() { |
| 21 return ash::Shell::GetInstance() && | 21 return ash::WmShell::HasInstance() && |
| 22 !ash::Shell::GetInstance()->session_state_delegate()->IsScreenLocked(); | 22 !ash::WmShell::Get()->GetSessionStateDelegate()->IsScreenLocked(); |
| 23 } | 23 } |
| 24 | 24 |
| 25 gfx::NativeWindow GetNativeWindow() { | 25 gfx::NativeWindow GetNativeWindow() { |
| 26 bool session_started = ash::Shell::GetInstance() | 26 ash::WmShell* wm_shell = ash::WmShell::Get(); |
| 27 ->session_state_delegate() | 27 const bool session_started = |
| 28 ->IsActiveUserSessionStarted(); | 28 wm_shell->GetSessionStateDelegate()->IsActiveUserSessionStarted(); |
| 29 ash::LoginStatus login_status = | 29 const ash::LoginStatus login_status = |
| 30 ash::WmShell::Get()->system_tray_delegate()->GetUserLoginStatus(); | 30 wm_shell->system_tray_delegate()->GetUserLoginStatus(); |
| 31 bool isUserAddingRunning = ash::Shell::GetInstance() | 31 const bool is_in_secondary_login_screen = |
|
sky
2016/06/29 23:20:21
Nice! much better name choice.
msw
2016/06/29 23:21:55
Acknowledged.
| |
| 32 ->session_state_delegate() | 32 wm_shell->GetSessionStateDelegate()->IsInSecondaryLoginScreen(); |
| 33 ->IsInSecondaryLoginScreen(); | |
| 34 | 33 |
| 35 int container_id = | 34 int container_id = |
| 36 (!session_started || login_status == ash::LoginStatus::NOT_LOGGED_IN || | 35 (!session_started || login_status == ash::LoginStatus::NOT_LOGGED_IN || |
| 37 login_status == ash::LoginStatus::LOCKED || isUserAddingRunning) | 36 login_status == ash::LoginStatus::LOCKED || is_in_secondary_login_screen) |
| 38 ? ash::kShellWindowId_LockSystemModalContainer | 37 ? ash::kShellWindowId_LockSystemModalContainer |
| 39 : ash::kShellWindowId_SystemModalContainer; | 38 : ash::kShellWindowId_SystemModalContainer; |
| 40 return ash::Shell::GetContainer(ash::Shell::GetPrimaryRootWindow(), | 39 return ash::Shell::GetContainer(ash::Shell::GetPrimaryRootWindow(), |
| 41 container_id); | 40 container_id); |
| 42 } | 41 } |
| 43 | 42 |
| 44 } // namespace | 43 } // namespace |
| 45 | 44 |
| 46 namespace chromeos { | 45 namespace chromeos { |
| 47 | 46 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 } | 80 } |
| 82 | 81 |
| 83 void NetworkConnectDelegateChromeOS::ShowMobileSetupDialog( | 82 void NetworkConnectDelegateChromeOS::ShowMobileSetupDialog( |
| 84 const std::string& service_path) { | 83 const std::string& service_path) { |
| 85 if (!IsUIAvailable()) | 84 if (!IsUIAvailable()) |
| 86 return; | 85 return; |
| 87 MobileSetupDialog::Show(service_path); | 86 MobileSetupDialog::Show(service_path); |
| 88 } | 87 } |
| 89 | 88 |
| 90 } // namespace chromeos | 89 } // namespace chromeos |
| OLD | NEW |