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/frame_maximize_button.h" | 5 #include "ash/wm/workspace/frame_maximize_button.h" |
6 | 6 |
7 #include "ash/launcher/launcher.h" | 7 #include "ash/launcher/launcher.h" |
8 #include "ash/screen_ash.h" | 8 #include "ash/screen_ash.h" |
9 #include "ash/shelf/shelf_widget.h" | 9 #include "ash/shelf/shelf_widget.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 // Before the window gets destroyed, the maximizer dialog needs to be shut | 102 // Before the window gets destroyed, the maximizer dialog needs to be shut |
103 // down since it would otherwise call into a deleted object. | 103 // down since it would otherwise call into a deleted object. |
104 maximizer_.reset(); | 104 maximizer_.reset(); |
105 if (widget_) | 105 if (widget_) |
106 OnWindowDestroying(widget_->GetNativeWindow()); | 106 OnWindowDestroying(widget_->GetNativeWindow()); |
107 } | 107 } |
108 | 108 |
109 void FrameMaximizeButton::SnapButtonHovered(SnapType type) { | 109 void FrameMaximizeButton::SnapButtonHovered(SnapType type) { |
110 // Make sure to only show hover operations when no button is pressed and | 110 // Make sure to only show hover operations when no button is pressed and |
111 // a similar snap operation in progress does not get re-applied. | 111 // a similar snap operation in progress does not get re-applied. |
112 if (is_snap_enabled_ || (type == snap_type_ && snap_sizer_)) | 112 if (is_snap_enabled_) |
113 return; | 113 return; |
114 // Prime the mouse location with the center of the (local) button. | 114 // Prime the mouse location with the center of the (local) button. |
115 press_location_ = gfx::Point(width() / 2, height() / 2); | 115 press_location_ = gfx::Point(width() / 2, height() / 2); |
116 // Then get an adjusted mouse position to initiate the effect. | 116 // Then get an adjusted mouse position to initiate the effect. |
117 gfx::Point location = press_location_; | 117 gfx::Point location = press_location_; |
118 switch (type) { | 118 switch (type) { |
119 case SNAP_LEFT: | 119 case SNAP_LEFT: |
120 location.set_x(location.x() - width()); | 120 location.set_x(location.x() - width()); |
121 break; | 121 break; |
122 case SNAP_RIGHT: | 122 case SNAP_RIGHT: |
(...skipping 11 matching lines...) Expand all Loading... | |
134 break; | 134 break; |
135 case SNAP_MAXIMIZE: | 135 case SNAP_MAXIMIZE: |
136 break; | 136 break; |
137 case SNAP_NONE: | 137 case SNAP_NONE: |
138 Cancel(true); | 138 Cancel(true); |
139 return; | 139 return; |
140 default: | 140 default: |
141 // We should not come here. | 141 // We should not come here. |
142 NOTREACHED(); | 142 NOTREACHED(); |
143 } | 143 } |
144 // Note: There is no hover with touch - we can therefore pass false for touch | 144 UpdateSnap(location); |
145 // operations. | |
146 UpdateSnap(location, true, false); | |
147 } | 145 } |
148 | 146 |
149 void FrameMaximizeButton::ExecuteSnapAndCloseMenu(SnapType snap_type) { | 147 void FrameMaximizeButton::ExecuteSnapAndCloseMenu(SnapType snap_type) { |
150 // We can come here with no snap type set in case that the mouse opened the | 148 // We can come here with no snap type set in case that the mouse opened the |
151 // maximize button and a touch event "touched" a button. | 149 // maximize button and a touch event "touched" a button. |
152 if (snap_type_ == SNAP_NONE) | 150 if (snap_type_ == SNAP_NONE) |
153 SnapButtonHovered(snap_type); | 151 SnapButtonHovered(snap_type); |
154 | 152 |
155 Cancel(true); | 153 Cancel(true); |
156 // Tell our menu to close. | 154 // Tell our menu to close. |
157 maximizer_.reset(); | 155 maximizer_.reset(); |
158 snap_type_ = snap_type; | 156 snap_type_ = snap_type; |
159 // Since Snap might destroy |this|, but the snap_sizer needs to be destroyed, | 157 Snap(); |
160 // The ownership of the snap_sizer is taken now. | |
161 scoped_ptr<SnapSizer> snap_sizer(snap_sizer_.release()); | |
162 Snap(*snap_sizer.get()); | |
163 } | 158 } |
164 | 159 |
165 void FrameMaximizeButton::DestroyMaximizeMenu() { | 160 void FrameMaximizeButton::DestroyMaximizeMenu() { |
166 Cancel(false); | 161 Cancel(false); |
167 } | 162 } |
168 | 163 |
169 void FrameMaximizeButton::OnWindowBoundsChanged( | 164 void FrameMaximizeButton::OnWindowBoundsChanged( |
170 aura::Window* window, | 165 aura::Window* window, |
171 const gfx::Rect& old_bounds, | 166 const gfx::Rect& old_bounds, |
172 const gfx::Rect& new_bounds) { | 167 const gfx::Rect& new_bounds) { |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
331 // Prepare the help menu. | 326 // Prepare the help menu. |
332 if (!maximizer_) { | 327 if (!maximizer_) { |
333 maximizer_.reset(new MaximizeBubbleController( | 328 maximizer_.reset(new MaximizeBubbleController( |
334 this, | 329 this, |
335 GetMaximizeBubbleFrameState(), | 330 GetMaximizeBubbleFrameState(), |
336 bubble_appearance_delay_ms_)); | 331 bubble_appearance_delay_ms_)); |
337 } else { | 332 } else { |
338 // If the menu did not show up yet, we delay it even a bit more. | 333 // If the menu did not show up yet, we delay it even a bit more. |
339 maximizer_->DelayCreation(); | 334 maximizer_->DelayCreation(); |
340 } | 335 } |
341 snap_sizer_.reset(NULL); | |
342 InstallEventFilter(); | 336 InstallEventFilter(); |
343 snap_type_ = SNAP_NONE; | 337 snap_type_ = SNAP_NONE; |
344 press_location_ = event.location(); | 338 press_location_ = event.location(); |
345 press_is_gesture_ = event.IsGestureEvent(); | 339 press_is_gesture_ = event.IsGestureEvent(); |
346 exceeded_drag_threshold_ = false; | 340 exceeded_drag_threshold_ = false; |
347 update_timer_.Start( | 341 update_timer_.Start( |
348 FROM_HERE, | 342 FROM_HERE, |
349 base::TimeDelta::FromMilliseconds(kUpdateDelayMS), | 343 base::TimeDelta::FromMilliseconds(kUpdateDelayMS), |
350 this, | 344 this, |
351 &FrameMaximizeButton::UpdateSnapFromEventLocation); | 345 &FrameMaximizeButton::UpdateSnapFromEventLocation); |
352 } | 346 } |
353 | 347 |
354 void FrameMaximizeButton::ProcessUpdateEvent(const ui::LocatedEvent& event) { | 348 void FrameMaximizeButton::ProcessUpdateEvent(const ui::LocatedEvent& event) { |
355 DCHECK(is_snap_enabled_); | 349 DCHECK(is_snap_enabled_); |
356 if (!exceeded_drag_threshold_) { | 350 if (!exceeded_drag_threshold_) { |
357 exceeded_drag_threshold_ = views::View::ExceededDragThreshold( | 351 exceeded_drag_threshold_ = views::View::ExceededDragThreshold( |
358 event.location() - press_location_); | 352 event.location() - press_location_); |
359 } | 353 } |
360 if (exceeded_drag_threshold_) | 354 if (exceeded_drag_threshold_) |
361 UpdateSnap(event.location(), false, event.IsGestureEvent()); | 355 UpdateSnap(event.location()); |
362 } | 356 } |
363 | 357 |
364 bool FrameMaximizeButton::ProcessEndEvent(const ui::LocatedEvent& event) { | 358 bool FrameMaximizeButton::ProcessEndEvent(const ui::LocatedEvent& event) { |
365 update_timer_.Stop(); | 359 update_timer_.Stop(); |
366 UninstallEventFilter(); | 360 UninstallEventFilter(); |
367 bool should_snap = is_snap_enabled_; | 361 bool should_snap = is_snap_enabled_; |
368 is_snap_enabled_ = false; | 362 is_snap_enabled_ = false; |
369 | 363 |
370 // Remove our help bubble. | 364 // Remove our help bubble. |
371 maximizer_.reset(); | 365 maximizer_.reset(); |
372 | 366 |
373 if (!should_snap || snap_type_ == SNAP_NONE) | 367 if (!should_snap || snap_type_ == SNAP_NONE) |
374 return false; | 368 return false; |
375 | 369 |
376 SetState(views::CustomButton::STATE_NORMAL); | 370 SetState(views::CustomButton::STATE_NORMAL); |
377 // SetState will not call SchedulePaint() if state was already set to | 371 // SetState will not call SchedulePaint() if state was already set to |
378 // STATE_NORMAL during a drag. | 372 // STATE_NORMAL during a drag. |
379 SchedulePaint(); | 373 SchedulePaint(); |
380 phantom_window_.reset(); | 374 phantom_window_.reset(); |
381 // Since Snap might destroy |this|, but the snap_sizer needs to be destroyed, | 375 Snap(); |
382 // The ownership of the snap_sizer is taken now. | |
383 scoped_ptr<SnapSizer> snap_sizer(snap_sizer_.release()); | |
384 Snap(*snap_sizer.get()); | |
385 return true; | 376 return true; |
386 } | 377 } |
387 | 378 |
388 void FrameMaximizeButton::Cancel(bool keep_menu_open) { | 379 void FrameMaximizeButton::Cancel(bool keep_menu_open) { |
389 if (!keep_menu_open) { | 380 if (!keep_menu_open) { |
390 maximizer_.reset(); | 381 maximizer_.reset(); |
391 UninstallEventFilter(); | 382 UninstallEventFilter(); |
392 is_snap_enabled_ = false; | 383 is_snap_enabled_ = false; |
393 snap_sizer_.reset(); | |
394 } | 384 } |
395 phantom_window_.reset(); | 385 phantom_window_.reset(); |
396 snap_type_ = SNAP_NONE; | 386 snap_type_ = SNAP_NONE; |
397 update_timer_.Stop(); | 387 update_timer_.Stop(); |
398 SchedulePaint(); | 388 SchedulePaint(); |
399 } | 389 } |
400 | 390 |
401 void FrameMaximizeButton::InstallEventFilter() { | 391 void FrameMaximizeButton::InstallEventFilter() { |
402 if (escape_event_filter_) | 392 if (escape_event_filter_) |
403 return; | 393 return; |
404 | 394 |
405 escape_event_filter_.reset(new EscapeEventFilter(this)); | 395 escape_event_filter_.reset(new EscapeEventFilter(this)); |
406 } | 396 } |
407 | 397 |
408 void FrameMaximizeButton::UninstallEventFilter() { | 398 void FrameMaximizeButton::UninstallEventFilter() { |
409 escape_event_filter_.reset(NULL); | 399 escape_event_filter_.reset(NULL); |
410 } | 400 } |
411 | 401 |
412 void FrameMaximizeButton::UpdateSnapFromEventLocation() { | 402 void FrameMaximizeButton::UpdateSnapFromEventLocation() { |
413 // If the drag threshold has been exceeded the snap location is up to date. | 403 // If the drag threshold has been exceeded the snap location is up to date. |
414 if (exceeded_drag_threshold_) | 404 if (exceeded_drag_threshold_) |
415 return; | 405 return; |
416 exceeded_drag_threshold_ = true; | 406 exceeded_drag_threshold_ = true; |
417 UpdateSnap(press_location_, false, press_is_gesture_); | 407 UpdateSnap(press_location_); |
418 } | 408 } |
419 | 409 |
420 void FrameMaximizeButton::UpdateSnap(const gfx::Point& location, | 410 void FrameMaximizeButton::UpdateSnap(const gfx::Point& location) { |
pkotwicz
2013/08/30 21:10:57
I removed the now unused extra parameters from Upd
| |
421 bool select_default, | |
422 bool is_touch) { | |
423 SnapType type = SnapTypeForLocation(location); | 411 SnapType type = SnapTypeForLocation(location); |
424 if (type == snap_type_) { | 412 if (type == snap_type_) |
425 if (snap_sizer_) { | |
426 snap_sizer_->Update(LocationForSnapSizer(location)); | |
427 phantom_window_->Show(ScreenAsh::ConvertRectToScreen( | |
428 frame_->GetWidget()->GetNativeView()->parent(), | |
429 snap_sizer_->target_bounds())); | |
430 } | |
431 return; | 413 return; |
432 } | |
433 | 414 |
434 snap_type_ = type; | 415 snap_type_ = type; |
435 snap_sizer_.reset(); | |
436 SchedulePaint(); | 416 SchedulePaint(); |
437 | 417 |
438 if (snap_type_ == SNAP_NONE) { | 418 if (snap_type_ == SNAP_NONE) { |
439 phantom_window_.reset(); | 419 phantom_window_.reset(); |
440 return; | 420 return; |
441 } | 421 } |
442 | 422 |
443 if (snap_type_ == SNAP_LEFT || snap_type_ == SNAP_RIGHT) { | |
444 SnapSizer::Edge snap_edge = snap_type_ == SNAP_LEFT ? | |
445 SnapSizer::LEFT_EDGE : SnapSizer::RIGHT_EDGE; | |
446 SnapSizer::InputType input_type = | |
447 is_touch ? SnapSizer::TOUCH_MAXIMIZE_BUTTON_INPUT : | |
448 SnapSizer::OTHER_INPUT; | |
449 snap_sizer_.reset(new SnapSizer(frame_->GetWidget()->GetNativeWindow(), | |
450 LocationForSnapSizer(location), | |
451 snap_edge, | |
452 input_type)); | |
453 if (select_default) | |
454 snap_sizer_->SelectDefaultSizeAndDisableResize(); | |
455 } | |
456 if (!phantom_window_) { | 423 if (!phantom_window_) { |
457 phantom_window_.reset(new internal::PhantomWindowController( | 424 phantom_window_.reset(new internal::PhantomWindowController( |
458 frame_->GetWidget()->GetNativeWindow())); | 425 frame_->GetWidget()->GetNativeWindow())); |
459 } | 426 } |
460 if (maximizer_) { | 427 if (maximizer_) { |
461 phantom_window_->set_phantom_below_window(maximizer_->GetBubbleWindow()); | 428 phantom_window_->set_phantom_below_window(maximizer_->GetBubbleWindow()); |
462 maximizer_->SetSnapType(snap_type_); | 429 maximizer_->SetSnapType(snap_type_); |
463 } | 430 } |
464 phantom_window_->Show( | 431 phantom_window_->Show(ScreenBoundsForType(snap_type_)); |
465 ScreenBoundsForType(snap_type_, *snap_sizer_.get())); | |
466 } | 432 } |
467 | 433 |
468 SnapType FrameMaximizeButton::SnapTypeForLocation( | 434 SnapType FrameMaximizeButton::SnapTypeForLocation( |
469 const gfx::Point& location) const { | 435 const gfx::Point& location) const { |
470 MaximizeBubbleFrameState maximize_type = GetMaximizeBubbleFrameState(); | 436 MaximizeBubbleFrameState maximize_type = GetMaximizeBubbleFrameState(); |
471 gfx::Vector2d delta(location - press_location_); | 437 gfx::Vector2d delta(location - press_location_); |
472 if (!views::View::ExceededDragThreshold(delta)) | 438 if (!views::View::ExceededDragThreshold(delta)) |
473 return maximize_type != FRAME_STATE_FULL ? SNAP_MAXIMIZE : SNAP_RESTORE; | 439 return maximize_type != FRAME_STATE_FULL ? SNAP_MAXIMIZE : SNAP_RESTORE; |
474 if (delta.x() < 0 && delta.y() > delta.x() && delta.y() < -delta.x()) | 440 if (delta.x() < 0 && delta.y() > delta.x() && delta.y() < -delta.x()) |
475 return maximize_type == FRAME_STATE_SNAP_LEFT ? SNAP_RESTORE : SNAP_LEFT; | 441 return maximize_type == FRAME_STATE_SNAP_LEFT ? SNAP_RESTORE : SNAP_LEFT; |
476 if (delta.x() > 0 && delta.y() > -delta.x() && delta.y() < delta.x()) | 442 if (delta.x() > 0 && delta.y() > -delta.x() && delta.y() < delta.x()) |
477 return maximize_type == FRAME_STATE_SNAP_RIGHT ? SNAP_RESTORE : SNAP_RIGHT; | 443 return maximize_type == FRAME_STATE_SNAP_RIGHT ? SNAP_RESTORE : SNAP_RIGHT; |
478 if (delta.y() > 0) | 444 if (delta.y() > 0) |
479 return SNAP_MINIMIZE; | 445 return SNAP_MINIMIZE; |
480 return maximize_type != FRAME_STATE_FULL ? SNAP_MAXIMIZE : SNAP_RESTORE; | 446 return maximize_type != FRAME_STATE_FULL ? SNAP_MAXIMIZE : SNAP_RESTORE; |
481 } | 447 } |
482 | 448 |
483 gfx::Rect FrameMaximizeButton::ScreenBoundsForType( | 449 gfx::Rect FrameMaximizeButton::ScreenBoundsForType(SnapType type) const { |
484 SnapType type, | |
485 const SnapSizer& snap_sizer) const { | |
486 aura::Window* window = frame_->GetWidget()->GetNativeWindow(); | 450 aura::Window* window = frame_->GetWidget()->GetNativeWindow(); |
487 switch (type) { | 451 switch (type) { |
488 case SNAP_LEFT: | 452 case SNAP_LEFT: |
489 case SNAP_RIGHT: | 453 case SNAP_RIGHT: { |
490 return ScreenAsh::ConvertRectToScreen( | 454 SnapSizer snap_sizer( |
491 frame_->GetWidget()->GetNativeView()->parent(), | 455 window, |
492 snap_sizer.target_bounds()); | 456 gfx::Point(), |
457 (type == SNAP_LEFT) ? SnapSizer::LEFT_EDGE : SnapSizer::RIGHT_EDGE, | |
458 SnapSizer::STEP_NO); | |
459 return ScreenAsh::ConvertRectToScreen(window->parent(), | |
460 snap_sizer.target_bounds()); | |
461 } | |
493 case SNAP_MAXIMIZE: | 462 case SNAP_MAXIMIZE: |
494 return ScreenAsh::ConvertRectToScreen( | 463 return ScreenAsh::ConvertRectToScreen( |
495 window->parent(), | 464 window->parent(), |
496 ScreenAsh::GetMaximizedWindowBoundsInParent(window)); | 465 ScreenAsh::GetMaximizedWindowBoundsInParent(window)); |
497 case SNAP_MINIMIZE: { | 466 case SNAP_MINIMIZE: { |
498 gfx::Rect rect = GetMinimizeAnimationTargetBoundsInScreen(window); | 467 gfx::Rect rect = GetMinimizeAnimationTargetBoundsInScreen(window); |
499 if (!rect.IsEmpty()) { | 468 if (!rect.IsEmpty()) { |
500 // PhantomWindowController insets slightly, outset it so the phantom | 469 // PhantomWindowController insets slightly, outset it so the phantom |
501 // doesn't appear inset. | 470 // doesn't appear inset. |
502 rect.Inset(-8, -8); | 471 rect.Inset(-8, -8); |
503 } | 472 } |
504 return rect; | 473 return rect; |
505 } | 474 } |
506 case SNAP_RESTORE: { | 475 case SNAP_RESTORE: { |
507 const gfx::Rect* restore = GetRestoreBoundsInScreen(window); | 476 const gfx::Rect* restore = GetRestoreBoundsInScreen(window); |
508 return restore ? | 477 return restore ? |
509 *restore : frame_->GetWidget()->GetWindowBoundsInScreen(); | 478 *restore : frame_->GetWidget()->GetWindowBoundsInScreen(); |
510 } | 479 } |
511 case SNAP_NONE: | 480 case SNAP_NONE: |
512 NOTREACHED(); | 481 NOTREACHED(); |
513 } | 482 } |
514 return gfx::Rect(); | 483 return gfx::Rect(); |
515 } | 484 } |
516 | 485 |
517 gfx::Point FrameMaximizeButton::LocationForSnapSizer( | 486 void FrameMaximizeButton::Snap() { |
518 const gfx::Point& location) const { | |
519 gfx::Point result(location); | |
520 views::View::ConvertPointToScreen(this, &result); | |
521 return result; | |
522 } | |
523 | |
524 void FrameMaximizeButton::Snap(const SnapSizer& snap_sizer) { | |
525 ash::Shell* shell = ash::Shell::GetInstance(); | 487 ash::Shell* shell = ash::Shell::GetInstance(); |
526 views::Widget* widget = frame_->GetWidget(); | 488 views::Widget* widget = frame_->GetWidget(); |
527 switch (snap_type_) { | 489 switch (snap_type_) { |
528 case SNAP_LEFT: | 490 case SNAP_LEFT: |
491 shell->delegate()->RecordUserMetricsAction( | |
492 ash::UMA_WINDOW_MAXIMIZE_BUTTON_MAXIMIZE_LEFT); | |
493 SnapSizer::SnapWindow(widget->GetNativeView(), | |
494 SnapSizer::LEFT_EDGE, | |
495 SnapSizer::STEP_NO); | |
496 break; | |
529 case SNAP_RIGHT: { | 497 case SNAP_RIGHT: { |
530 shell->delegate()->RecordUserMetricsAction( | 498 shell->delegate()->RecordUserMetricsAction( |
531 snap_type_ == SNAP_LEFT ? | 499 ash::UMA_WINDOW_MAXIMIZE_BUTTON_MAXIMIZE_RIGHT); |
532 ash::UMA_WINDOW_MAXIMIZE_BUTTON_MAXIMIZE_LEFT : | 500 SnapSizer::SnapWindow(widget->GetNativeView(), |
533 ash::UMA_WINDOW_MAXIMIZE_BUTTON_MAXIMIZE_RIGHT); | 501 SnapSizer::RIGHT_EDGE, |
534 // Get the bounds in screen coordinates for restore purposes. | 502 SnapSizer::STEP_NO); |
535 gfx::Rect restore = widget->GetWindowBoundsInScreen(); | |
536 if (widget->IsMaximized() || widget->IsFullscreen()) { | |
537 aura::Window* window = widget->GetNativeWindow(); | |
538 // In case of maximized we have a restore boundary. | |
539 DCHECK(ash::GetRestoreBoundsInScreen(window)); | |
540 // If it was maximized we need to recover the old restore set. | |
541 restore = *ash::GetRestoreBoundsInScreen(window); | |
542 | |
543 // The auto position manager will kick in when this is the only window. | |
544 // To avoid interference with it we tell it temporarily to not change | |
545 // the coordinates of this window. | |
546 bool is_managed = ash::wm::IsWindowPositionManaged(window); | |
547 if (is_managed) | |
548 ash::wm::SetWindowPositionManaged(window, false); | |
549 | |
550 // Set the restore size we want to restore to. | |
551 ash::SetRestoreBoundsInScreen(window, | |
552 ScreenBoundsForType(snap_type_, | |
553 snap_sizer)); | |
554 widget->Restore(); | |
555 | |
556 // After the window is where we want it to be we allow the window to be | |
557 // auto managed again. | |
558 if (is_managed) | |
559 ash::wm::SetWindowPositionManaged(window, true); | |
560 } else { | |
561 // Others might also have set up a restore rectangle already. If so, | |
562 // we should not overwrite the restore rectangle. | |
563 bool restore_set = | |
564 GetRestoreBoundsInScreen(widget->GetNativeWindow()) != NULL; | |
565 widget->SetBounds(ScreenBoundsForType(snap_type_, snap_sizer)); | |
566 if (restore_set) | |
567 break; | |
568 } | |
569 // Remember the widow's bounds for restoration. | |
570 ash::SetRestoreBoundsInScreen(widget->GetNativeWindow(), restore); | |
571 break; | 503 break; |
572 } | 504 } |
573 case SNAP_MAXIMIZE: | 505 case SNAP_MAXIMIZE: |
574 widget->Maximize(); | 506 widget->Maximize(); |
575 shell->delegate()->RecordUserMetricsAction( | 507 shell->delegate()->RecordUserMetricsAction( |
576 ash::UMA_WINDOW_MAXIMIZE_BUTTON_MAXIMIZE); | 508 ash::UMA_WINDOW_MAXIMIZE_BUTTON_MAXIMIZE); |
577 break; | 509 break; |
578 case SNAP_MINIMIZE: | 510 case SNAP_MINIMIZE: |
579 widget->Minimize(); | 511 widget->Minimize(); |
580 shell->delegate()->RecordUserMetricsAction( | 512 shell->delegate()->RecordUserMetricsAction( |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
615 return FRAME_STATE_SNAP_LEFT; | 547 return FRAME_STATE_SNAP_LEFT; |
616 if (bounds.right() == screen.right()) | 548 if (bounds.right() == screen.right()) |
617 return FRAME_STATE_SNAP_RIGHT; | 549 return FRAME_STATE_SNAP_RIGHT; |
618 // If we come here, it is likely caused by the fact that the | 550 // If we come here, it is likely caused by the fact that the |
619 // "VerticalResizeDoubleClick" stored a restore rectangle. In that case | 551 // "VerticalResizeDoubleClick" stored a restore rectangle. In that case |
620 // we allow all maximize operations (and keep the restore rectangle). | 552 // we allow all maximize operations (and keep the restore rectangle). |
621 return FRAME_STATE_NONE; | 553 return FRAME_STATE_NONE; |
622 } | 554 } |
623 | 555 |
624 } // namespace ash | 556 } // namespace ash |
OLD | NEW |