Chromium Code Reviews| Index: ui/views/widget/native_widget_aura.cc |
| diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc |
| index aa0f3c727034a7712d9006b8b9e7998803942b58..0cc51b1fcad65a71e4a0b1db8305898357de9472 100644 |
| --- a/ui/views/widget/native_widget_aura.cc |
| +++ b/ui/views/widget/native_widget_aura.cc |
| @@ -374,7 +374,21 @@ gfx::Rect NativeWidgetAura::GetRestoredBounds() const { |
| if (restore_bounds) |
| return *restore_bounds; |
| } |
| - return window_->GetBoundsInScreen(); |
| + gfx::Rect bounds = window_->GetBoundsInScreen(); |
| + if (IsDocked()) { |
| + // Restore bounds are in screen coordinates, no need to convert. |
| + gfx::Rect* restore_bounds = |
| + window_->GetProperty(aura::client::kRestoreBoundsKey); |
| + // Use current window horizontal offset origin in order to preserve docked |
| + // alignment but preserve restored size and vertical offset for the time |
| + // when the |window_| gets undocked. |
| + if (restore_bounds) { |
| + bounds.set_size(restore_bounds->size()); |
| + bounds.set_y(restore_bounds->y()); |
| + } |
| + } |
| + |
| + return bounds; |
| } |
| void NativeWidgetAura::SetBounds(const gfx::Rect& bounds) { |
| @@ -467,8 +481,10 @@ void NativeWidgetAura::ShowWithWindowState(ui::WindowShowState state) { |
| if (!window_) |
| return; |
| - if (state == ui::SHOW_STATE_MAXIMIZED || state == ui::SHOW_STATE_FULLSCREEN) |
| + if (state == ui::SHOW_STATE_MAXIMIZED || state == ui::SHOW_STATE_FULLSCREEN || |
| + state == ui::SHOW_STATE_DOCKED) { |
|
Peter Kasting
2015/07/10 16:40:56
Nit: No {}
varkha
2015/07/10 19:38:26
Doesn't multiline condition suggest braces?
|
| window_->SetProperty(aura::client::kShowStateKey, state); |
| + } |
| window_->Show(); |
| if (delegate_->CanActivate()) { |
| if (state != ui::SHOW_STATE_INACTIVE) |
| @@ -958,6 +974,12 @@ NativeWidgetAura::~NativeWidgetAura() { |
| //////////////////////////////////////////////////////////////////////////////// |
| // NativeWidgetAura, private: |
| +bool NativeWidgetAura::IsDocked() const { |
| + return window_ && |
| + window_->GetProperty(aura::client::kShowStateKey) == |
| + ui::SHOW_STATE_DOCKED; |
| +} |
| + |
| void NativeWidgetAura::SetInitialFocus(ui::WindowShowState show_state) { |
| // The window does not get keyboard messages unless we focus it. |
| if (!GetWidget()->SetInitialFocus(show_state)) |