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

Side by Side Diff: ash/wm/window_resizer.cc

Issue 138003007: [Cleanup] Screen cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: make sure screen_for_shutdown is reset everytime Created 6 years, 11 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
« no previous file with comments | « ash/wm/window_positioner.cc ('k') | ash/wm/window_state.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/window_resizer.h" 5 #include "ash/wm/window_resizer.h"
6 6
7 #include "ash/screen_ash.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/coordinate_conversion.h" 10 #include "ash/wm/coordinate_conversion.h"
11 #include "ash/wm/dock/docked_window_layout_manager.h" 11 #include "ash/wm/dock/docked_window_layout_manager.h"
12 #include "ash/wm/window_state.h" 12 #include "ash/wm/window_state.h"
13 #include "ash/wm/window_util.h" 13 #include "ash/wm/window_util.h"
14 #include "ui/aura/client/aura_constants.h" 14 #include "ui/aura/client/aura_constants.h"
15 #include "ui/aura/root_window.h" 15 #include "ui/aura/root_window.h"
16 #include "ui/aura/window.h" 16 #include "ui/aura/window.h"
17 #include "ui/aura/window_delegate.h" 17 #include "ui/aura/window_delegate.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 gfx::Rect work_area = 142 gfx::Rect work_area =
143 Shell::GetScreen()->GetDisplayNearestWindow(GetTarget()).work_area(); 143 Shell::GetScreen()->GetDisplayNearestWindow(GetTarget()).work_area();
144 aura::Window* dock_container = Shell::GetContainer( 144 aura::Window* dock_container = Shell::GetContainer(
145 GetTarget()->GetRootWindow(), 145 GetTarget()->GetRootWindow(),
146 internal::kShellWindowId_DockedContainer); 146 internal::kShellWindowId_DockedContainer);
147 internal::DockedWindowLayoutManager* dock_layout = 147 internal::DockedWindowLayoutManager* dock_layout =
148 static_cast<internal::DockedWindowLayoutManager*>( 148 static_cast<internal::DockedWindowLayoutManager*>(
149 dock_container->layout_manager()); 149 dock_container->layout_manager());
150 150
151 work_area.Union(dock_layout->docked_bounds()); 151 work_area.Union(dock_layout->docked_bounds());
152 work_area = ScreenAsh::ConvertRectFromScreen(GetTarget()->parent(), 152 work_area = ScreenUtil::ConvertRectFromScreen(GetTarget()->parent(),
153 work_area); 153 work_area);
154 if (details().size_change_direction & kBoundsChangeDirection_Horizontal) { 154 if (details().size_change_direction & kBoundsChangeDirection_Horizontal) {
155 if (IsRightEdge(details().window_component) && 155 if (IsRightEdge(details().window_component) &&
156 new_bounds.right() < work_area.x() + kMinimumOnScreenArea) { 156 new_bounds.right() < work_area.x() + kMinimumOnScreenArea) {
157 int delta = work_area.x() + kMinimumOnScreenArea - new_bounds.right(); 157 int delta = work_area.x() + kMinimumOnScreenArea - new_bounds.right();
158 new_bounds.set_width(new_bounds.width() + delta); 158 new_bounds.set_width(new_bounds.width() + delta);
159 } else if (new_bounds.x() > work_area.right() - kMinimumOnScreenArea) { 159 } else if (new_bounds.x() > work_area.right() - kMinimumOnScreenArea) {
160 int width = new_bounds.right() - work_area.right() + 160 int width = new_bounds.right() - work_area.right() +
161 kMinimumOnScreenArea; 161 kMinimumOnScreenArea;
162 new_bounds.set_x(work_area.right() - kMinimumOnScreenArea); 162 new_bounds.set_x(work_area.right() - kMinimumOnScreenArea);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 wm::GetRootWindowMatching(near_passed_location), 215 wm::GetRootWindowMatching(near_passed_location),
216 internal::kShellWindowId_DockedContainer); 216 internal::kShellWindowId_DockedContainer);
217 internal::DockedWindowLayoutManager* dock_layout = 217 internal::DockedWindowLayoutManager* dock_layout =
218 static_cast<internal::DockedWindowLayoutManager*>( 218 static_cast<internal::DockedWindowLayoutManager*>(
219 dock_container->layout_manager()); 219 dock_container->layout_manager());
220 220
221 gfx::Rect screen_work_area = display.work_area(); 221 gfx::Rect screen_work_area = display.work_area();
222 screen_work_area.Union(dock_layout->docked_bounds()); 222 screen_work_area.Union(dock_layout->docked_bounds());
223 screen_work_area.Inset(kMinimumOnScreenArea, 0); 223 screen_work_area.Inset(kMinimumOnScreenArea, 0);
224 gfx::Rect new_bounds_in_screen = 224 gfx::Rect new_bounds_in_screen =
225 ScreenAsh::ConvertRectToScreen(parent, new_bounds); 225 ScreenUtil::ConvertRectToScreen(parent, new_bounds);
226 if (!screen_work_area.Intersects(new_bounds_in_screen)) { 226 if (!screen_work_area.Intersects(new_bounds_in_screen)) {
227 // Make sure that the x origin does not leave the current display. 227 // Make sure that the x origin does not leave the current display.
228 new_bounds_in_screen.set_x( 228 new_bounds_in_screen.set_x(
229 std::max(screen_work_area.x() - new_bounds.width(), 229 std::max(screen_work_area.x() - new_bounds.width(),
230 std::min(screen_work_area.right(), 230 std::min(screen_work_area.right(),
231 new_bounds_in_screen.x()))); 231 new_bounds_in_screen.x())));
232 new_bounds = 232 new_bounds =
233 ScreenAsh::ConvertRectFromScreen(parent, new_bounds_in_screen); 233 ScreenUtil::ConvertRectFromScreen(parent, new_bounds_in_screen);
234 } 234 }
235 } 235 }
236 236
237 return new_bounds; 237 return new_bounds;
238 } 238 }
239 239
240 // static 240 // static
241 bool WindowResizer::IsBottomEdge(int window_component) { 241 bool WindowResizer::IsBottomEdge(int window_component) {
242 return window_component == HTBOTTOMLEFT || 242 return window_component == HTBOTTOMLEFT ||
243 window_component == HTBOTTOM || 243 window_component == HTBOTTOM ||
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 if (height > max_height) { 349 if (height > max_height) {
350 height = max_height; 350 height = max_height;
351 *delta_y = -y_multiplier * (details().initial_bounds_in_parent.height() - 351 *delta_y = -y_multiplier * (details().initial_bounds_in_parent.height() -
352 max_height); 352 max_height);
353 } 353 }
354 } 354 }
355 return height; 355 return height;
356 } 356 }
357 357
358 } // namespace ash 358 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/window_positioner.cc ('k') | ash/wm/window_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698