Chromium Code Reviews| Index: ash/wm/dock/docked_window_layout_manager.cc |
| diff --git a/ash/wm/dock/docked_window_layout_manager.cc b/ash/wm/dock/docked_window_layout_manager.cc |
| index 87144109f02156d9698577bb155dd16477caf21e..4c0e79153ef00928c72dc4cf3195c652e0aff2e5 100644 |
| --- a/ash/wm/dock/docked_window_layout_manager.cc |
| +++ b/ash/wm/dock/docked_window_layout_manager.cc |
| @@ -141,7 +141,6 @@ class DockedBackgroundWidget : public views::Widget, |
| opaque_background_.SetBounds(gfx::Rect(GetWindowBoundsInScreen().size())); |
| opaque_background_.SetOpacity(0.0f); |
| GetNativeWindow()->layer()->Add(&opaque_background_); |
| - Hide(); |
| ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| gfx::ImageSkia shelf_background = |
| @@ -150,6 +149,9 @@ class DockedBackgroundWidget : public views::Widget, |
| shelf_background, SkBitmapOperations::ROTATION_90_CW); |
| shelf_background_right_ = gfx::ImageSkiaOperations::CreateRotatedImage( |
| shelf_background, SkBitmapOperations::ROTATION_270_CW); |
| + |
| + parent->StackChildAtBottom(GetNativeWindow()); |
| + Show(); |
| } |
| // Transitions to |visible_background_type_| if the widget is visible and to |
| @@ -414,7 +416,7 @@ DockedWindowLayoutManager::DockedWindowLayoutManager( |
| event_source_(DOCKED_ACTION_SOURCE_UNKNOWN), |
| last_active_window_(NULL), |
| last_action_time_(base::Time::Now()), |
| - background_widget_(new DockedBackgroundWidget(dock_container_)) { |
| + background_widget_(nullptr) { |
| DCHECK(dock_container); |
| aura::client::GetActivationClient(Shell::GetPrimaryRootWindow())-> |
| AddObserver(this); |
| @@ -825,7 +827,8 @@ void DockedWindowLayoutManager::OnShelfAlignmentChanged( |
| void DockedWindowLayoutManager::OnBackgroundUpdated( |
| ShelfBackgroundType background_type, |
| BackgroundAnimatorChangeType change_type) { |
| - background_widget_->SetBackgroundType(background_type, change_type); |
| + if (background_widget_) |
| + background_widget_->SetBackgroundType(background_type, change_type); |
|
sky
2016/04/13 21:45:42
If you lazily create background_widget_ after this
msw
2016/04/13 23:07:04
Good point; I made DockedBackgroundWidget init the
|
| } |
| ///////////////////////////////////////////////////////////////////////////// |
| @@ -1292,11 +1295,13 @@ void DockedWindowLayoutManager::UpdateDockBounds( |
| gfx::Rect background_bounds(docked_bounds_); |
| if (shelf_observer_) |
| background_bounds.Subtract(shelf_observer_->shelf_bounds_in_screen()); |
| - background_widget_->SetBackgroundBounds(background_bounds, alignment_); |
| - if (docked_width_ > 0) |
| - background_widget_->Show(); |
| - else |
| - background_widget_->Hide(); |
| + if (docked_width_ > 0) { |
| + if (!background_widget_) |
| + background_widget_.reset(new DockedBackgroundWidget(dock_container_)); |
| + background_widget_->SetBackgroundBounds(background_bounds, alignment_); |
| + } else if (background_widget_) { |
| + background_widget_.reset(); |
| + } |
| } |
| void DockedWindowLayoutManager::UpdateStacking(aura::Window* active_window) { |