| 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/chromeos/login/ui/webui_login_display.h" | 5 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 8 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 9 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 9 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
| 10 #include "chrome/browser/chromeos/login/screens/chrome_user_selection_screen.h" | 10 #include "chrome/browser/chromeos/login/screens/chrome_user_selection_screen.h" |
| 11 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 11 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
| 12 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" | 12 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" |
| 13 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" | 13 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" |
| 14 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 14 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
| 15 #include "chrome/browser/profiles/profile_manager.h" | 15 #include "chrome/browser/profiles/profile_manager.h" |
| 16 #include "chrome/browser/ui/browser_window.h" | 16 #include "chrome/browser/ui/browser_window.h" |
| 17 #include "chrome/grit/chromium_strings.h" | 17 #include "chrome/grit/chromium_strings.h" |
| 18 #include "chrome/grit/generated_resources.h" | 18 #include "chrome/grit/generated_resources.h" |
| 19 #include "chromeos/ime/ime_keyboard.h" | 19 #include "chromeos/ime/ime_keyboard.h" |
| 20 #include "chromeos/ime/input_method_manager.h" | 20 #include "chromeos/ime/input_method_manager.h" |
| 21 #include "chromeos/login/user_names.h" | 21 #include "chromeos/login/user_names.h" |
| 22 #include "components/user_manager/user_manager.h" |
| 22 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
| 23 #include "ui/views/widget/widget.h" | 24 #include "ui/views/widget/widget.h" |
| 24 #include "ui/wm/core/user_activity_detector.h" | 25 #include "ui/wm/core/user_activity_detector.h" |
| 25 | 26 |
| 26 namespace chromeos { | 27 namespace chromeos { |
| 27 | 28 |
| 28 // WebUILoginDisplay, public: -------------------------------------------------- | 29 // WebUILoginDisplay, public: -------------------------------------------------- |
| 29 | 30 |
| 30 WebUILoginDisplay::~WebUILoginDisplay() { | 31 WebUILoginDisplay::~WebUILoginDisplay() { |
| 31 if (webui_handler_) | 32 if (webui_handler_) |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 if (webui_handler_) | 116 if (webui_handler_) |
| 116 webui_handler_->OnPreferencesChanged(); | 117 webui_handler_->OnPreferencesChanged(); |
| 117 } | 118 } |
| 118 | 119 |
| 119 void WebUILoginDisplay::SetUIEnabled(bool is_enabled) { | 120 void WebUILoginDisplay::SetUIEnabled(bool is_enabled) { |
| 120 // TODO(nkostylev): Cleanup this condition, | 121 // TODO(nkostylev): Cleanup this condition, |
| 121 // see http://crbug.com/157885 and http://crbug.com/158255. | 122 // see http://crbug.com/157885 and http://crbug.com/158255. |
| 122 // Allow this call only before user sign in or at lock screen. | 123 // Allow this call only before user sign in or at lock screen. |
| 123 // If this call is made after new user signs in but login screen is still | 124 // If this call is made after new user signs in but login screen is still |
| 124 // around that would trigger a sign in extension refresh. | 125 // around that would trigger a sign in extension refresh. |
| 125 if (is_enabled && (!UserManager::Get()->IsUserLoggedIn() || | 126 if (is_enabled && (!user_manager::UserManager::Get()->IsUserLoggedIn() || |
| 126 ScreenLocker::default_screen_locker())) { | 127 ScreenLocker::default_screen_locker())) { |
| 127 ClearAndEnablePassword(); | 128 ClearAndEnablePassword(); |
| 128 } | 129 } |
| 129 | 130 |
| 130 if (chromeos::LoginDisplayHost* host = | 131 if (chromeos::LoginDisplayHost* host = |
| 131 chromeos::LoginDisplayHostImpl::default_host()) { | 132 chromeos::LoginDisplayHostImpl::default_host()) { |
| 132 if (chromeos::WebUILoginView* login_view = host->GetWebUILoginView()) | 133 if (chromeos::WebUILoginView* login_view = host->GetWebUILoginView()) |
| 133 login_view->SetUIEnabled(is_enabled); | 134 login_view->SetUIEnabled(is_enabled); |
| 134 } | 135 } |
| 135 } | 136 } |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 WallpaperManager::Get()->SetDefaultWallpaperDelayed( | 271 WallpaperManager::Get()->SetDefaultWallpaperDelayed( |
| 271 chromeos::login::kSignInUser); | 272 chromeos::login::kSignInUser); |
| 272 } | 273 } |
| 273 | 274 |
| 274 void WebUILoginDisplay::OnSigninScreenReady() { | 275 void WebUILoginDisplay::OnSigninScreenReady() { |
| 275 if (delegate_) | 276 if (delegate_) |
| 276 delegate_->OnSigninScreenReady(); | 277 delegate_->OnSigninScreenReady(); |
| 277 } | 278 } |
| 278 | 279 |
| 279 void WebUILoginDisplay::RemoveUser(const std::string& username) { | 280 void WebUILoginDisplay::RemoveUser(const std::string& username) { |
| 280 UserManager::Get()->RemoveUser(username, this); | 281 user_manager::UserManager::Get()->RemoveUser(username, this); |
| 281 } | 282 } |
| 282 | 283 |
| 283 void WebUILoginDisplay::ResyncUserData() { | 284 void WebUILoginDisplay::ResyncUserData() { |
| 284 DCHECK(delegate_); | 285 DCHECK(delegate_); |
| 285 if (delegate_) | 286 if (delegate_) |
| 286 delegate_->ResyncUserData(); | 287 delegate_->ResyncUserData(); |
| 287 } | 288 } |
| 288 | 289 |
| 289 void WebUILoginDisplay::ShowEnterpriseEnrollmentScreen() { | 290 void WebUILoginDisplay::ShowEnterpriseEnrollmentScreen() { |
| 290 if (delegate_) | 291 if (delegate_) |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 delegate_->Signout(); | 346 delegate_->Signout(); |
| 346 } | 347 } |
| 347 | 348 |
| 348 void WebUILoginDisplay::OnUserActivity(const ui::Event* event) { | 349 void WebUILoginDisplay::OnUserActivity(const ui::Event* event) { |
| 349 if (delegate_) | 350 if (delegate_) |
| 350 delegate_->ResetPublicSessionAutoLoginTimer(); | 351 delegate_->ResetPublicSessionAutoLoginTimer(); |
| 351 } | 352 } |
| 352 | 353 |
| 353 | 354 |
| 354 } // namespace chromeos | 355 } // namespace chromeos |
| OLD | NEW |