Commit 98ec252a authored by Anastasiia Nikolaienko's avatar Anastasiia Nikolaienko Committed by Commit Bot

Add a semi-opaque backdrop mode

Change black background to semi-opaque (60% #202124) for 'Add Account'
dialog. This is a short term fix until crbug/1016828 is resolved.

Bug: 997479, 1016828
Change-Id: I4741e2847f25b30a5ca3ee295569ea0c1c81cf4f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1847274
Commit-Queue: Anastasiia Nikolaienko <anastasiian@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Reviewed-by: default avatarMitsuru Oshima (slow) <oshima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#709109}
parent 6c71623f
...@@ -116,7 +116,7 @@ class DragWindowFromShelfController : public aura::WindowObserver { ...@@ -116,7 +116,7 @@ class DragWindowFromShelfController : public aura::WindowObserver {
gfx::Point initial_location_in_screen_; gfx::Point initial_location_in_screen_;
gfx::Point previous_location_in_screen_; gfx::Point previous_location_in_screen_;
bool drag_started_ = false; bool drag_started_ = false;
BackdropWindowMode original_backdrop_mode_ = BackdropWindowMode::kAuto; BackdropWindowMode original_backdrop_mode_ = BackdropWindowMode::kAutoOpaque;
// Hide all eligible windows during window dragging. Depends on different // Hide all eligible windows during window dragging. Depends on different
// scenarios, we may or may not reshow there windows when drag ends. // scenarios, we may or may not reshow there windows when drag ends.
......
...@@ -23,7 +23,7 @@ DEFINE_OWNED_UI_CLASS_PROPERTY_KEY(std::string, kAppIDKey, nullptr) ...@@ -23,7 +23,7 @@ DEFINE_OWNED_UI_CLASS_PROPERTY_KEY(std::string, kAppIDKey, nullptr)
DEFINE_OWNED_UI_CLASS_PROPERTY_KEY(std::string, kArcPackageNameKey, nullptr) DEFINE_OWNED_UI_CLASS_PROPERTY_KEY(std::string, kArcPackageNameKey, nullptr)
DEFINE_UI_CLASS_PROPERTY_KEY(BackdropWindowMode, DEFINE_UI_CLASS_PROPERTY_KEY(BackdropWindowMode,
kBackdropWindowMode, kBackdropWindowMode,
BackdropWindowMode::kAuto) BackdropWindowMode::kAutoOpaque)
DEFINE_UI_CLASS_PROPERTY_KEY(bool, kBlockedForAssistantSnapshotKey, false) DEFINE_UI_CLASS_PROPERTY_KEY(bool, kBlockedForAssistantSnapshotKey, false)
DEFINE_UI_CLASS_PROPERTY_KEY(bool, kCanAttachToAnotherWindowKey, true) DEFINE_UI_CLASS_PROPERTY_KEY(bool, kCanAttachToAnotherWindowKey, true)
DEFINE_UI_CLASS_PROPERTY_KEY(bool, kCanConsumeSystemKeysKey, false) DEFINE_UI_CLASS_PROPERTY_KEY(bool, kCanConsumeSystemKeysKey, false)
......
...@@ -28,9 +28,11 @@ enum class WindowPinType; ...@@ -28,9 +28,11 @@ enum class WindowPinType;
enum class WindowStateType; enum class WindowStateType;
enum class BackdropWindowMode { enum class BackdropWindowMode {
kEnabled, // The window needs a backdrop shown behind it. kEnabled, // The window needs a backdrop shown behind it.
kDisabled, // The window should never have a backdrop. kDisabled, // The window should never have a backdrop.
kAuto, // The window manager decides if the window should have a backdrop. kAutoOpaque, // The window manager decides if the window should have a fully
// opaque backdrop.
kAutoSemiOpaque, // The window needs a semi-opaque backdrop shown behind it.
}; };
// Shell-specific window property keys for use by ash and its clients. // Shell-specific window property keys for use by ash and its clients.
......
...@@ -2740,7 +2740,7 @@ TEST_P(SplitViewTabDraggingTest, NoBackDropDuringDragging) { ...@@ -2740,7 +2740,7 @@ TEST_P(SplitViewTabDraggingTest, NoBackDropDuringDragging) {
std::unique_ptr<aura::Window> window( std::unique_ptr<aura::Window> window(
CreateWindowWithType(bounds, AppType::BROWSER)); CreateWindowWithType(bounds, AppType::BROWSER));
EXPECT_EQ(window->GetProperty(kBackdropWindowMode), EXPECT_EQ(window->GetProperty(kBackdropWindowMode),
BackdropWindowMode::kAuto); BackdropWindowMode::kAutoOpaque);
std::unique_ptr<WindowResizer> resizer = std::unique_ptr<WindowResizer> resizer =
StartDrag(window.get(), window.get()); StartDrag(window.get(), window.get());
...@@ -2754,7 +2754,7 @@ TEST_P(SplitViewTabDraggingTest, NoBackDropDuringDragging) { ...@@ -2754,7 +2754,7 @@ TEST_P(SplitViewTabDraggingTest, NoBackDropDuringDragging) {
resizer->CompleteDrag(); resizer->CompleteDrag();
EXPECT_EQ(window->GetProperty(kBackdropWindowMode), EXPECT_EQ(window->GetProperty(kBackdropWindowMode),
BackdropWindowMode::kAuto); BackdropWindowMode::kAutoOpaque);
} }
// Test that in tablet mode, the window that is in tab-dragging process should // Test that in tablet mode, the window that is in tab-dragging process should
......
...@@ -221,7 +221,7 @@ class TabletModeBrowserWindowDragDelegate::WindowsHider ...@@ -221,7 +221,7 @@ class TabletModeBrowserWindowDragDelegate::WindowsHider
// The original backdrop mode of the source window. Should be disabled during // The original backdrop mode of the source window. Should be disabled during
// dragging. // dragging.
BackdropWindowMode source_window_backdrop_ = BackdropWindowMode::kAuto; BackdropWindowMode source_window_backdrop_ = BackdropWindowMode::kAutoOpaque;
DISALLOW_COPY_AND_ASSIGN(WindowsHider); DISALLOW_COPY_AND_ASSIGN(WindowsHider);
}; };
......
...@@ -132,7 +132,7 @@ class TabletModeWindowDragDelegate { ...@@ -132,7 +132,7 @@ class TabletModeWindowDragDelegate {
aura::Window* dragged_window_ = nullptr; // not owned. aura::Window* dragged_window_ = nullptr; // not owned.
// The backdrop should be disabled during dragging and resumed after dragging. // The backdrop should be disabled during dragging and resumed after dragging.
BackdropWindowMode original_backdrop_mode_ = BackdropWindowMode::kAuto; BackdropWindowMode original_backdrop_mode_ = BackdropWindowMode::kAutoOpaque;
// The dragged window should have the active window shadow elevation during // The dragged window should have the active window shadow elevation during
// dragging. // dragging.
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include "ash/public/cpp/app_types.h" #include "ash/public/cpp/app_types.h"
#include "ash/public/cpp/shell_window_ids.h" #include "ash/public/cpp/shell_window_ids.h"
#include "ash/public/cpp/window_animation_types.h" #include "ash/public/cpp/window_animation_types.h"
#include "ash/public/cpp/window_properties.h"
#include "ash/screen_util.h" #include "ash/screen_util.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/wallpaper/wallpaper_controller_impl.h" #include "ash/wallpaper/wallpaper_controller_impl.h"
...@@ -32,8 +31,21 @@ ...@@ -32,8 +31,21 @@
#include "ui/wm/core/window_util.h" #include "ui/wm/core/window_util.h"
namespace ash { namespace ash {
namespace { namespace {
constexpr SkColor kSemiOpaqueBackdropColor =
SkColorSetARGB(0x99, 0x20, 0x21, 0x24);
SkColor GetBackdropColorByMode(BackdropWindowMode mode) {
if (mode == BackdropWindowMode::kAutoSemiOpaque)
return kSemiOpaqueBackdropColor;
DCHECK(mode == BackdropWindowMode::kAutoOpaque ||
mode == BackdropWindowMode::kEnabled);
return SK_ColorBLACK;
}
class BackdropEventHandler : public ui::EventHandler { class BackdropEventHandler : public ui::EventHandler {
public: public:
BackdropEventHandler() = default; BackdropEventHandler() = default;
...@@ -275,7 +287,7 @@ void BackdropController::UpdateBackdropInternal() { ...@@ -275,7 +287,7 @@ void BackdropController::UpdateBackdropInternal() {
return; return;
} }
EnsureBackdropWidget(); EnsureBackdropWidget(window->GetProperty(kBackdropWindowMode));
UpdateAccessibilityMode(); UpdateAccessibilityMode();
if (window == backdrop_window_ && backdrop_->IsVisible()) { if (window == backdrop_window_ && backdrop_->IsVisible()) {
...@@ -299,9 +311,13 @@ void BackdropController::UpdateBackdropInternal() { ...@@ -299,9 +311,13 @@ void BackdropController::UpdateBackdropInternal() {
container_->StackChildBelow(backdrop_window_, window); container_->StackChildBelow(backdrop_window_, window);
} }
void BackdropController::EnsureBackdropWidget() { void BackdropController::EnsureBackdropWidget(BackdropWindowMode mode) {
if (backdrop_) if (backdrop_) {
SkColor backdrop_color = GetBackdropColorByMode(mode);
if (backdrop_window_->layer()->GetTargetColor() != backdrop_color)
backdrop_window_->layer()->SetColor(backdrop_color);
return; return;
}
backdrop_ = std::make_unique<views::Widget>(); backdrop_ = std::make_unique<views::Widget>();
views::Widget::InitParams params( views::Widget::InitParams params(
...@@ -321,7 +337,7 @@ void BackdropController::EnsureBackdropWidget() { ...@@ -321,7 +337,7 @@ void BackdropController::EnsureBackdropWidget() {
// The backdrop window in always on top container can be reparented without // The backdrop window in always on top container can be reparented without
// this when the window is set to fullscreen. // this when the window is set to fullscreen.
AlwaysOnTopController::SetDisallowReparent(backdrop_window_); AlwaysOnTopController::SetDisallowReparent(backdrop_window_);
backdrop_window_->layer()->SetColor(SK_ColorBLACK); backdrop_window_->layer()->SetColor(GetBackdropColorByMode(mode));
WindowState::Get(backdrop_window_)->set_allow_set_bounds_direct(true); WindowState::Get(backdrop_window_)->set_allow_set_bounds_direct(true);
} }
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "ash/ash_export.h" #include "ash/ash_export.h"
#include "ash/public/cpp/tablet_mode_observer.h" #include "ash/public/cpp/tablet_mode_observer.h"
#include "ash/public/cpp/wallpaper_controller_observer.h" #include "ash/public/cpp/wallpaper_controller_observer.h"
#include "ash/public/cpp/window_properties.h"
#include "ash/wm/overview/overview_observer.h" #include "ash/wm/overview/overview_observer.h"
#include "ash/wm/splitview/split_view_controller.h" #include "ash/wm/splitview/split_view_controller.h"
#include "ash/wm/splitview/split_view_observer.h" #include "ash/wm/splitview/split_view_observer.h"
...@@ -94,7 +95,7 @@ class ASH_EXPORT BackdropController : public AccessibilityObserver, ...@@ -94,7 +95,7 @@ class ASH_EXPORT BackdropController : public AccessibilityObserver,
void UpdateBackdropInternal(); void UpdateBackdropInternal();
void EnsureBackdropWidget(); void EnsureBackdropWidget(BackdropWindowMode mode);
void UpdateAccessibilityMode(); void UpdateAccessibilityMode();
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <algorithm> #include <algorithm>
#include <string> #include <string>
#include "ash/public/cpp/window_properties.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/macros.h" #include "base/macros.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h" #include "chrome/browser/chromeos/profiles/profile_helper.h"
...@@ -66,6 +67,11 @@ void InlineLoginHandlerDialogChromeOS::Show(const std::string& email) { ...@@ -66,6 +67,11 @@ void InlineLoginHandlerDialogChromeOS::Show(const std::string& email) {
// Will be deleted by |SystemWebDialogDelegate::OnDialogClosed|. // Will be deleted by |SystemWebDialogDelegate::OnDialogClosed|.
dialog = new InlineLoginHandlerDialogChromeOS(url); dialog = new InlineLoginHandlerDialogChromeOS(url);
dialog->ShowSystemDialog(); dialog->ShowSystemDialog();
// TODO(crbug.com/1016828): Remove/update this after the dialog behavior on
// Chrome OS is defined.
dialog->dialog_window()->SetProperty(
ash::kBackdropWindowMode, ash::BackdropWindowMode::kAutoSemiOpaque);
} }
void InlineLoginHandlerDialogChromeOS::AdjustWidgetInitParams( void InlineLoginHandlerDialogChromeOS::AdjustWidgetInitParams(
......
...@@ -1153,7 +1153,7 @@ void ClientControlledShellSurface::UpdateBackdrop() { ...@@ -1153,7 +1153,7 @@ void ClientControlledShellSurface::UpdateBackdrop() {
ash::BackdropWindowMode target_backdrop_mode = ash::BackdropWindowMode target_backdrop_mode =
enable_backdrop ? ash::BackdropWindowMode::kEnabled enable_backdrop ? ash::BackdropWindowMode::kEnabled
: ash::BackdropWindowMode::kAuto; : ash::BackdropWindowMode::kAutoOpaque;
if (window->GetProperty(ash::kBackdropWindowMode) != target_backdrop_mode) if (window->GetProperty(ash::kBackdropWindowMode) != target_backdrop_mode)
window->SetProperty(ash::kBackdropWindowMode, target_backdrop_mode); window->SetProperty(ash::kBackdropWindowMode, target_backdrop_mode);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment