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/lock/webui_screen_locker.h" | 5 #include "chrome/browser/chromeos/login/lock/webui_screen_locker.h" |
| 6 | 6 |
| 7 #include "ash/common/wm_shell.h" | 7 #include "ash/common/wm_shell.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/system/chromeos/power/power_event_observer.h" | 9 #include "ash/system/chromeos/power/power_event_observer.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/feature_list.h" | 11 #include "base/feature_list.h" |
| 12 #include "base/metrics/histogram_macros.h" | 12 #include "base/metrics/histogram_macros.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "chrome/browser/browser_shutdown.h" | 15 #include "chrome/browser/browser_shutdown.h" |
| 16 #include "chrome/browser/chrome_notification_types.h" | 16 #include "chrome/browser/chrome_notification_types.h" |
| 17 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | 17 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
| 18 #include "chrome/browser/chromeos/login/helper.h" | 18 #include "chrome/browser/chromeos/login/helper.h" |
| 19 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 19 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
| 20 #include "chrome/browser/chromeos/login/ui/preloaded_web_view.h" | 20 #include "chrome/browser/chromeos/login/ui/preloaded_web_view.h" |
| 21 #include "chrome/browser/chromeos/login/ui/preloaded_web_view_factory.h" | 21 #include "chrome/browser/chromeos/login/ui/preloaded_web_view_factory.h" |
| 22 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" | 22 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" |
| 23 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 23 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 24 #include "chrome/browser/ui/ash/ash_util.h" | |
| 24 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 25 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
| 25 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" | 26 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" |
| 26 #include "chrome/common/chrome_features.h" | 27 #include "chrome/common/chrome_features.h" |
| 27 #include "chrome/common/pref_names.h" | 28 #include "chrome/common/pref_names.h" |
| 28 #include "chrome/common/url_constants.h" | 29 #include "chrome/common/url_constants.h" |
| 29 #include "chrome/grit/generated_resources.h" | 30 #include "chrome/grit/generated_resources.h" |
| 30 #include "chromeos/dbus/dbus_thread_manager.h" | 31 #include "chromeos/dbus/dbus_thread_manager.h" |
| 31 #include "components/prefs/pref_service.h" | 32 #include "components/prefs/pref_service.h" |
| 32 #include "components/user_manager/user.h" | 33 #include "components/user_manager/user.h" |
| 33 #include "content/public/browser/browser_thread.h" | 34 #include "content/public/browser/browser_thread.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 | 75 |
| 75 VLOG(1) << "Preloading lock screen"; | 76 VLOG(1) << "Preloading lock screen"; |
| 76 PreloadedWebView* preloaded_web_view = | 77 PreloadedWebView* preloaded_web_view = |
| 77 PreloadedWebViewFactory::GetForProfile(ProfileHelper::GetSigninProfile()); | 78 PreloadedWebViewFactory::GetForProfile(ProfileHelper::GetSigninProfile()); |
| 78 preloaded_web_view->PreloadOnIdle( | 79 preloaded_web_view->PreloadOnIdle( |
| 79 base::BindOnce(&WebUIScreenLocker::DoPreload)); | 80 base::BindOnce(&WebUIScreenLocker::DoPreload)); |
| 80 } | 81 } |
| 81 | 82 |
| 82 // static | 83 // static |
| 83 bool WebUIScreenLocker::ShouldPreloadLockScreen() { | 84 bool WebUIScreenLocker::ShouldPreloadLockScreen() { |
| 85 // Bail for mash because IdleDetector/UserActivityDetector does not work | |
| 86 // properly there. | |
| 87 // TODO(xiyuan): Revisit after http://crbug.com/626899. | |
| 88 if (ash_util::IsRunningInMash()) | |
|
Daniel Erat
2017/03/06 23:48:58
the connection between this code and IdleDetector
xiyuan
2017/03/06 23:54:50
Your reading is correct. This is an optimization t
Daniel Erat
2017/03/07 01:27:16
thanks for the explanation! would you mind also fi
xiyuan
2017/03/07 17:00:07
SG. Filed http://crbug.com/699144 to restore the r
| |
| 89 return false; | |
| 90 | |
| 84 Profile* profile = ProfileHelper::Get()->GetProfileByUser( | 91 Profile* profile = ProfileHelper::Get()->GetProfileByUser( |
| 85 user_manager::UserManager::Get()->GetActiveUser()); | 92 user_manager::UserManager::Get()->GetActiveUser()); |
| 86 | 93 |
| 87 // We only want to preload the lock screen if the user is likely to see the | 94 // We only want to preload the lock screen if the user is likely to see the |
| 88 // lock screen (since caching the lock screen uses memory). Without | 95 // lock screen (since caching the lock screen uses memory). Without |
| 89 // preloading, showing the lock screen can take so long we will timeout and | 96 // preloading, showing the lock screen can take so long we will timeout and |
| 90 // crash the browser process (which currently takes down all of Chrome). See | 97 // crash the browser process (which currently takes down all of Chrome). See |
| 91 // crbug.com/452599 for more context. | 98 // crbug.com/452599 for more context. |
| 92 // | 99 // |
| 93 // prefs::kEnableAutoScreenLock controls if the lock screen is shown on | 100 // prefs::kEnableAutoScreenLock controls if the lock screen is shown on |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 462 } | 469 } |
| 463 | 470 |
| 464 if (GetOobeUI()) { | 471 if (GetOobeUI()) { |
| 465 const gfx::Size& size = primary_display.size(); | 472 const gfx::Size& size = primary_display.size(); |
| 466 GetOobeUI()->GetCoreOobeView()->SetClientAreaSize(size.width(), | 473 GetOobeUI()->GetCoreOobeView()->SetClientAreaSize(size.width(), |
| 467 size.height()); | 474 size.height()); |
| 468 } | 475 } |
| 469 } | 476 } |
| 470 | 477 |
| 471 } // namespace chromeos | 478 } // namespace chromeos |
| OLD | NEW |