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

Side by Side Diff: ash/wm/window_util.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, 2 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
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/window_util.h" 5 #include "ash/wm/window_util.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/wm/activation_controller.h" 10 #include "ash/wm/activation_controller.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 void ToggleMaximizedWindow(aura::Window* window) { 103 void ToggleMaximizedWindow(aura::Window* window) {
104 if (ash::wm::IsWindowMaximized(window)) 104 if (ash::wm::IsWindowMaximized(window))
105 ash::wm::RestoreWindow(window); 105 ash::wm::RestoreWindow(window);
106 else if (ash::wm::CanMaximizeWindow(window)) 106 else if (ash::wm::CanMaximizeWindow(window))
107 ash::wm::MaximizeWindow(window); 107 ash::wm::MaximizeWindow(window);
108 } 108 }
109 109
110 void CenterWindow(aura::Window* window) { 110 void CenterWindow(aura::Window* window) {
111 const gfx::Display display = 111 const gfx::Display display =
112 Shell::GetScreen()->GetDisplayNearestWindow(window); 112 Shell::GetScreen()->GetDisplayNearestWindow(window);
113 gfx::Rect center = display.work_area().Center(window->bounds().size()); 113 gfx::Rect center = display.work_area();
114 center.ClampToCenteredSize(window->bounds().size());
114 window->SetBounds(center); 115 window->SetBounds(center);
115 } 116 }
116 117
117 ui::Layer* RecreateWindowLayers(aura::Window* window, bool set_bounds) { 118 ui::Layer* RecreateWindowLayers(aura::Window* window, bool set_bounds) {
118 const gfx::Rect bounds = window->bounds(); 119 const gfx::Rect bounds = window->bounds();
119 ui::Layer* old_layer = window->RecreateLayer(); 120 ui::Layer* old_layer = window->RecreateLayer();
120 DCHECK(old_layer); 121 DCHECK(old_layer);
121 for (aura::Window::Windows::const_iterator it = window->children().begin(); 122 for (aura::Window::Windows::const_iterator it = window->children().begin();
122 it != window->children().end(); 123 it != window->children().end();
123 ++it) { 124 ++it) {
(...skipping 11 matching lines...) Expand all
135 it != children.end(); 136 it != children.end();
136 ++it) { 137 ++it) {
137 ui::Layer* child = *it; 138 ui::Layer* child = *it;
138 DeepDeleteLayers(child); 139 DeepDeleteLayers(child);
139 } 140 }
140 delete layer; 141 delete layer;
141 } 142 }
142 143
143 } // namespace wm 144 } // namespace wm
144 } // namespace ash 145 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/system_modal_container_layout_manager.cc ('k') | ash/wm/workspace/workspace_layout_manager2.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698