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

Unified Diff: ash/wm/window_util.cc

Issue 99303006: Do not send the OnWindowShowTypeChanged() notification if the show type has not changed (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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
« no previous file with comments | « ash/wm/window_state.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/window_util.cc
diff --git a/ash/wm/window_util.cc b/ash/wm/window_util.cc
index 8d320a9c2e2acdccbcd66b3577787c18ffc49bcc..83e9199aec404fa03a9c850886914d3041870ab3 100644
--- a/ash/wm/window_util.cc
+++ b/ash/wm/window_util.cc
@@ -7,6 +7,7 @@
#include <vector>
#include "ash/ash_constants.h"
+#include "ash/screen_ash.h"
#include "ash/shell.h"
#include "ash/wm/window_properties.h"
#include "ash/wm/window_state.h"
@@ -62,12 +63,19 @@ void CenterWindow(aura::Window* window) {
const gfx::Display display =
Shell::GetScreen()->GetDisplayNearestWindow(window);
gfx::Rect center = display.work_area();
- gfx::Size size = window_state->HasRestoreBounds() ?
- window_state->GetRestoreBoundsInScreen().size() :
- window->bounds().size();
- center.ClampToCenteredSize(size);
- window_state->SetRestoreBoundsInScreen(center);
- window_state->Restore();
+ gfx::Size size = window->bounds().size();
+ if (window_state->IsSnapped()) {
+ if (window_state->HasRestoreBounds())
+ size = window_state->GetRestoreBoundsInScreen().size();
+ center.ClampToCenteredSize(size);
+ window_state->SetRestoreBoundsInScreen(center);
+ window_state->Restore();
+ } else {
+ center = ScreenAsh::ConvertRectFromScreen(window->parent(),
+ center);
+ center.ClampToCenteredSize(size);
+ window->SetBounds(center);
+ }
}
void AdjustBoundsToEnsureMinimumWindowVisibility(const gfx::Rect& visible_area,
« no previous file with comments | « ash/wm/window_state.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698