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

Unified Diff: chrome/browser/ui/window_sizer/window_sizer_ash.cc

Issue 424463002: Makes a window that has been resized to maximized bounds, then maximized and then restored shrink (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Maximizes a window that has been resized to maximized bounds (fixed a test) Created 6 years, 4 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/window_sizer/window_sizer_ash.cc
diff --git a/chrome/browser/ui/window_sizer/window_sizer_ash.cc b/chrome/browser/ui/window_sizer/window_sizer_ash.cc
index 7c6da18dafa611c79b7e1971c5f3e2fc83af22e0..839bb2c3b9f739f28a8e87ba506177be1686ad4b 100644
--- a/chrome/browser/ui/window_sizer/window_sizer_ash.cc
+++ b/chrome/browser/ui/window_sizer/window_sizer_ash.cc
@@ -19,40 +19,53 @@ bool WindowSizer::GetBrowserBoundsAsh(gfx::Rect* bounds,
browser_->host_desktop_type() != chrome::HOST_DESKTOP_TYPE_ASH)
return false;
+ bool determined = false;
if (bounds->IsEmpty()) {
if (browser_->is_type_tabbed()) {
GetTabbedBrowserBoundsAsh(bounds, show_state);
- return true;
- }
-
- if (browser_->is_trusted_source()) {
+ determined = true;
+ } else if (browser_->is_trusted_source()) {
// For trusted popups (v1 apps and system windows), do not use the last
// active window bounds, only use saved or default bounds.
if (!GetSavedWindowBounds(bounds, show_state))
GetDefaultWindowBounds(GetTargetDisplay(gfx::Rect()), bounds);
- return true;
+ determined = true;
+ } else {
+ // In Ash, prioritize the last saved |show_state|. If you have questions
+ // or comments about this behavior please contact oshima@chromium.org.
+ if (state_provider_) {
+ gfx::Rect ignored_bounds, ignored_work_area;
+ state_provider_->GetPersistentState(&ignored_bounds,
+ &ignored_work_area,
+ show_state);
+ }
}
-
- // In Ash, prioritize the last saved |show_state|. If you have questions
- // or comments about this behavior please contact oshima@chromium.org.
- if (state_provider_) {
- gfx::Rect ignored_bounds, ignored_work_area;
- state_provider_->GetPersistentState(&ignored_bounds,
- &ignored_work_area,
- show_state);
+ } else {
+ // In case of a popup with an 'unspecified' location in ash, we are
+ // looking for a good screen location. We are interpreting (0,0) as an
+ // unspecified location.
+ if (browser_->is_type_popup() && bounds->origin().IsOrigin()) {
msw 2014/08/05 16:44:38 nit: combine this into an "else if" at line 43.
varkha 2014/08/05 17:55:23 Done.
+ *bounds = ash::Shell::GetInstance()->window_positioner()->
+ GetPopupPosition(*bounds);
+ determined = true;
}
- return false;
}
- // In case of a popup with an 'unspecified' location in ash, we are
- // looking for a good screen location. We are interpreting (0,0) as an
- // unspecified location.
- if (browser_->is_type_popup() && bounds->origin().IsOrigin()) {
- *bounds = ash::Shell::GetInstance()->window_positioner()->
- GetPopupPosition(*bounds);
- return true;
+ if (*show_state == ui::SHOW_STATE_DEFAULT) {
msw 2014/08/05 16:44:38 If this new behavior also applies to popup browser
varkha 2014/08/05 17:55:23 Makes sense to restrict this only to tabbed browse
+ gfx::Display display = screen_->GetDisplayMatching(*bounds);
+ gfx::Rect work_area = display.work_area();
+ bounds->AdjustToFit(work_area);
+ if (*bounds == work_area) {
+ // A window that occupies the whole work area gets maximized.
+ // |bounds| returned here become the restore bounds once the window
+ // gets maximized after this method returns. Return a sensible default
+ // in order to make restored state visibly different from maximized.
+ *show_state = ui::SHOW_STATE_MAXIMIZED;
+ *bounds = ash::WindowPositioner::GetDefaultWindowBounds(display);
+ determined = true;
+ }
}
- return false;
+ return determined;
}
void WindowSizer::GetTabbedBrowserBoundsAsh(

Powered by Google App Engine
This is Rietveld 408576698