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/chromeos/login/ui/webui_login_display.h" | 5 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 7 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 8 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 8 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
| 9 #include "chrome/browser/chromeos/login/screens/chrome_user_selection_screen.h" | 9 #include "chrome/browser/chromeos/login/screens/chrome_user_selection_screen.h" |
| 10 #include "chrome/browser/chromeos/login/signin_screen_controller.h" | 10 #include "chrome/browser/chromeos/login/signin_screen_controller.h" |
| 11 #include "chrome/browser/chromeos/login/startup_utils.h" | 11 #include "chrome/browser/chromeos/login/startup_utils.h" |
| 12 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 12 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
| 13 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" | 13 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" |
| 14 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" | 14 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" |
| 15 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 15 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
| 16 #include "chrome/browser/profiles/profile_manager.h" | 16 #include "chrome/browser/profiles/profile_manager.h" |
| 17 #include "chrome/browser/ui/browser_window.h" | 17 #include "chrome/browser/ui/browser_window.h" |
| 18 #include "chrome/grit/chromium_strings.h" | 18 #include "chrome/grit/chromium_strings.h" |
| 19 #include "chrome/grit/generated_resources.h" | 19 #include "chrome/grit/generated_resources.h" |
| 20 #include "chromeos/login/user_names.h" | 20 #include "chromeos/login/user_names.h" |
| 21 #include "components/signin/core/account_id/account_id.h" | 21 #include "components/signin/core/account_id/account_id.h" |
| 22 #include "components/user_manager/user_manager.h" | 22 #include "components/user_manager/user_manager.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 // see http://crbug.com/157885 and http://crbug.com/158255. | 91 // see http://crbug.com/157885 and http://crbug.com/158255. |
| 92 // Allow this call only before user sign in or at lock screen. | 92 // Allow this call only before user sign in or at lock screen. |
| 93 // If this call is made after new user signs in but login screen is still | 93 // If this call is made after new user signs in but login screen is still |
| 94 // around that would trigger a sign in extension refresh. | 94 // around that would trigger a sign in extension refresh. |
| 95 if (is_enabled && (!user_manager::UserManager::Get()->IsUserLoggedIn() || | 95 if (is_enabled && (!user_manager::UserManager::Get()->IsUserLoggedIn() || |
| 96 ScreenLocker::default_screen_locker())) { | 96 ScreenLocker::default_screen_locker())) { |
| 97 ClearAndEnablePassword(); | 97 ClearAndEnablePassword(); |
| 98 } | 98 } |
| 99 | 99 |
| 100 if (chromeos::LoginDisplayHost* host = | 100 if (chromeos::LoginDisplayHost* host = |
| 101 chromeos::LoginDisplayHostImpl::default_host()) { | 101 chromeos::LoginDisplayHost::default_host()) { |
|
achuithb
2016/01/21 23:14:31
drop chromeos::
Pull the assignment out of the if
dzhioev (left Google)
2016/01/21 23:25:04
Hmm, what's wrong with the assignment?
achuithb
2016/01/21 23:33:53
Is this normal? The pattern I'm familiar with is:
jdufault
2016/01/22 21:14:11
I've reworked this to avoid the nested if. It also
achuithb
2016/01/22 22:37:08
Thank you! This is more concise and familiar.
| |
| 102 if (chromeos::WebUILoginView* login_view = host->GetWebUILoginView()) | 102 if (chromeos::WebUILoginView* login_view = host->GetWebUILoginView()) |
| 103 login_view->SetUIEnabled(is_enabled); | 103 login_view->SetUIEnabled(is_enabled); |
| 104 } | 104 } |
| 105 } | 105 } |
| 106 | 106 |
| 107 void WebUILoginDisplay::ShowError(int error_msg_id, | 107 void WebUILoginDisplay::ShowError(int error_msg_id, |
| 108 int login_attempts, | 108 int login_attempts, |
| 109 HelpAppLauncher::HelpTopic help_topic_id) { | 109 HelpAppLauncher::HelpTopic help_topic_id) { |
| 110 VLOG(1) << "Show error, error_id: " << error_msg_id | 110 VLOG(1) << "Show error, error_id: " << error_msg_id |
| 111 << ", attempts:" << login_attempts | 111 << ", attempts:" << login_attempts |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 322 } | 322 } |
| 323 | 323 |
| 324 bool WebUILoginDisplay::IsUserWhitelisted(const AccountId& account_id) { | 324 bool WebUILoginDisplay::IsUserWhitelisted(const AccountId& account_id) { |
| 325 DCHECK(delegate_); | 325 DCHECK(delegate_); |
| 326 if (delegate_) | 326 if (delegate_) |
| 327 return delegate_->IsUserWhitelisted(account_id); | 327 return delegate_->IsUserWhitelisted(account_id); |
| 328 return true; | 328 return true; |
| 329 } | 329 } |
| 330 | 330 |
| 331 } // namespace chromeos | 331 } // namespace chromeos |
| OLD | NEW |