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

Side by Side Diff: ash/common/wm/window_positioner.cc

Issue 2115663002: Folds methods in WmShellCommon to WmShell (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 4 years, 5 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/common/wm/overview/window_selector_controller.cc ('k') | ash/common/wm_shell.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 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/common/wm/window_positioner.h" 5 #include "ash/common/wm/window_positioner.h"
6 6
7 #include "ash/common/wm/mru_window_tracker.h" 7 #include "ash/common/wm/mru_window_tracker.h"
8 #include "ash/common/wm/window_positioning_utils.h" 8 #include "ash/common/wm/window_positioning_utils.h"
9 #include "ash/common/wm/window_state.h" 9 #include "ash/common/wm/window_state.h"
10 #include "ash/common/wm/wm_screen_util.h" 10 #include "ash/common/wm/wm_screen_util.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 bool* single_window) { 156 bool* single_window) {
157 if (single_window) 157 if (single_window)
158 *single_window = true; 158 *single_window = true;
159 // Get the active window. 159 // Get the active window.
160 WmWindow* active = root_window->GetShell()->GetActiveWindow(); 160 WmWindow* active = root_window->GetShell()->GetActiveWindow();
161 if (active && active->GetRootWindow() != root_window) 161 if (active && active->GetRootWindow() != root_window)
162 active = NULL; 162 active = NULL;
163 163
164 // Get a list of all windows. 164 // Get a list of all windows.
165 const std::vector<WmWindow*> windows = root_window->GetShell() 165 const std::vector<WmWindow*> windows = root_window->GetShell()
166 ->GetMruWindowTracker() 166 ->mru_window_tracker()
167 ->BuildWindowListIgnoreModal(); 167 ->BuildWindowListIgnoreModal();
168 168
169 if (windows.empty()) 169 if (windows.empty())
170 return nullptr; 170 return nullptr;
171 171
172 int index = 0; 172 int index = 0;
173 // Find the index of the current active window. 173 // Find the index of the current active window.
174 if (active) 174 if (active)
175 index = std::find(windows.begin(), windows.end(), active) - windows.begin(); 175 index = std::find(windows.begin(), windows.end(), active) - windows.begin();
176 176
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 last_popup_position_x_ += pop_position_offset_increment_x; 471 last_popup_position_x_ += pop_position_offset_increment_x;
472 last_popup_position_y_ += pop_position_offset_increment_y; 472 last_popup_position_y_ += pop_position_offset_increment_y;
473 } 473 }
474 return gfx::Rect(x + work_area.x(), y + work_area.y(), w, h); 474 return gfx::Rect(x + work_area.x(), y + work_area.y(), w, h);
475 } 475 }
476 476
477 gfx::Rect WindowPositioner::SmartPopupPosition(const gfx::Rect& old_pos, 477 gfx::Rect WindowPositioner::SmartPopupPosition(const gfx::Rect& old_pos,
478 const gfx::Rect& work_area, 478 const gfx::Rect& work_area,
479 int grid) { 479 int grid) {
480 const std::vector<WmWindow*> windows = 480 const std::vector<WmWindow*> windows =
481 shell_->GetMruWindowTracker()->BuildWindowListIgnoreModal(); 481 shell_->mru_window_tracker()->BuildWindowListIgnoreModal();
482 482
483 std::vector<const gfx::Rect*> regions; 483 std::vector<const gfx::Rect*> regions;
484 // Process the window list and check if we can bail immediately. 484 // Process the window list and check if we can bail immediately.
485 for (size_t i = 0; i < windows.size(); i++) { 485 for (size_t i = 0; i < windows.size(); i++) {
486 // We only include opaque and visible windows. 486 // We only include opaque and visible windows.
487 if (windows[i] && windows[i]->IsVisible() && windows[i]->GetLayer() && 487 if (windows[i] && windows[i]->IsVisible() && windows[i]->GetLayer() &&
488 (windows[i]->GetLayer()->fills_bounds_opaquely() || 488 (windows[i]->GetLayer()->fills_bounds_opaquely() ||
489 windows[i]->GetLayer()->GetTargetOpacity() == 1.0)) { 489 windows[i]->GetLayer()->GetTargetOpacity() == 1.0)) {
490 wm::WindowState* window_state = windows[i]->GetWindowState(); 490 wm::WindowState* window_state = windows[i]->GetWindowState();
491 // When any window is maximized we cannot find any free space. 491 // When any window is maximized we cannot find any free space.
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 // If the alignment was pushing the window out of the screen, we ignore the 555 // If the alignment was pushing the window out of the screen, we ignore the
556 // alignment for that call. 556 // alignment for that call.
557 if (abs(pos.right() - work_area.right()) < grid) 557 if (abs(pos.right() - work_area.right()) < grid)
558 x = work_area.right() - w; 558 x = work_area.right() - w;
559 if (abs(pos.bottom() - work_area.bottom()) < grid) 559 if (abs(pos.bottom() - work_area.bottom()) < grid)
560 y = work_area.bottom() - h; 560 y = work_area.bottom() - h;
561 return gfx::Rect(x, y, w, h); 561 return gfx::Rect(x, y, w, h);
562 } 562 }
563 563
564 } // namespace ash 564 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/wm/overview/window_selector_controller.cc ('k') | ash/common/wm_shell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698