Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(577)

Unified Diff: chrome/browser/ui/views/apps/chrome_native_app_window_views.cc

Issue 1056793006: [Docking] Persists docked state on Chrome OS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: [Docking] Makes docked state persistent on Chrome OS (comments) Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..2942aeca6fa6b5d966f9073351b3e408568c4079 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
@@ -108,6 +108,7 @@ void ChromeNativeAppWindowViews::OnBeforeWidgetInit(
}
void ChromeNativeAppWindowViews::OnBeforePanelWidgetInit(
+ bool use_default_bounds,
views::Widget::InitParams* init_params,
views::Widget* widget) {
}
@@ -142,7 +143,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 +211,18 @@ void ChromeNativeAppWindowViews::InitializePanelWindow(
else if (preferred_size_.height() < kMinPanelHeight)
preferred_size_.set_height(kMinPanelHeight);
- params.bounds = gfx::Rect(preferred_size_);
- OnBeforePanelWidgetInit(&params, widget());
+ // When a panel is not docked it will be placed at a default origin in the
+ // currently active target root window.
+ bool use_default_bounds = create_params.state != ui::SHOW_STATE_DOCKED;
+ // Sanitize initial origin reseting it in case it was not specified.
+ using BoundsSpecification = AppWindow::BoundsSpecification;
+ bool position_specified =
+ initial_window_bounds.x() != BoundsSpecification::kUnspecifiedPosition &&
+ initial_window_bounds.y() != BoundsSpecification::kUnspecifiedPosition;
+ params.bounds = (use_default_bounds || !position_specified) ?
+ gfx::Rect(preferred_size_) :
+ gfx::Rect(initial_window_bounds.origin(), preferred_size_);
+ OnBeforePanelWidgetInit(use_default_bounds, &params, widget());
widget()->Init(params);
widget()->set_focus_on_creation(create_params.focused);
}

Powered by Google App Engine
This is Rietveld 408576698