OLD | NEW |
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 WorkspaceWindowResizer::~WorkspaceWindowResizer() { | 46 WorkspaceWindowResizer::~WorkspaceWindowResizer() { |
47 if (root_filter_) | 47 if (root_filter_) |
48 root_filter_->UnlockCursor(); | 48 root_filter_->UnlockCursor(); |
49 } | 49 } |
50 | 50 |
51 // static | 51 // static |
52 WorkspaceWindowResizer* WorkspaceWindowResizer::Create( | 52 WorkspaceWindowResizer* WorkspaceWindowResizer::Create( |
53 aura::Window* window, | 53 aura::Window* window, |
54 const gfx::Point& location, | 54 const gfx::Point& location, |
55 int window_component, | 55 int window_component, |
56 int grid_size, | |
57 const std::vector<aura::Window*>& attached_windows) { | 56 const std::vector<aura::Window*>& attached_windows) { |
58 Details details(window, location, window_component, grid_size); | 57 Details details(window, location, window_component); |
59 return details.is_resizable ? | 58 return details.is_resizable ? |
60 new WorkspaceWindowResizer(details, attached_windows) : NULL; | 59 new WorkspaceWindowResizer(details, attached_windows) : NULL; |
61 } | 60 } |
62 | 61 |
63 void WorkspaceWindowResizer::Drag(const gfx::Point& location) { | 62 void WorkspaceWindowResizer::Drag(const gfx::Point& location, int event_flags) { |
64 gfx::Rect bounds = CalculateBoundsForDrag(details_, location); | 63 int grid_size = event_flags & ui::EF_CONTROL_DOWN ? |
| 64 0 : ash::Shell::GetInstance()->GetGridSize(); |
| 65 gfx::Rect bounds = CalculateBoundsForDrag(details_, location, grid_size); |
| 66 |
65 if (wm::IsWindowNormal(details_.window)) | 67 if (wm::IsWindowNormal(details_.window)) |
66 AdjustBoundsForMainWindow(&bounds); | 68 AdjustBoundsForMainWindow(&bounds, grid_size); |
67 if (bounds != details_.window->bounds()) { | 69 if (bounds != details_.window->bounds()) { |
68 if (!did_move_or_resize_) | 70 if (!did_move_or_resize_) |
69 RestackWindows(); | 71 RestackWindows(); |
70 did_move_or_resize_ = true; | 72 did_move_or_resize_ = true; |
71 } | 73 } |
72 UpdatePhantomWindow(location, bounds); | 74 UpdatePhantomWindow(location, bounds, grid_size); |
73 if (!attached_windows_.empty()) | 75 if (!attached_windows_.empty()) |
74 LayoutAttachedWindows(bounds); | 76 LayoutAttachedWindows(bounds, grid_size); |
75 if (bounds != details_.window->bounds()) | 77 if (bounds != details_.window->bounds()) |
76 details_.window->SetBounds(bounds); | 78 details_.window->SetBounds(bounds); |
77 // WARNING: we may have been deleted. | 79 // WARNING: we may have been deleted. |
78 } | 80 } |
79 | 81 |
80 void WorkspaceWindowResizer::CompleteDrag() { | 82 void WorkspaceWindowResizer::CompleteDrag(int event_flags) { |
81 phantom_window_controller_.reset(); | 83 phantom_window_controller_.reset(); |
82 if (!did_move_or_resize_ || details_.window_component != HTCAPTION) | 84 if (!did_move_or_resize_ || details_.window_component != HTCAPTION) |
83 return; | 85 return; |
84 | 86 |
85 if (snap_type_ == SNAP_LEFT_EDGE || snap_type_ == SNAP_RIGHT_EDGE) { | 87 if (snap_type_ == SNAP_LEFT_EDGE || snap_type_ == SNAP_RIGHT_EDGE) { |
86 if (!GetRestoreBounds(details_.window)) | 88 if (!GetRestoreBounds(details_.window)) |
87 SetRestoreBounds(details_.window, details_.initial_bounds); | 89 SetRestoreBounds(details_.window, details_.initial_bounds); |
88 details_.window->SetBounds(snap_sizer_->target_bounds()); | 90 details_.window->SetBounds(snap_sizer_->target_bounds()); |
89 return; | 91 return; |
90 } | 92 } |
91 | 93 |
92 if (details_.grid_size <= 1) | 94 int grid_size = event_flags & ui::EF_CONTROL_DOWN ? |
| 95 0 : ash::Shell::GetInstance()->GetGridSize(); |
| 96 if (grid_size <= 1) |
93 return; | 97 return; |
94 | 98 |
95 gfx::Rect bounds(GetFinalBounds(details_.window->bounds())); | 99 gfx::Rect bounds(GetFinalBounds(details_.window->bounds(), grid_size)); |
96 if (bounds == details_.window->bounds()) | 100 if (bounds == details_.window->bounds()) |
97 return; | 101 return; |
98 | 102 |
99 if (bounds.size() != details_.window->bounds().size()) { | 103 if (bounds.size() != details_.window->bounds().size()) { |
100 // Don't attempt to animate a size change. | 104 // Don't attempt to animate a size change. |
101 details_.window->SetBounds(bounds); | 105 details_.window->SetBounds(bounds); |
102 return; | 106 return; |
103 } | 107 } |
104 | 108 |
105 ui::ScopedLayerAnimationSettings scoped_setter( | 109 ui::ScopedLayerAnimationSettings scoped_setter( |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 160 |
157 // Only support attaching to the right/bottom. | 161 // Only support attaching to the right/bottom. |
158 DCHECK(attached_windows_.empty() || | 162 DCHECK(attached_windows_.empty() || |
159 (details.window_component == HTRIGHT || | 163 (details.window_component == HTRIGHT || |
160 details.window_component == HTBOTTOM)); | 164 details.window_component == HTBOTTOM)); |
161 | 165 |
162 // TODO: figure out how to deal with window going off the edge. | 166 // TODO: figure out how to deal with window going off the edge. |
163 | 167 |
164 // Calculate sizes so that we can maintain the ratios if we need to resize. | 168 // Calculate sizes so that we can maintain the ratios if we need to resize. |
165 int total_available = 0; | 169 int total_available = 0; |
| 170 int grid_size = ash::Shell::GetInstance()->GetGridSize(); |
166 for (size_t i = 0; i < attached_windows_.size(); ++i) { | 171 for (size_t i = 0; i < attached_windows_.size(); ++i) { |
167 gfx::Size min(attached_windows_[i]->delegate()->GetMinimumSize()); | 172 gfx::Size min(attached_windows_[i]->delegate()->GetMinimumSize()); |
168 int initial_size = PrimaryAxisSize(attached_windows_[i]->bounds().size()); | 173 int initial_size = PrimaryAxisSize(attached_windows_[i]->bounds().size()); |
169 initial_size_.push_back(initial_size); | 174 initial_size_.push_back(initial_size); |
170 // If current size is smaller than the min, use the current size as the min. | 175 // If current size is smaller than the min, use the current size as the min. |
171 // This way we don't snap on resize. | 176 // This way we don't snap on resize. |
172 int min_size = std::min(initial_size, | 177 int min_size = std::min(initial_size, |
173 std::max(PrimaryAxisSize(min), kMinOnscreenSize)); | 178 std::max(PrimaryAxisSize(min), kMinOnscreenSize)); |
174 // Make sure the min size falls on the grid. | 179 // Make sure the min size falls on the grid. |
175 if (details_.grid_size > 1 && min_size % details_.grid_size != 0) | 180 if (grid_size > 1 && min_size % grid_size != 0) |
176 min_size = (min_size / details_.grid_size + 1) * details_.grid_size; | 181 min_size = (min_size / grid_size + 1) * grid_size; |
177 min_size_.push_back(min_size); | 182 min_size_.push_back(min_size); |
178 total_min_ += min_size; | 183 total_min_ += min_size; |
179 total_initial_size_ += initial_size; | 184 total_initial_size_ += initial_size; |
180 total_available += std::max(min_size, initial_size) - min_size; | 185 total_available += std::max(min_size, initial_size) - min_size; |
181 } | 186 } |
182 | 187 |
183 for (size_t i = 0; i < attached_windows_.size(); ++i) { | 188 for (size_t i = 0; i < attached_windows_.size(); ++i) { |
184 expand_fraction_.push_back( | 189 expand_fraction_.push_back( |
185 static_cast<float>(initial_size_[i]) / | 190 static_cast<float>(initial_size_[i]) / |
186 static_cast<float>(total_initial_size_)); | 191 static_cast<float>(total_initial_size_)); |
187 if (total_initial_size_ != total_min_) { | 192 if (total_initial_size_ != total_min_) { |
188 compress_fraction_.push_back( | 193 compress_fraction_.push_back( |
189 static_cast<float>(initial_size_[i] - min_size_[i]) / | 194 static_cast<float>(initial_size_[i] - min_size_[i]) / |
190 static_cast<float>(total_available)); | 195 static_cast<float>(total_available)); |
191 } else { | 196 } else { |
192 compress_fraction_.push_back(0.0f); | 197 compress_fraction_.push_back(0.0f); |
193 } | 198 } |
194 } | 199 } |
195 } | 200 } |
196 | 201 |
197 gfx::Rect WorkspaceWindowResizer::GetFinalBounds( | 202 gfx::Rect WorkspaceWindowResizer::GetFinalBounds( |
198 const gfx::Rect& bounds) const { | 203 const gfx::Rect& bounds, |
| 204 int grid_size) const { |
199 if (phantom_window_controller_.get() && | 205 if (phantom_window_controller_.get() && |
200 phantom_window_controller_->IsShowing()) { | 206 phantom_window_controller_->IsShowing()) { |
201 return phantom_window_controller_->bounds(); | 207 return phantom_window_controller_->bounds(); |
202 } | 208 } |
203 return AdjustBoundsToGrid(bounds, details_.grid_size); | 209 return AdjustBoundsToGrid(bounds, grid_size); |
204 } | 210 } |
205 | 211 |
206 void WorkspaceWindowResizer::LayoutAttachedWindows( | 212 void WorkspaceWindowResizer::LayoutAttachedWindows( |
207 const gfx::Rect& bounds) { | 213 const gfx::Rect& bounds, |
| 214 int grid_size) { |
208 gfx::Rect work_area(gfx::Screen::GetMonitorWorkAreaNearestWindow(window())); | 215 gfx::Rect work_area(gfx::Screen::GetMonitorWorkAreaNearestWindow(window())); |
209 std::vector<int> sizes; | 216 std::vector<int> sizes; |
210 CalculateAttachedSizes( | 217 CalculateAttachedSizes( |
211 PrimaryAxisSize(details_.initial_bounds.size()), | 218 PrimaryAxisSize(details_.initial_bounds.size()), |
212 PrimaryAxisSize(bounds.size()), | 219 PrimaryAxisSize(bounds.size()), |
213 PrimaryAxisCoordinate(bounds.right(), bounds.bottom()), | 220 PrimaryAxisCoordinate(bounds.right(), bounds.bottom()), |
214 PrimaryAxisCoordinate(work_area.right(), work_area.bottom()), | 221 PrimaryAxisCoordinate(work_area.right(), work_area.bottom()), |
| 222 grid_size, |
215 &sizes); | 223 &sizes); |
216 DCHECK_EQ(attached_windows_.size(), sizes.size()); | 224 DCHECK_EQ(attached_windows_.size(), sizes.size()); |
217 int last = PrimaryAxisCoordinate(bounds.right(), bounds.bottom()); | 225 int last = PrimaryAxisCoordinate(bounds.right(), bounds.bottom()); |
218 for (size_t i = 0; i < attached_windows_.size(); ++i) { | 226 for (size_t i = 0; i < attached_windows_.size(); ++i) { |
219 gfx::Rect attached_bounds(attached_windows_[i]->bounds()); | 227 gfx::Rect attached_bounds(attached_windows_[i]->bounds()); |
220 if (details_.window_component == HTRIGHT) { | 228 if (details_.window_component == HTRIGHT) { |
221 attached_bounds.set_x(last); | 229 attached_bounds.set_x(last); |
222 attached_bounds.set_width(sizes[i]); | 230 attached_bounds.set_width(sizes[i]); |
223 } else { | 231 } else { |
224 attached_bounds.set_y(last); | 232 attached_bounds.set_y(last); |
225 attached_bounds.set_height(sizes[i]); | 233 attached_bounds.set_height(sizes[i]); |
226 } | 234 } |
227 attached_windows_[i]->SetBounds(attached_bounds); | 235 attached_windows_[i]->SetBounds(attached_bounds); |
228 last += sizes[i]; | 236 last += sizes[i]; |
229 } | 237 } |
230 } | 238 } |
231 | 239 |
232 void WorkspaceWindowResizer::CalculateAttachedSizes( | 240 void WorkspaceWindowResizer::CalculateAttachedSizes( |
233 int initial_size, | 241 int initial_size, |
234 int current_size, | 242 int current_size, |
235 int start, | 243 int start, |
236 int end, | 244 int end, |
| 245 int grid_size, |
237 std::vector<int>* sizes) const { | 246 std::vector<int>* sizes) const { |
238 sizes->clear(); | 247 sizes->clear(); |
239 if (current_size < initial_size) { | 248 if (current_size < initial_size) { |
240 // If the primary window is sized smaller, resize the attached windows. | 249 // If the primary window is sized smaller, resize the attached windows. |
241 int current = start; | 250 int current = start; |
242 int delta = initial_size - current_size; | 251 int delta = initial_size - current_size; |
243 for (size_t i = 0; i < attached_windows_.size(); ++i) { | 252 for (size_t i = 0; i < attached_windows_.size(); ++i) { |
244 int next = AlignToGrid( | 253 int next = AlignToGrid( |
245 current + initial_size_[i] + expand_fraction_[i] * delta, | 254 current + initial_size_[i] + expand_fraction_[i] * delta, |
246 details_.grid_size); | 255 grid_size); |
247 if (i == attached_windows_.size()) | 256 if (i == attached_windows_.size()) |
248 next = end; | 257 next = end; |
249 sizes->push_back(next - current); | 258 sizes->push_back(next - current); |
250 current = next; | 259 current = next; |
251 } | 260 } |
252 } else if (start <= end - total_initial_size_) { | 261 } else if (start <= end - total_initial_size_) { |
253 // All the windows fit at their initial size; tile them horizontally. | 262 // All the windows fit at their initial size; tile them horizontally. |
254 for (size_t i = 0; i < attached_windows_.size(); ++i) | 263 for (size_t i = 0; i < attached_windows_.size(); ++i) |
255 sizes->push_back(initial_size_[i]); | 264 sizes->push_back(initial_size_[i]); |
256 } else { | 265 } else { |
257 DCHECK_NE(total_initial_size_, total_min_); | 266 DCHECK_NE(total_initial_size_, total_min_); |
258 int delta = total_initial_size_ - (end - start); | 267 int delta = total_initial_size_ - (end - start); |
259 int current = start; | 268 int current = start; |
260 for (size_t i = 0; i < attached_windows_.size(); ++i) { | 269 for (size_t i = 0; i < attached_windows_.size(); ++i) { |
261 int size = initial_size_[i] - | 270 int size = initial_size_[i] - |
262 static_cast<int>(compress_fraction_[i] * delta); | 271 static_cast<int>(compress_fraction_[i] * delta); |
263 size = AlignToGrid(size, details_.grid_size); | 272 size = AlignToGrid(size, grid_size); |
264 if (i == attached_windows_.size()) | 273 if (i == attached_windows_.size()) |
265 size = end - current; | 274 size = end - current; |
266 current += size; | 275 current += size; |
267 sizes->push_back(size); | 276 sizes->push_back(size); |
268 } | 277 } |
269 } | 278 } |
270 } | 279 } |
271 | 280 |
272 void WorkspaceWindowResizer::AdjustBoundsForMainWindow( | 281 void WorkspaceWindowResizer::AdjustBoundsForMainWindow( |
273 gfx::Rect* bounds) const { | 282 gfx::Rect* bounds, int grid_size) const { |
274 // Always keep kMinOnscreenHeight on the bottom. | 283 // Always keep kMinOnscreenHeight on the bottom. |
275 gfx::Rect work_area(gfx::Screen::GetMonitorWorkAreaNearestWindow(window())); | 284 gfx::Rect work_area(gfx::Screen::GetMonitorWorkAreaNearestWindow(window())); |
276 int max_y = AlignToGridRoundUp(work_area.bottom() - kMinOnscreenHeight, | 285 int max_y = AlignToGridRoundUp(work_area.bottom() - kMinOnscreenHeight, |
277 details_.grid_size); | 286 grid_size); |
278 if (bounds->y() > max_y) | 287 if (bounds->y() > max_y) |
279 bounds->set_y(max_y); | 288 bounds->set_y(max_y); |
280 | 289 |
281 // Don't allow dragging above the top of the monitor. | 290 // Don't allow dragging above the top of the monitor. |
282 if (bounds->y() <= work_area.y()) | 291 if (bounds->y() <= work_area.y()) |
283 bounds->set_y(work_area.y()); | 292 bounds->set_y(work_area.y()); |
284 | 293 |
285 if (details_.grid_size >= 0 && details_.window_component == HTCAPTION) | 294 if (grid_size >= 0 && details_.window_component == HTCAPTION) |
286 SnapToWorkAreaEdges(work_area, bounds); | 295 SnapToWorkAreaEdges(work_area, bounds, grid_size); |
287 | 296 |
288 if (attached_windows_.empty()) | 297 if (attached_windows_.empty()) |
289 return; | 298 return; |
290 | 299 |
291 if (details_.window_component == HTRIGHT) { | 300 if (details_.window_component == HTRIGHT) { |
292 bounds->set_width(std::min(bounds->width(), | 301 bounds->set_width(std::min(bounds->width(), |
293 work_area.right() - total_min_ - bounds->x())); | 302 work_area.right() - total_min_ - bounds->x())); |
294 } else { | 303 } else { |
295 DCHECK_EQ(HTBOTTOM, details_.window_component); | 304 DCHECK_EQ(HTBOTTOM, details_.window_component); |
296 bounds->set_height(std::min(bounds->height(), | 305 bounds->set_height(std::min(bounds->height(), |
297 work_area.bottom() - total_min_ - bounds->y())); | 306 work_area.bottom() - total_min_ - bounds->y())); |
298 } | 307 } |
299 } | 308 } |
300 | 309 |
301 void WorkspaceWindowResizer::SnapToWorkAreaEdges( | 310 void WorkspaceWindowResizer::SnapToWorkAreaEdges( |
302 const gfx::Rect& work_area, | 311 const gfx::Rect& work_area, |
303 gfx::Rect* bounds) const { | 312 gfx::Rect* bounds, |
304 int left_edge = AlignToGridRoundUp(work_area.x(), details_.grid_size); | 313 int grid_size) const { |
305 int right_edge = AlignToGridRoundDown(work_area.right(), details_.grid_size); | 314 int left_edge = AlignToGridRoundUp(work_area.x(), grid_size); |
306 int top_edge = AlignToGridRoundUp(work_area.y(), details_.grid_size); | 315 int right_edge = AlignToGridRoundDown(work_area.right(), grid_size); |
| 316 int top_edge = AlignToGridRoundUp(work_area.y(), grid_size); |
307 int bottom_edge = AlignToGridRoundDown(work_area.bottom(), | 317 int bottom_edge = AlignToGridRoundDown(work_area.bottom(), |
308 details_.grid_size); | 318 grid_size); |
309 if (ShouldSnapToEdge(bounds->x() - left_edge, details_.grid_size)) { | 319 if (ShouldSnapToEdge(bounds->x() - left_edge, grid_size)) { |
310 bounds->set_x(left_edge); | 320 bounds->set_x(left_edge); |
311 } else if (ShouldSnapToEdge(right_edge - bounds->right(), | 321 } else if (ShouldSnapToEdge(right_edge - bounds->right(), |
312 details_.grid_size)) { | 322 grid_size)) { |
313 bounds->set_x(right_edge - bounds->width()); | 323 bounds->set_x(right_edge - bounds->width()); |
314 } | 324 } |
315 if (ShouldSnapToEdge(bounds->y() - top_edge, details_.grid_size)) { | 325 if (ShouldSnapToEdge(bounds->y() - top_edge, grid_size)) { |
316 bounds->set_y(top_edge); | 326 bounds->set_y(top_edge); |
317 } else if (ShouldSnapToEdge(bottom_edge - bounds->bottom(), | 327 } else if (ShouldSnapToEdge(bottom_edge - bounds->bottom(), grid_size) && |
318 details_.grid_size) && | |
319 bounds->height() < (bottom_edge - top_edge)) { | 328 bounds->height() < (bottom_edge - top_edge)) { |
320 // Only snap to the bottom if the window is smaller than the work area. | 329 // Only snap to the bottom if the window is smaller than the work area. |
321 // Doing otherwise can lead to window snapping in weird ways as it bounces | 330 // Doing otherwise can lead to window snapping in weird ways as it bounces |
322 // between snapping to top then bottom. | 331 // between snapping to top then bottom. |
323 bounds->set_y(bottom_edge - bounds->height()); | 332 bounds->set_y(bottom_edge - bounds->height()); |
324 } | 333 } |
325 } | 334 } |
326 | 335 |
327 bool WorkspaceWindowResizer::TouchesBottomOfScreen() const { | 336 bool WorkspaceWindowResizer::TouchesBottomOfScreen() const { |
328 gfx::Rect work_area( | 337 gfx::Rect work_area( |
(...skipping 14 matching lines...) Expand all Loading... |
343 return x; | 352 return x; |
344 case HTBOTTOM: | 353 case HTBOTTOM: |
345 return y; | 354 return y; |
346 default: | 355 default: |
347 NOTREACHED(); | 356 NOTREACHED(); |
348 } | 357 } |
349 return 0; | 358 return 0; |
350 } | 359 } |
351 | 360 |
352 void WorkspaceWindowResizer::UpdatePhantomWindow(const gfx::Point& location, | 361 void WorkspaceWindowResizer::UpdatePhantomWindow(const gfx::Point& location, |
353 const gfx::Rect& bounds) { | 362 const gfx::Rect& bounds, |
| 363 int grid_size) { |
354 if (!did_move_or_resize_ || details_.window_component != HTCAPTION) | 364 if (!did_move_or_resize_ || details_.window_component != HTCAPTION) |
355 return; | 365 return; |
356 | 366 |
357 SnapType last_type = snap_type_; | 367 SnapType last_type = snap_type_; |
358 snap_type_ = GetSnapType(location); | 368 snap_type_ = GetSnapType(location); |
359 if (snap_type_ == SNAP_NONE || snap_type_ != last_type) { | 369 if (snap_type_ == SNAP_NONE || snap_type_ != last_type) { |
360 phantom_window_controller_.reset(); | 370 phantom_window_controller_.reset(); |
361 snap_sizer_.reset(); | 371 snap_sizer_.reset(); |
362 if (snap_type_ == SNAP_NONE) | 372 if (snap_type_ == SNAP_NONE) |
363 return; | 373 return; |
364 } | 374 } |
365 if (!snap_sizer_.get()) { | 375 if (!snap_sizer_.get()) { |
366 SnapSizer::Edge edge = (snap_type_ == SNAP_LEFT_EDGE) ? | 376 SnapSizer::Edge edge = (snap_type_ == SNAP_LEFT_EDGE) ? |
367 SnapSizer::LEFT_EDGE : SnapSizer::RIGHT_EDGE; | 377 SnapSizer::LEFT_EDGE : SnapSizer::RIGHT_EDGE; |
368 snap_sizer_.reset( | 378 snap_sizer_.reset( |
369 new SnapSizer(details_.window, location, edge, details_.grid_size)); | 379 new SnapSizer(details_.window, location, edge, grid_size)); |
370 } else { | 380 } else { |
371 snap_sizer_->Update(location); | 381 snap_sizer_->Update(location); |
372 } | 382 } |
373 if (!phantom_window_controller_.get()) { | 383 if (!phantom_window_controller_.get()) { |
374 phantom_window_controller_.reset( | 384 phantom_window_controller_.reset( |
375 new PhantomWindowController(details_.window)); | 385 new PhantomWindowController(details_.window)); |
376 } | 386 } |
377 phantom_window_controller_->Show(snap_sizer_->target_bounds()); | 387 phantom_window_controller_->Show(snap_sizer_->target_bounds()); |
378 } | 388 } |
379 | 389 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 gfx::Rect area(gfx::Screen::GetMonitorAreaNearestWindow(details_.window)); | 425 gfx::Rect area(gfx::Screen::GetMonitorAreaNearestWindow(details_.window)); |
416 if (location.x() <= area.x()) | 426 if (location.x() <= area.x()) |
417 return SNAP_LEFT_EDGE; | 427 return SNAP_LEFT_EDGE; |
418 if (location.x() >= area.right() - 1) | 428 if (location.x() >= area.right() - 1) |
419 return SNAP_RIGHT_EDGE; | 429 return SNAP_RIGHT_EDGE; |
420 return SNAP_NONE; | 430 return SNAP_NONE; |
421 } | 431 } |
422 | 432 |
423 } // namespace internal | 433 } // namespace internal |
424 } // namespace ash | 434 } // namespace ash |
OLD | NEW |