Skip to content

Commit

Permalink
Refactor IsUsingWebUiLock to IsUsingViewsLock to match IsUsingViewsLo…
Browse files Browse the repository at this point in the history
…gin.

Update views based shelf visibility check in web UI
to include both cases lock and login.

Bug: 792656
Change-Id: I38c2ce0bed6c7ef5545e0ccd7d18266d0c2fa97b
Reviewed-on: https://chromium-review.googlesource.com/834049
Reviewed-by: Mitsuru Oshima <oshima@chromium.org>
Reviewed-by: Jacob Dufault <jdufault@chromium.org>
Commit-Queue: Aga Wronska <agawronska@chromium.org>
Cr-Commit-Position: refs/heads/master@{#526848}
  • Loading branch information
Aga Wronska authored and Commit Bot committed Jan 3, 2018
1 parent ff58622 commit 732b86f
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ LockScreenActionBackgroundController::Create() {
// Web UI based lock screen implements its own background - use the stub
// lock action background controller implementation unless md-based lock UI
// is used.
if (switches::IsUsingWebUiLock())
if (!switches::IsUsingViewsLock())
return std::make_unique<LockScreenActionBackgroundControllerStub>();
return std::make_unique<LockScreenActionBackgroundControllerImpl>();
}
Expand Down
4 changes: 2 additions & 2 deletions ash/public/cpp/ash_switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ bool IsUsingViewsLogin() {
return base::CommandLine::ForCurrentProcess()->HasSwitch(kShowViewsLogin);
}

bool IsUsingWebUiLock() {
return base::CommandLine::ForCurrentProcess()->HasSwitch(kShowWebUiLock);
bool IsUsingViewsLock() {
return !base::CommandLine::ForCurrentProcess()->HasSwitch(kShowWebUiLock);
}

} // namespace switches
Expand Down
2 changes: 1 addition & 1 deletion ash/public/cpp/ash_switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ ASH_PUBLIC_EXPORT bool IsDisplayMoveWindowAccelsEnabled();
ASH_PUBLIC_EXPORT bool IsNightLightEnabled();
ASH_PUBLIC_EXPORT bool IsSidebarEnabled();
ASH_PUBLIC_EXPORT bool IsUsingViewsLogin();
ASH_PUBLIC_EXPORT bool IsUsingWebUiLock();
ASH_PUBLIC_EXPORT bool IsUsingViewsLock();

} // namespace switches
} // namespace ash
Expand Down
2 changes: 1 addition & 1 deletion ash/shelf/shelf_widget.cc
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ bool ShelfWidget::IsUsingViewsShelf() {
return true;
case session_manager::SessionState::LOCKED:
case session_manager::SessionState::LOGIN_SECONDARY:
return !switches::IsUsingWebUiLock();
return switches::IsUsingViewsLock();
case session_manager::SessionState::UNKNOWN:
case session_manager::SessionState::OOBE:
case session_manager::SessionState::LOGIN_PRIMARY:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ void StateController::RequestNewLockScreenNote(LockScreenNoteOrigin origin) {
// This is not needed for requests that come from the lock UI as the lock
// screen UI sends these requests *after* the note action launch animation.
if (origin == LockScreenNoteOrigin::kStylusEject &&
ash::switches::IsUsingWebUiLock()) {
!ash::switches::IsUsingViewsLock()) {
app_launch_delayed_for_animation_ = true;
return;
}
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/chromeos/login/lock/screen_locker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ void ScreenLocker::Init() {

authenticator_ = UserSessionManager::GetInstance()->CreateAuthenticator(this);
extended_authenticator_ = ExtendedAuthenticator::Create(this);
if (ash::switches::IsUsingWebUiLock()) {
if (!ash::switches::IsUsingViewsLock()) {
web_ui_.reset(new WebUIScreenLocker(this));
delegate_ = web_ui_.get();
web_ui_->LockScreen();
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/chromeos/login/lock/webui_screen_locker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void WebUIScreenLocker::RequestPreload() {
// static
bool WebUIScreenLocker::ShouldPreloadLockScreen() {
// Only preload webui lock screen when it is used.
if (!ash::switches::IsUsingWebUiLock())
if (ash::switches::IsUsingViewsLock())
return false;

// Bail for mash because IdleDetector/UserActivityDetector does not work
Expand Down
4 changes: 3 additions & 1 deletion chrome/browser/ui/webui/chromeos/login/oobe_ui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,9 @@ void OobeUI::GetLocalizedStrings(base::DictionaryValue* localized_strings) {
? "off"
: "on");
localized_strings->SetString(
"showMdLogin", ash::switches::IsUsingWebUiLock() ? "off" : "on");
"showViewsLock", ash::switches::IsUsingViewsLock() ? "on" : "off");
localized_strings->SetString(
"showViewsLogin", ash::switches::IsUsingViewsLogin() ? "on" : "off");
localized_strings->SetBoolean(
"changePictureVideoModeEnabled",
base::FeatureList::IsEnabled(features::kChangePictureVideoMode));
Expand Down
9 changes: 7 additions & 2 deletions ui/login/display_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,10 +293,15 @@ cr.define('cr.ui.login', function() {
* The header bar should be hidden when views-based shelf is shown.
*/
get showingViewsBasedShelf() {
return loadTimeData.valueExists('showMdLogin') &&
loadTimeData.getString('showMdLogin') == 'on' &&
var showingViewsLock = loadTimeData.valueExists('showViewsLock') &&
loadTimeData.getString('showViewsLock') == 'on' &&
(this.displayType_ == DISPLAY_TYPE.LOCK ||
this.displayType_ == DISPLAY_TYPE.USER_ADDING);
var showingViewsLogin = loadTimeData.valueExists('showViewsLogin') &&
loadTimeData.getString('showViewsLogin') == 'on' &&
(this.displayType_ == DISPLAY_TYPE.LOGIN ||
this.displayType_ == DISPLAY_TYPE.OOBE);
return showingViewsLock || showingViewsLogin;
},

/**
Expand Down

0 comments on commit 732b86f

Please sign in to comment.