OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/window_positioner.h" | 5 #include "ash/wm/window_positioner.h" |
6 | 6 |
7 #include "ash/screen_util.h" | 7 #include "ash/screen_util.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
10 #include "ash/wm/mru_window_tracker.h" | 10 #include "ash/wm/mru_window_tracker.h" |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
185 bool *single_window) { | 185 bool *single_window) { |
186 if (single_window) | 186 if (single_window) |
187 *single_window = true; | 187 *single_window = true; |
188 // Get the active window. | 188 // Get the active window. |
189 aura::Window* active = ash::wm::GetActiveWindow(); | 189 aura::Window* active = ash::wm::GetActiveWindow(); |
190 if (active && active->GetRootWindow() != root_window) | 190 if (active && active->GetRootWindow() != root_window) |
191 active = NULL; | 191 active = NULL; |
192 | 192 |
193 // Get a list of all windows. | 193 // Get a list of all windows. |
194 const std::vector<aura::Window*> windows = | 194 const std::vector<aura::Window*> windows = |
195 ash::MruWindowTracker::BuildWindowList(false); | 195 ash::MruWindowTracker::BuildWindowList(); |
196 | 196 |
197 if (windows.empty()) | 197 if (windows.empty()) |
198 return NULL; | 198 return NULL; |
199 | 199 |
200 aura::Window::Windows::const_iterator iter = windows.begin(); | 200 aura::Window::Windows::const_iterator iter = windows.begin(); |
201 // Find the index of the current active window. | 201 // Find the index of the current active window. |
202 if (active) | 202 if (active) |
203 iter = std::find(windows.begin(), windows.end(), active); | 203 iter = std::find(windows.begin(), windows.end(), active); |
204 | 204 |
205 int index = (iter == windows.end()) ? 0 : (iter - windows.begin()); | 205 int index = (iter == windows.end()) ? 0 : (iter - windows.begin()); |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
496 last_popup_position_x_ += pop_position_offset_increment_x; | 496 last_popup_position_x_ += pop_position_offset_increment_x; |
497 last_popup_position_y_ += pop_position_offset_increment_y; | 497 last_popup_position_y_ += pop_position_offset_increment_y; |
498 } | 498 } |
499 return gfx::Rect(x + work_area.x(), y + work_area.y(), w, h); | 499 return gfx::Rect(x + work_area.x(), y + work_area.y(), w, h); |
500 } | 500 } |
501 | 501 |
502 gfx::Rect WindowPositioner::SmartPopupPosition( | 502 gfx::Rect WindowPositioner::SmartPopupPosition( |
503 const gfx::Rect& old_pos, | 503 const gfx::Rect& old_pos, |
504 const gfx::Rect& work_area, | 504 const gfx::Rect& work_area, |
505 int grid) { | 505 int grid) { |
506 const std::vector<aura::Window*> windows = | 506 const std::vector<aura::Window*> windows = |
oshima
2014/12/06 00:26:03
does this fit single line?
afakhry
2014/12/06 00:30:40
It doesn't ... the semicolon will exceed the bound
| |
507 MruWindowTracker::BuildWindowList(false); | 507 MruWindowTracker::BuildWindowList(); |
508 | 508 |
509 std::vector<const gfx::Rect*> regions; | 509 std::vector<const gfx::Rect*> regions; |
510 // Process the window list and check if we can bail immediately. | 510 // Process the window list and check if we can bail immediately. |
511 for (size_t i = 0; i < windows.size(); i++) { | 511 for (size_t i = 0; i < windows.size(); i++) { |
512 // We only include opaque and visible windows. | 512 // We only include opaque and visible windows. |
513 if (windows[i] && windows[i]->IsVisible() && windows[i]->layer() && | 513 if (windows[i] && windows[i]->IsVisible() && windows[i]->layer() && |
514 (!windows[i]->transparent() || | 514 (!windows[i]->transparent() || |
515 windows[i]->layer()->GetTargetOpacity() == 1.0)) { | 515 windows[i]->layer()->GetTargetOpacity() == 1.0)) { |
516 wm::WindowState* window_state = wm::GetWindowState(windows[i]); | 516 wm::WindowState* window_state = wm::GetWindowState(windows[i]); |
517 // When any window is maximized we cannot find any free space. | 517 // When any window is maximized we cannot find any free space. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
582 // If the alignment was pushing the window out of the screen, we ignore the | 582 // If the alignment was pushing the window out of the screen, we ignore the |
583 // alignment for that call. | 583 // alignment for that call. |
584 if (abs(pos.right() - work_area.right()) < grid) | 584 if (abs(pos.right() - work_area.right()) < grid) |
585 x = work_area.right() - w; | 585 x = work_area.right() - w; |
586 if (abs(pos.bottom() - work_area.bottom()) < grid) | 586 if (abs(pos.bottom() - work_area.bottom()) < grid) |
587 y = work_area.bottom() - h; | 587 y = work_area.bottom() - h; |
588 return gfx::Rect(x, y, w, h); | 588 return gfx::Rect(x, y, w, h); |
589 } | 589 } |
590 | 590 |
591 } // namespace ash | 591 } // namespace ash |
OLD | NEW |