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

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 (rebased) 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..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(&params, 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);
}

Powered by Google App Engine
This is Rietveld 408576698