Skip to content

Commit

Permalink
Add flag for disabling login wallpaper dimming and blur
Browse files Browse the repository at this point in the history
Add a switch for convenience of debugging issues such as
crbug.com/776613.

Also place the flag under about://flag because we may need to turn off
blur in non-dev mode for debugging purpose.

Bug: NONE
Change-Id: Ie6114f5a504f836f28ff3df3b749560e0155b1f7
Reviewed-on: https://chromium-review.googlesource.com/752063
Commit-Queue: Wenzhao (Colin) Zang <wzang@chromium.org>
Reviewed-by: Xiaoqian Dai <xdai@chromium.org>
Reviewed-by: Mitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#514337}
  • Loading branch information
Wenzhao Zang authored and Commit Bot committed Nov 7, 2017
1 parent 195d3b6 commit 50fb0b2
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 4 deletions.
3 changes: 3 additions & 0 deletions ash/public/cpp/ash_switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ const char kAshDebugShortcuts[] = "ash-debug-shortcuts";
// Enable keyboard shortcuts used by developers only.
const char kAshDeveloperShortcuts[] = "ash-dev-shortcuts";

// Disables the dimming and blur of the wallpaper on login and lock screens.
const char kAshDisableLoginDimAndBlur[] = "ash-disable-login-dim-and-blur";

// Use a single in-process shelf data model shared between Chrome and Ash.
// This only applies to the Classic Ash and Mus configs; synchronization between
// two models is required when running the Mash config via --mash.
Expand Down
1 change: 1 addition & 0 deletions ash/public/cpp/ash_switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ namespace switches {
ASH_PUBLIC_EXPORT extern const char kAshConstrainPointerToRoot[];
ASH_PUBLIC_EXPORT extern const char kAshDebugShortcuts[];
ASH_PUBLIC_EXPORT extern const char kAshDeveloperShortcuts[];
ASH_PUBLIC_EXPORT extern const char kAshDisableLoginDimAndBlur[];
ASH_PUBLIC_EXPORT extern const char kAshDisableShelfModelSynchronization[];
ASH_PUBLIC_EXPORT extern const char kAshDisableSmoothScreenRotation[];
ASH_PUBLIC_EXPORT extern const char kAshDisableTabletAutohideTitlebars[];
Expand Down
8 changes: 7 additions & 1 deletion ash/wallpaper/wallpaper_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,12 @@ void WallpaperController::OpenSetWallpaperPage() {
}
}

bool WallpaperController::ShouldApplyDimAndBlur() const {
return Shell::Get()->session_controller()->IsUserSessionBlocked() &&
!base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kAshDisableLoginDimAndBlur);
}

void WallpaperController::AddObserver(
mojom::WallpaperObserverAssociatedPtrInfo observer) {
mojom::WallpaperObserverAssociatedPtr observer_ptr;
Expand Down Expand Up @@ -427,7 +433,7 @@ void WallpaperController::InstallDesktopController(aura::Window* root_window) {
return;
}

if (Shell::Get()->session_controller()->IsUserSessionBlocked())
if (ShouldApplyDimAndBlur())
component->SetWallpaperBlur(login_constants::kBlurSigma);

RootWindowController* controller =
Expand Down
4 changes: 4 additions & 0 deletions ash/wallpaper/wallpaper_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ class ASH_EXPORT WallpaperController
// Opens the set wallpaper page in the browser.
void OpenSetWallpaperPage();

// Wallpaper should be dimmed and blurred when showing login, lock, OOBE or
// add user screens.
bool ShouldApplyDimAndBlur() const;

// mojom::WallpaperController overrides:
void AddObserver(mojom::WallpaperObserverAssociatedPtrInfo observer) override;
void SetWallpaperPicker(mojom::WallpaperPickerPtr picker) override;
Expand Down
2 changes: 1 addition & 1 deletion ash/wallpaper/wallpaper_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ void WallpaperView::OnPaint(gfx::Canvas* canvas) {
return;

cc::PaintFlags flags;
if (Shell::Get()->session_controller()->IsUserSessionBlocked()) {
if (controller->ShouldApplyDimAndBlur()) {
flags.setColorFilter(SkColorFilter::MakeModeFilter(
GetWallpaperDarkenColor(), SkBlendMode::kDarken));
}
Expand Down
5 changes: 5 additions & 0 deletions chrome/browser/about_flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3552,6 +3552,11 @@ const FeatureEntry kFeatureEntries[] = {
flag_descriptions::kAshEnableKeyboardShortcutViewerName,
flag_descriptions::kAshEnableKeyboardShortcutViewerDescription, kOsCrOS,
SINGLE_VALUE_TYPE(ash::switches::kAshEnableKeyboardShortcutViewer)},

{"ash-disable-login-dim-and-blur",
flag_descriptions::kAshDisableLoginDimAndBlurName,
flag_descriptions::kAshDisableLoginDimAndBlurDescription, kOsCrOS,
SINGLE_DISABLE_VALUE_TYPE(ash::switches::kAshDisableLoginDimAndBlur)},
#endif // OS_CHROMEOS

#if defined(OS_CHROMEOS)
Expand Down
8 changes: 6 additions & 2 deletions chrome/browser/flag_descriptions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2425,8 +2425,7 @@ const char kDisableSystemTimezoneAutomaticDetectionDescription[] =

const char kEnableBackgroundBlurName[] = "Enable background blur.";
const char kEnableBackgroundBlurDescription[] =
"Enables background blur for the Peeking Launcher, Lock Screen, and Tab "
"Switcher.";
"Enables background blur for the Peeking Launcher and Tab Switcher.";

const char kEnableAndroidWallpapersAppName[] = "Android Wallpapers App";
const char kEnableAndroidWallpapersAppDescription[] =
Expand Down Expand Up @@ -2771,6 +2770,11 @@ const char kWebrtcH264WithOpenh264FfmpegDescription[] =

#if defined(OS_CHROMEOS)

const char kAshDisableLoginDimAndBlurName[] =
"Disable dimming and blur on login screen.";
const char kAshDisableLoginDimAndBlurDescription[] =
"Disable dimming and blur on login screen.";

const char kAshDisableSmoothScreenRotationName[] =
"Disable smooth rotation animations.";
const char kAshDisableSmoothScreenRotationDescription[] =
Expand Down
3 changes: 3 additions & 0 deletions chrome/browser/flag_descriptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -1714,6 +1714,9 @@ extern const char kWebrtcH264WithOpenh264FfmpegDescription[];

#if defined(OS_CHROMEOS)

extern const char kAshDisableLoginDimAndBlurName[];
extern const char kAshDisableLoginDimAndBlurDescription[];

extern const char kAshDisableSmoothScreenRotationName[];
extern const char kAshDisableSmoothScreenRotationDescription[];

Expand Down
1 change: 1 addition & 0 deletions tools/metrics/histograms/enums.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24259,6 +24259,7 @@ from previous Chrome versions.
<int value="-1487243228" label="NewUsbBackend:disabled"/>
<int value="-1482685863" label="enable-request-tablet-site"/>
<int value="-1480926949" label="MaterialDesignBookmarks:enabled"/>
<int value="-1480866718" label="ash-disable-login-dim-and-blur"/>
<int value="-1478876902" label="disable-permission-action-reporting"/>
<int value="-1473668019" label="token-binding:disabled"/>
<int value="-1473136627" label="enable-web-payments"/>
Expand Down

0 comments on commit 50fb0b2

Please sign in to comment.