Chromium Code Reviews| Index: chrome/browser/ui/views/apps/chrome_native_app_window_views.cc |
| diff --git a/chrome/browser/ui/views/apps/chrome_native_app_window_views.cc b/chrome/browser/ui/views/apps/chrome_native_app_window_views.cc |
| index e2427294378e2a7b3f9ce8959d72b524b71565d7..cbaba923c29603576d2e4110d36ceef6e67e9fde 100644 |
| --- a/chrome/browser/ui/views/apps/chrome_native_app_window_views.cc |
| +++ b/chrome/browser/ui/views/apps/chrome_native_app_window_views.cc |
| @@ -142,7 +142,7 @@ void ChromeNativeAppWindowViews::InitializeDefaultWindow( |
| SetContentSizeConstraints(create_params.GetContentMinimumSize(frame_insets), |
| create_params.GetContentMaximumSize(frame_insets)); |
| if (!window_bounds.IsEmpty()) { |
| - typedef AppWindow::BoundsSpecification BoundsSpecification; |
| + using BoundsSpecification = AppWindow::BoundsSpecification; |
| bool position_specified = |
| window_bounds.x() != BoundsSpecification::kUnspecifiedPosition && |
| window_bounds.y() != BoundsSpecification::kUnspecifiedPosition; |
| @@ -210,8 +210,22 @@ void ChromeNativeAppWindowViews::InitializePanelWindow( |
| else if (preferred_size_.height() < kMinPanelHeight) |
| preferred_size_.set_height(kMinPanelHeight); |
| - params.bounds = gfx::Rect(preferred_size_); |
| + // When a panel is not docked |initial_window_bounds|'s origin is reset to |
| + // |kUnspecifiedPosition| to trigger placing it in the currently active |
| + // target root window. |
| + using BoundsSpecification = AppWindow::BoundsSpecification; |
| + if (create_params.state != ui::SHOW_STATE_DOCKED) { |
| + initial_window_bounds.set_origin( |
| + gfx::Point(BoundsSpecification::kUnspecifiedPosition, |
| + BoundsSpecification::kUnspecifiedPosition)); |
| + } |
| + params.bounds = gfx::Rect(initial_window_bounds.origin(), preferred_size_); |
|
benwells
2015/04/28 23:46:01
This logic is a bit hard to follow. I can see that
varkha
2015/04/29 16:54:16
Done.
|
| OnBeforePanelWidgetInit(¶ms, widget()); |
| + bool position_specified = |
| + params.bounds.x() != BoundsSpecification::kUnspecifiedPosition && |
| + params.bounds.y() != BoundsSpecification::kUnspecifiedPosition; |
| + if (!position_specified) |
| + params.bounds = gfx::Rect(preferred_size_); |
| widget()->Init(params); |
| widget()->set_focus_on_creation(create_params.focused); |
| } |