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

Unified Diff: ash/wm/window_util.cc

Issue 1901773002: Removes most of aura dependencies from DefaultState (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@wm_window_positioner
Patch Set: nit and merge 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/window_util.h ('k') | ash/wm/workspace/workspace_types.h » ('j') | 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 f888f79fb60e516b22e8cd85b04882707ac589c0..c8e5f76041080b2b66559f51f1a8fb3139463875 100644
--- a/ash/wm/window_util.cc
+++ b/ash/wm/window_util.cc
@@ -34,25 +34,6 @@
namespace ash {
namespace wm {
-namespace {
-
-// Returns the default width of a snapped window.
-int GetDefaultSnappedWindowWidth(wm::WmWindow* window) {
- const float kSnappedWidthWorkspaceRatio = 0.5f;
-
- int work_area_width = GetDisplayWorkAreaBoundsInParent(window).width();
- int min_width = window->GetMinimumSize().width();
- int ideal_width =
- static_cast<int>(work_area_width * kSnappedWidthWorkspaceRatio);
- return std::min(work_area_width, std::max(ideal_width, min_width));
-}
-
-int GetDefaultSnappedWindowWidth(aura::Window* window) {
- return GetDefaultSnappedWindowWidth(WmWindowAura::Get(window));
-}
-
-} // namespace
-
// TODO(beng): replace many of these functions with the corewm versions.
void ActivateWindow(aura::Window* window) {
::wm::ActivateWindow(window);
@@ -92,39 +73,6 @@ void CenterWindow(aura::Window* window) {
wm::GetWindowState(window)->OnWMEvent(&event);
}
-gfx::Rect GetDefaultLeftSnappedWindowBoundsInParent(wm::WmWindow* window) {
- gfx::Rect work_area_in_parent(GetDisplayWorkAreaBoundsInParent(window));
- return gfx::Rect(work_area_in_parent.x(), work_area_in_parent.y(),
- GetDefaultSnappedWindowWidth(window),
- work_area_in_parent.height());
-}
-
-gfx::Rect GetDefaultRightSnappedWindowBoundsInParent(wm::WmWindow* window) {
- gfx::Rect work_area_in_parent(GetDisplayWorkAreaBoundsInParent(window));
- int width = GetDefaultSnappedWindowWidth(window);
- return gfx::Rect(work_area_in_parent.right() - width, work_area_in_parent.y(),
- width, work_area_in_parent.height());
-}
-
-gfx::Rect GetDefaultLeftSnappedWindowBoundsInParent(aura::Window* window) {
- gfx::Rect work_area_in_parent(ScreenUtil::GetDisplayWorkAreaBoundsInParent(
- window));
- return gfx::Rect(work_area_in_parent.x(),
- work_area_in_parent.y(),
- GetDefaultSnappedWindowWidth(window),
- work_area_in_parent.height());
-}
-
-gfx::Rect GetDefaultRightSnappedWindowBoundsInParent(aura::Window* window) {
- gfx::Rect work_area_in_parent(ScreenUtil::GetDisplayWorkAreaBoundsInParent(
- window));
- int width = GetDefaultSnappedWindowWidth(window);
- return gfx::Rect(work_area_in_parent.right() - width,
- work_area_in_parent.y(),
- width,
- work_area_in_parent.height());
-}
-
bool MoveWindowToEventRoot(aura::Window* window, const ui::Event& event) {
views::View* target = static_cast<views::View*>(event.target());
if (!target)
@@ -140,27 +88,6 @@ bool MoveWindowToEventRoot(aura::Window* window, const ui::Event& event) {
return true;
}
-void ReparentChildWithTransientChildren(aura::Window* child,
- aura::Window* old_parent,
- aura::Window* new_parent) {
- if (child->parent() == old_parent)
- new_parent->AddChild(child);
- ReparentTransientChildrenOfChild(child, old_parent, new_parent);
-}
-
-void ReparentTransientChildrenOfChild(aura::Window* child,
- aura::Window* old_parent,
- aura::Window* new_parent) {
- for (size_t i = 0;
- i < ::wm::GetTransientChildren(child).size();
- ++i) {
- ReparentChildWithTransientChildren(
- ::wm::GetTransientChildren(child)[i],
- old_parent,
- new_parent);
- }
-}
-
void SnapWindowToPixelBoundary(aura::Window* window) {
aura::Window* snapped_ancestor = window->parent();
while (snapped_ancestor) {
« no previous file with comments | « ash/wm/window_util.h ('k') | ash/wm/workspace/workspace_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698