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

Side by Side Diff: ash/wm/workspace/workspace_window_resizer.cc

Issue 2901663003: chromeos: converts WindowState to aura::Window (Closed)
Patch Set: feedback Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « ash/wm/workspace/workspace_layout_manager_unittest.cc ('k') | ash/wm_window.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/wm/workspace/workspace_window_resizer.h" 5 #include "ash/wm/workspace/workspace_window_resizer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 if (!window_state()->CanResize()) 709 if (!window_state()->CanResize())
710 return false; 710 return false;
711 711
712 for (aura::Window* root_window : Shell::Get()->GetAllRootWindows()) { 712 for (aura::Window* root_window : Shell::Get()->GetAllRootWindows()) {
713 // Test all children from the desktop in each root window. 713 // Test all children from the desktop in each root window.
714 const std::vector<aura::Window*>& children = 714 const std::vector<aura::Window*>& children =
715 root_window->GetChildById(kShellWindowId_DefaultContainer)->children(); 715 root_window->GetChildById(kShellWindowId_DefaultContainer)->children();
716 for (auto i = children.rbegin(); 716 for (auto i = children.rbegin();
717 i != children.rend() && !matcher.AreEdgesObscured(); ++i) { 717 i != children.rend() && !matcher.AreEdgesObscured(); ++i) {
718 wm::WindowState* other_state = wm::GetWindowState(*i); 718 wm::WindowState* other_state = wm::GetWindowState(*i);
719 if (other_state->window()->aura_window() == GetTarget() || 719 if (other_state->window() == GetTarget() ||
720 !other_state->window()->IsVisible() || 720 !other_state->window()->IsVisible() ||
721 !other_state->IsNormalOrSnapped() || !other_state->CanResize()) { 721 !other_state->IsNormalOrSnapped() || !other_state->CanResize()) {
722 continue; 722 continue;
723 } 723 }
724 if (matcher.ShouldAttach(other_state->window()->GetBoundsInScreen(), 724 if (matcher.ShouldAttach(other_state->window()->GetBoundsInScreen(),
725 &magnetism_edge_)) { 725 &magnetism_edge_)) {
726 magnetism_window_ = other_state->window()->aura_window(); 726 magnetism_window_ = other_state->window();
727 window_tracker_.Add(magnetism_window_); 727 window_tracker_.Add(magnetism_window_);
728 return true; 728 return true;
729 } 729 }
730 } 730 }
731 } 731 }
732 return false; 732 return false;
733 } 733 }
734 734
735 void WorkspaceWindowResizer::AdjustBoundsForMainWindow(int sticky_size, 735 void WorkspaceWindowResizer::AdjustBoundsForMainWindow(int sticky_size,
736 gfx::Rect* bounds) { 736 gfx::Rect* bounds) {
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED); 962 snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED);
963 gfx::Rect snapped_bounds = 963 gfx::Rect snapped_bounds =
964 ScreenUtil::GetDisplayWorkAreaBoundsInParent(GetTarget()); 964 ScreenUtil::GetDisplayWorkAreaBoundsInParent(GetTarget());
965 if (snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED) 965 if (snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED)
966 snapped_bounds.set_x(snapped_bounds.right() - bounds_in_parent.width()); 966 snapped_bounds.set_x(snapped_bounds.right() - bounds_in_parent.width());
967 snapped_bounds.set_width(bounds_in_parent.width()); 967 snapped_bounds.set_width(bounds_in_parent.width());
968 return bounds_in_parent == snapped_bounds; 968 return bounds_in_parent == snapped_bounds;
969 } 969 }
970 970
971 } // namespace ash 971 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/workspace/workspace_layout_manager_unittest.cc ('k') | ash/wm_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698