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

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

Issue 11110004: Make gfx::Rect class operations consistently mutate the class they are called on. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: cc/ fixes Created 8 years, 1 month 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/window_util.cc ('k') | ash/wm/workspace/workspace_window_resizer.cc » ('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_layout_manager2.h" 5 #include "ash/wm/workspace/workspace_layout_manager2.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/screen_ash.h" 8 #include "ash/screen_ash.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/wm/always_on_top_controller.h" 10 #include "ash/wm/always_on_top_controller.h"
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 } 282 }
283 283
284 void WorkspaceLayoutManager2::AdjustWindowSizeForScreenChange( 284 void WorkspaceLayoutManager2::AdjustWindowSizeForScreenChange(
285 Window* window, 285 Window* window,
286 AdjustWindowReason reason) { 286 AdjustWindowReason reason) {
287 if (GetTrackedByWorkspace(window) && 287 if (GetTrackedByWorkspace(window) &&
288 !SetMaximizedOrFullscreenBounds(window)) { 288 !SetMaximizedOrFullscreenBounds(window)) {
289 if (reason == ADJUST_WINDOW_SCREEN_SIZE_CHANGED) { 289 if (reason == ADJUST_WINDOW_SCREEN_SIZE_CHANGED) {
290 // The work area may be smaller than the full screen. Put as much of the 290 // The work area may be smaller than the full screen. Put as much of the
291 // window as possible within the display area. 291 // window as possible within the display area.
292 window->SetBounds(window->bounds().AdjustToFit(work_area_)); 292 gfx::Rect bounds = window->bounds();
293 bounds.AdjustToFit(work_area_);
294 window->SetBounds(bounds);
293 } else if (reason == ADJUST_WINDOW_DISPLAY_INSETS_CHANGED) { 295 } else if (reason == ADJUST_WINDOW_DISPLAY_INSETS_CHANGED) {
294 // If the window is completely outside the display work area, then move it 296 // If the window is completely outside the display work area, then move it
295 // enough to be visible again. 297 // enough to be visible again.
296 gfx::Rect bounds = window->bounds(); 298 gfx::Rect bounds = window->bounds();
297 if (!work_area_.Intersects(bounds)) { 299 if (!work_area_.Intersects(bounds)) {
298 int y_offset = 0; 300 int y_offset = 0;
299 if (work_area_.bottom() < bounds.y()) { 301 if (work_area_.bottom() < bounds.y()) {
300 y_offset = work_area_.bottom() - bounds.y() - kMinimumOnScreenArea; 302 y_offset = work_area_.bottom() - bounds.y() - kMinimumOnScreenArea;
301 } else if (bounds.bottom() < work_area_.y()) { 303 } else if (bounds.bottom() < work_area_.y()) {
302 y_offset = work_area_.y() - bounds.bottom() + kMinimumOnScreenArea; 304 y_offset = work_area_.y() - bounds.bottom() + kMinimumOnScreenArea;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 } 371 }
370 return false; 372 return false;
371 } 373 }
372 374
373 WorkspaceManager2* WorkspaceLayoutManager2::workspace_manager() { 375 WorkspaceManager2* WorkspaceLayoutManager2::workspace_manager() {
374 return workspace_->workspace_manager(); 376 return workspace_->workspace_manager();
375 } 377 }
376 378
377 } // namespace internal 379 } // namespace internal
378 } // namespace ash 380 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/window_util.cc ('k') | ash/wm/workspace/workspace_window_resizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698