Commit 610cb90e authored by Jun Mukai's avatar Jun Mukai Committed by Commit Bot

Set the proper size of WallpaperViewShield

During the debug, I've just come to realize that the shield layer
of the wallpaper view is zero-sized; so it does not make any
visual effects. It needs to set bounds on creation.

Bug: 1036804
Test: manually
Change-Id: Ifa2dea70424355db12741f7d4bf41b8b3ce8bffa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2080885Reviewed-by: default avatarAhmed Fakhry <afakhry@chromium.org>
Reviewed-by: default avatarAlexander Alekseev <alemate@chromium.org>
Commit-Queue: Jun Mukai <mukai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#745701}
parent 8a513955
...@@ -95,6 +95,7 @@ void WallpaperView::SetLockShieldEnabled(bool enabled) { ...@@ -95,6 +95,7 @@ void WallpaperView::SetLockShieldEnabled(bool enabled) {
shield_view_->SetPaintToLayer(ui::LAYER_SOLID_COLOR); shield_view_->SetPaintToLayer(ui::LAYER_SOLID_COLOR);
shield_view_->layer()->SetColor(SK_ColorBLACK); shield_view_->layer()->SetColor(SK_ColorBLACK);
shield_view_->layer()->SetName("WallpaperViewShield"); shield_view_->layer()->SetName("WallpaperViewShield");
shield_view_->SetBoundsRect(parent()->GetLocalBounds());
} else { } else {
DCHECK(shield_view_); DCHECK(shield_view_);
parent()->RemoveChildView(shield_view_); parent()->RemoveChildView(shield_view_);
...@@ -110,6 +111,11 @@ bool WallpaperView::OnMousePressed(const ui::MouseEvent& event) { ...@@ -110,6 +111,11 @@ bool WallpaperView::OnMousePressed(const ui::MouseEvent& event) {
return true; return true;
} }
void WallpaperView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
if (shield_view_)
shield_view_->SetBoundsRect(parent()->GetLocalBounds());
}
void WallpaperView::ShowContextMenuForViewImpl(views::View* source, void WallpaperView::ShowContextMenuForViewImpl(views::View* source,
const gfx::Point& point, const gfx::Point& point,
ui::MenuSourceType source_type) { ui::MenuSourceType source_type) {
......
...@@ -38,6 +38,7 @@ class WallpaperView : public WallpaperBaseView, ...@@ -38,6 +38,7 @@ class WallpaperView : public WallpaperBaseView,
// views::View: // views::View:
const char* GetClassName() const override; const char* GetClassName() const override;
bool OnMousePressed(const ui::MouseEvent& event) override; bool OnMousePressed(const ui::MouseEvent& event) override;
void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
// views::ContextMenuController: // views::ContextMenuController:
void ShowContextMenuForViewImpl(views::View* source, void ShowContextMenuForViewImpl(views::View* source,
......
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