| OLD | NEW |
| 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 "chrome/browser/ui/ash/window_positioner.h" | 5 #include "chrome/browser/ui/ash/window_positioner.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/wm/window_cycle_controller.h" | 8 #include "ash/wm/window_cycle_controller.h" |
| 9 #include "ash/wm/window_resizer.h" | 9 #include "ash/wm/window_resizer.h" |
| 10 #include "ash/wm/window_util.h" | 10 #include "ash/wm/window_util.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 last_popup_position_y_ += pop_position_offset_increment_y; | 93 last_popup_position_y_ += pop_position_offset_increment_y; |
| 94 } | 94 } |
| 95 return gfx::Rect(x + work_area.x(), y + work_area.y(), w, h); | 95 return gfx::Rect(x + work_area.x(), y + work_area.y(), w, h); |
| 96 } | 96 } |
| 97 | 97 |
| 98 gfx::Rect WindowPositioner::SmartPopupPosition( | 98 gfx::Rect WindowPositioner::SmartPopupPosition( |
| 99 const gfx::Rect& old_pos, | 99 const gfx::Rect& old_pos, |
| 100 const gfx::Rect& work_area, | 100 const gfx::Rect& work_area, |
| 101 int grid) { | 101 int grid) { |
| 102 const std::vector<aura::Window*> windows = | 102 const std::vector<aura::Window*> windows = |
| 103 ash::WindowCycleController::BuildWindowList(NULL); | 103 ash::WindowCycleController::BuildWindowList(NULL, false); |
| 104 | 104 |
| 105 std::vector<const gfx::Rect*> regions; | 105 std::vector<const gfx::Rect*> regions; |
| 106 // Process the window list and check if we can bail immediately. | 106 // Process the window list and check if we can bail immediately. |
| 107 for (size_t i = 0; i < windows.size(); i++) { | 107 for (size_t i = 0; i < windows.size(); i++) { |
| 108 // We only include opaque and visible windows. | 108 // We only include opaque and visible windows. |
| 109 if (windows[i] && windows[i]->IsVisible() && windows[i]->layer() && | 109 if (windows[i] && windows[i]->IsVisible() && windows[i]->layer() && |
| 110 (!windows[i]->transparent() || | 110 (!windows[i]->transparent() || |
| 111 windows[i]->layer()->GetTargetOpacity() == 1.0)) { | 111 windows[i]->layer()->GetTargetOpacity() == 1.0)) { |
| 112 // When any window is maximized we cannot find any free space. | 112 // When any window is maximized we cannot find any free space. |
| 113 if (ash::wm::IsWindowMaximized(windows[i]) || | 113 if (ash::wm::IsWindowMaximized(windows[i]) || |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 // If the alignment was pushing the window out of the screen, we ignore the | 178 // If the alignment was pushing the window out of the screen, we ignore the |
| 179 // alignment for that call. | 179 // alignment for that call. |
| 180 if (abs(pos.right() - work_area.right()) < grid) | 180 if (abs(pos.right() - work_area.right()) < grid) |
| 181 x = work_area.right() - w; | 181 x = work_area.right() - w; |
| 182 if (abs(pos.bottom() - work_area.bottom()) < grid) | 182 if (abs(pos.bottom() - work_area.bottom()) < grid) |
| 183 y = work_area.bottom() - h; | 183 y = work_area.bottom() - h; |
| 184 return gfx::Rect(x, y, w, h); | 184 return gfx::Rect(x, y, w, h); |
| 185 } | 185 } |
| 186 | 186 |
| 187 } // namespace ash | 187 } // namespace ash |
| OLD | NEW |