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

Side by Side Diff: ash/wm/drag_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/dock/docked_window_resizer_unittest.cc ('k') | ash/wm/gestures/system_pinch_handler.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/drag_window_resizer.h" 5 #include "ash/wm/drag_window_resizer.h"
6 6
7 #include "ash/display/mouse_cursor_event_filter.h" 7 #include "ash/display/mouse_cursor_event_filter.h"
8 #include "ash/root_window_controller.h" 8 #include "ash/root_window_controller.h"
9 #include "ash/screen_ash.h" 9 #include "ash/screen_util.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
11 #include "ash/system/tray/system_tray.h" 11 #include "ash/system/tray/system_tray.h"
12 #include "ash/system/user/tray_user.h" 12 #include "ash/system/user/tray_user.h"
13 #include "ash/wm/coordinate_conversion.h" 13 #include "ash/wm/coordinate_conversion.h"
14 #include "ash/wm/drag_window_controller.h" 14 #include "ash/wm/drag_window_controller.h"
15 #include "ash/wm/window_state.h" 15 #include "ash/wm/window_state.h"
16 #include "ash/wm/window_util.h" 16 #include "ash/wm/window_util.h"
17 #include "base/memory/weak_ptr.h" 17 #include "base/memory/weak_ptr.h"
18 #include "ui/aura/client/aura_constants.h" 18 #include "ui/aura/client/aura_constants.h"
19 #include "ui/aura/env.h" 19 #include "ui/aura/env.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 gfx::Rect bounds = GetTarget()->bounds(); 128 gfx::Rect bounds = GetTarget()->bounds();
129 if (bounds.width() > size.width()) { 129 if (bounds.width() > size.width()) {
130 int diff = bounds.width() - size.width(); 130 int diff = bounds.width() - size.width();
131 bounds.set_x(bounds.x() + diff / 2); 131 bounds.set_x(bounds.x() + diff / 2);
132 bounds.set_width(size.width()); 132 bounds.set_width(size.width());
133 } 133 }
134 if (bounds.height() > size.height()) 134 if (bounds.height() > size.height())
135 bounds.set_height(size.height()); 135 bounds.set_height(size.height());
136 136
137 gfx::Rect dst_bounds = 137 gfx::Rect dst_bounds =
138 ScreenAsh::ConvertRectToScreen(GetTarget()->parent(), bounds); 138 ScreenUtil::ConvertRectToScreen(GetTarget()->parent(), bounds);
139 139
140 // Adjust the position so that the cursor is on the window. 140 // Adjust the position so that the cursor is on the window.
141 if (!dst_bounds.Contains(last_mouse_location_in_screen)) { 141 if (!dst_bounds.Contains(last_mouse_location_in_screen)) {
142 if (last_mouse_location_in_screen.x() < dst_bounds.x()) 142 if (last_mouse_location_in_screen.x() < dst_bounds.x())
143 dst_bounds.set_x(last_mouse_location_in_screen.x()); 143 dst_bounds.set_x(last_mouse_location_in_screen.x());
144 else if (last_mouse_location_in_screen.x() > dst_bounds.right()) 144 else if (last_mouse_location_in_screen.x() > dst_bounds.right())
145 dst_bounds.set_x( 145 dst_bounds.set_x(
146 last_mouse_location_in_screen.x() - dst_bounds.width()); 146 last_mouse_location_in_screen.x() - dst_bounds.width());
147 } 147 }
148 ash::wm::AdjustBoundsToEnsureMinimumWindowVisibility( 148 ash::wm::AdjustBoundsToEnsureMinimumWindowVisibility(
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 void DragWindowResizer::UpdateDragWindow(const gfx::Rect& bounds, 182 void DragWindowResizer::UpdateDragWindow(const gfx::Rect& bounds,
183 bool in_original_root) { 183 bool in_original_root) {
184 if (details().window_component != HTCAPTION || !ShouldAllowMouseWarp()) 184 if (details().window_component != HTCAPTION || !ShouldAllowMouseWarp())
185 return; 185 return;
186 186
187 // It's available. Show a phantom window on the display if needed. 187 // It's available. Show a phantom window on the display if needed.
188 aura::Window* another_root = 188 aura::Window* another_root =
189 GetAnotherRootWindow(GetTarget()->GetRootWindow()); 189 GetAnotherRootWindow(GetTarget()->GetRootWindow());
190 const gfx::Rect root_bounds_in_screen(another_root->GetBoundsInScreen()); 190 const gfx::Rect root_bounds_in_screen(another_root->GetBoundsInScreen());
191 const gfx::Rect bounds_in_screen = 191 const gfx::Rect bounds_in_screen =
192 ScreenAsh::ConvertRectToScreen(GetTarget()->parent(), bounds); 192 ScreenUtil::ConvertRectToScreen(GetTarget()->parent(), bounds);
193 gfx::Rect bounds_in_another_root = 193 gfx::Rect bounds_in_another_root =
194 gfx::IntersectRects(root_bounds_in_screen, bounds_in_screen); 194 gfx::IntersectRects(root_bounds_in_screen, bounds_in_screen);
195 const float fraction_in_another_window = 195 const float fraction_in_another_window =
196 (bounds_in_another_root.width() * bounds_in_another_root.height()) / 196 (bounds_in_another_root.width() * bounds_in_another_root.height()) /
197 static_cast<float>(bounds.width() * bounds.height()); 197 static_cast<float>(bounds.width() * bounds.height());
198 198
199 if (fraction_in_another_window > 0) { 199 if (fraction_in_another_window > 0) {
200 if (!drag_window_controller_) { 200 if (!drag_window_controller_) {
201 drag_window_controller_.reset( 201 drag_window_controller_.reset(
202 new DragWindowController(GetTarget())); 202 new DragWindowController(GetTarget()));
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 if (!tray_user->TransferWindowToUser(GetTarget())) { 278 if (!tray_user->TransferWindowToUser(GetTarget())) {
279 GetTarget()->layer()->SetOpacity(old_opacity); 279 GetTarget()->layer()->SetOpacity(old_opacity);
280 return false; 280 return false;
281 } 281 }
282 RevertDrag(); 282 RevertDrag();
283 return true; 283 return true;
284 } 284 }
285 285
286 } // namespace internal 286 } // namespace internal
287 } // namespace ash 287 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/dock/docked_window_resizer_unittest.cc ('k') | ash/wm/gestures/system_pinch_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698