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

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

Issue 10540123: Rename gfx::Screen::GetMonitorXXXX to gfx::Screen::GetDisplayXXX. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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 | Annotate | Revision Log
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 9
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 phantom_window_controller_->IsShowing()) { 203 phantom_window_controller_->IsShowing()) {
204 return phantom_window_controller_->bounds(); 204 return phantom_window_controller_->bounds();
205 } 205 }
206 return AdjustBoundsToGrid(bounds, grid_size); 206 return AdjustBoundsToGrid(bounds, grid_size);
207 } 207 }
208 208
209 void WorkspaceWindowResizer::LayoutAttachedWindows( 209 void WorkspaceWindowResizer::LayoutAttachedWindows(
210 const gfx::Rect& bounds, 210 const gfx::Rect& bounds,
211 int grid_size) { 211 int grid_size) {
212 gfx::Rect work_area( 212 gfx::Rect work_area(
213 gfx::Screen::GetMonitorNearestWindow(window()).work_area()); 213 gfx::Screen::GetDisplayNearestWindow(window()).work_area());
214 std::vector<int> sizes; 214 std::vector<int> sizes;
215 CalculateAttachedSizes( 215 CalculateAttachedSizes(
216 PrimaryAxisSize(details_.initial_bounds.size()), 216 PrimaryAxisSize(details_.initial_bounds.size()),
217 PrimaryAxisSize(bounds.size()), 217 PrimaryAxisSize(bounds.size()),
218 PrimaryAxisCoordinate(bounds.right(), bounds.bottom()), 218 PrimaryAxisCoordinate(bounds.right(), bounds.bottom()),
219 PrimaryAxisCoordinate(work_area.right(), work_area.bottom()), 219 PrimaryAxisCoordinate(work_area.right(), work_area.bottom()),
220 grid_size, 220 grid_size,
221 &sizes); 221 &sizes);
222 DCHECK_EQ(attached_windows_.size(), sizes.size()); 222 DCHECK_EQ(attached_windows_.size(), sizes.size());
223 int last = PrimaryAxisCoordinate(bounds.right(), bounds.bottom()); 223 int last = PrimaryAxisCoordinate(bounds.right(), bounds.bottom());
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 current += size; 273 current += size;
274 sizes->push_back(size); 274 sizes->push_back(size);
275 } 275 }
276 } 276 }
277 } 277 }
278 278
279 void WorkspaceWindowResizer::AdjustBoundsForMainWindow( 279 void WorkspaceWindowResizer::AdjustBoundsForMainWindow(
280 gfx::Rect* bounds, int grid_size) const { 280 gfx::Rect* bounds, int grid_size) const {
281 // Always keep kMinOnscreenHeight on the bottom. 281 // Always keep kMinOnscreenHeight on the bottom.
282 gfx::Rect work_area( 282 gfx::Rect work_area(
283 gfx::Screen::GetMonitorNearestWindow(window()).work_area()); 283 gfx::Screen::GetDisplayNearestWindow(window()).work_area());
284 int max_y = AlignToGridRoundUp(work_area.bottom() - kMinOnscreenHeight, 284 int max_y = AlignToGridRoundUp(work_area.bottom() - kMinOnscreenHeight,
285 grid_size); 285 grid_size);
286 if (bounds->y() > max_y) 286 if (bounds->y() > max_y)
287 bounds->set_y(max_y); 287 bounds->set_y(max_y);
288 288
289 // Don't allow dragging above the top of the monitor. 289 // Don't allow dragging above the top of the monitor.
290 if (bounds->y() <= work_area.y()) 290 if (bounds->y() <= work_area.y())
291 bounds->set_y(work_area.y()); 291 bounds->set_y(work_area.y());
292 292
293 if (grid_size >= 0 && details_.window_component == HTCAPTION) 293 if (grid_size >= 0 && details_.window_component == HTCAPTION)
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 bounds->height() < (bottom_edge - top_edge)) { 327 bounds->height() < (bottom_edge - top_edge)) {
328 // Only snap to the bottom if the window is smaller than the work area. 328 // Only snap to the bottom if the window is smaller than the work area.
329 // Doing otherwise can lead to window snapping in weird ways as it bounces 329 // Doing otherwise can lead to window snapping in weird ways as it bounces
330 // between snapping to top then bottom. 330 // between snapping to top then bottom.
331 bounds->set_y(bottom_edge - bounds->height()); 331 bounds->set_y(bottom_edge - bounds->height());
332 } 332 }
333 } 333 }
334 334
335 bool WorkspaceWindowResizer::TouchesBottomOfScreen() const { 335 bool WorkspaceWindowResizer::TouchesBottomOfScreen() const {
336 gfx::Rect work_area( 336 gfx::Rect work_area(
337 gfx::Screen::GetMonitorNearestWindow(details_.window).work_area()); 337 gfx::Screen::GetDisplayNearestWindow(details_.window).work_area());
338 return (attached_windows_.empty() && 338 return (attached_windows_.empty() &&
339 details_.window->bounds().bottom() == work_area.bottom()) || 339 details_.window->bounds().bottom() == work_area.bottom()) ||
340 (!attached_windows_.empty() && 340 (!attached_windows_.empty() &&
341 attached_windows_.back()->bounds().bottom() == work_area.bottom()); 341 attached_windows_.back()->bounds().bottom() == work_area.bottom());
342 } 342 }
343 343
344 int WorkspaceWindowResizer::PrimaryAxisSize(const gfx::Size& size) const { 344 int WorkspaceWindowResizer::PrimaryAxisSize(const gfx::Size& size) const {
345 return PrimaryAxisCoordinate(size.width(), size.height()); 345 return PrimaryAxisCoordinate(size.width(), size.height());
346 } 346 }
347 347
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 if (i != map.rend()) 415 if (i != map.rend())
416 parent->StackChildBelow(i->second, window); 416 parent->StackChildBelow(i->second, window);
417 } 417 }
418 } 418 }
419 419
420 WorkspaceWindowResizer::SnapType WorkspaceWindowResizer::GetSnapType( 420 WorkspaceWindowResizer::SnapType WorkspaceWindowResizer::GetSnapType(
421 const gfx::Point& location) const { 421 const gfx::Point& location) const {
422 // TODO: this likely only wants total monitor area, not the area of a single 422 // TODO: this likely only wants total monitor area, not the area of a single
423 // monitor. 423 // monitor.
424 gfx::Rect area( 424 gfx::Rect area(
425 gfx::Screen::GetMonitorNearestWindow(details_.window).bounds()); 425 gfx::Screen::GetDisplayNearestWindow(details_.window).bounds());
426 if (location.x() <= area.x()) 426 if (location.x() <= area.x())
427 return SNAP_LEFT_EDGE; 427 return SNAP_LEFT_EDGE;
428 if (location.x() >= area.right() - 1) 428 if (location.x() >= area.right() - 1)
429 return SNAP_RIGHT_EDGE; 429 return SNAP_RIGHT_EDGE;
430 return SNAP_NONE; 430 return SNAP_NONE;
431 } 431 }
432 432
433 } // namespace internal 433 } // namespace internal
434 } // namespace ash 434 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/workspace/workspace_manager_unittest.cc ('k') | chrome/browser/chromeos/input_method/candidate_window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698