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

Unified Diff: ash/wm/common/window_positioning_utils.h

Issue 1900443002: Removes aura dependencies from WindowPositioner (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nuke GetWorkAreaForWindowInParent and fix windows Created 4 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
« no previous file with comments | « ash/wm/aura/wm_window_aura.cc ('k') | ash/wm/common/window_positioning_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/common/window_positioning_utils.h
diff --git a/ash/wm/common/window_positioning_utils.h b/ash/wm/common/window_positioning_utils.h
new file mode 100644
index 0000000000000000000000000000000000000000..8145082f7890b79376a36c4ae49abb42ceab3a2b
--- /dev/null
+++ b/ash/wm/common/window_positioning_utils.h
@@ -0,0 +1,44 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ASH_WM_COMMON_WINDOW_POSITIONING_UTILS_H_
+#define ASH_WM_COMMON_WINDOW_POSITIONING_UTILS_H_
+
+#include "ash/ash_export.h"
+
+namespace gfx {
+class Rect;
+class Size;
+}
+
+namespace ash {
+namespace wm {
+
+// We force at least this many DIPs for any window on the screen.
+const int kMinimumOnScreenArea = 25;
+
+// Adjusts |bounds| so that the size does not exceed |max_size|.
+ASH_EXPORT void AdjustBoundsSmallerThan(const gfx::Size& max_size,
+ gfx::Rect* bounds);
+
+// Move the given bounds inside the given |visible_area| in parent coordinates,
+// including a safety margin given by |min_width| and |min_height|.
+// This also ensures that the top of the bounds is visible.
+ASH_EXPORT void AdjustBoundsToEnsureWindowVisibility(
+ const gfx::Rect& visible_area,
+ int min_width,
+ int min_height,
+ gfx::Rect* bounds);
+
+// Move the given bounds inside the given |visible_area| in parent coordinates,
+// including a safety margin given by |kMinimumOnScreenArea|.
+// This also ensures that the top of the bounds is visible.
+ASH_EXPORT void AdjustBoundsToEnsureMinimumWindowVisibility(
+ const gfx::Rect& visible_area,
+ gfx::Rect* bounds);
+
+} // namespace wm
+} // namespace ash
+
+#endif // ASH_WM_COMMON_WINDOW_POSITIONING_UTILS_H_
« no previous file with comments | « ash/wm/aura/wm_window_aura.cc ('k') | ash/wm/common/window_positioning_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698