| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/caption_buttons/frame_maximize_button.h" | 5 #include "ash/wm/caption_buttons/frame_maximize_button.h" |
| 6 | 6 |
| 7 #include "ash/metrics/user_metrics_recorder.h" | 7 #include "ash/metrics/user_metrics_recorder.h" |
| 8 #include "ash/screen_ash.h" | 8 #include "ash/screen_util.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" |
| 11 #include "ash/touch/touch_uma.h" | 11 #include "ash/touch/touch_uma.h" |
| 12 #include "ash/wm/caption_buttons/frame_maximize_button_observer.h" | 12 #include "ash/wm/caption_buttons/frame_maximize_button_observer.h" |
| 13 #include "ash/wm/caption_buttons/maximize_bubble_controller.h" | 13 #include "ash/wm/caption_buttons/maximize_bubble_controller.h" |
| 14 #include "ash/wm/window_animations.h" | 14 #include "ash/wm/window_animations.h" |
| 15 #include "ash/wm/window_state.h" | 15 #include "ash/wm/window_state.h" |
| 16 #include "ash/wm/workspace/phantom_window_controller.h" | 16 #include "ash/wm/workspace/phantom_window_controller.h" |
| 17 #include "ash/wm/workspace/snap_sizer.h" | 17 #include "ash/wm/workspace/snap_sizer.h" |
| 18 #include "grit/ash_strings.h" | 18 #include "grit/ash_strings.h" |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 UpdateSnap(press_location_, false, press_is_gesture_); | 419 UpdateSnap(press_location_, false, press_is_gesture_); |
| 420 } | 420 } |
| 421 | 421 |
| 422 void FrameMaximizeButton::UpdateSnap(const gfx::Point& location, | 422 void FrameMaximizeButton::UpdateSnap(const gfx::Point& location, |
| 423 bool select_default, | 423 bool select_default, |
| 424 bool is_touch) { | 424 bool is_touch) { |
| 425 SnapType type = SnapTypeForLocation(location); | 425 SnapType type = SnapTypeForLocation(location); |
| 426 if (type == snap_type_) { | 426 if (type == snap_type_) { |
| 427 if (snap_sizer_) { | 427 if (snap_sizer_) { |
| 428 snap_sizer_->Update(LocationForSnapSizer(location)); | 428 snap_sizer_->Update(LocationForSnapSizer(location)); |
| 429 phantom_window_->Show(ScreenAsh::ConvertRectToScreen( | 429 phantom_window_->Show(ScreenUtil::ConvertRectToScreen( |
| 430 frame_->GetNativeView()->parent(), | 430 frame_->GetNativeView()->parent(), |
| 431 snap_sizer_->target_bounds())); | 431 snap_sizer_->target_bounds())); |
| 432 } | 432 } |
| 433 return; | 433 return; |
| 434 } | 434 } |
| 435 | 435 |
| 436 snap_type_ = type; | 436 snap_type_ = type; |
| 437 snap_sizer_.reset(); | 437 snap_sizer_.reset(); |
| 438 SchedulePaint(); | 438 SchedulePaint(); |
| 439 | 439 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 return maximize_type != FRAME_STATE_FULL ? SNAP_MAXIMIZE : SNAP_RESTORE; | 483 return maximize_type != FRAME_STATE_FULL ? SNAP_MAXIMIZE : SNAP_RESTORE; |
| 484 } | 484 } |
| 485 | 485 |
| 486 gfx::Rect FrameMaximizeButton::ScreenBoundsForType( | 486 gfx::Rect FrameMaximizeButton::ScreenBoundsForType( |
| 487 SnapType type, | 487 SnapType type, |
| 488 const SnapSizer& snap_sizer) const { | 488 const SnapSizer& snap_sizer) const { |
| 489 aura::Window* window = frame_->GetNativeWindow(); | 489 aura::Window* window = frame_->GetNativeWindow(); |
| 490 switch (type) { | 490 switch (type) { |
| 491 case SNAP_LEFT: | 491 case SNAP_LEFT: |
| 492 case SNAP_RIGHT: | 492 case SNAP_RIGHT: |
| 493 return ScreenAsh::ConvertRectToScreen(window->parent(), | 493 return ScreenUtil::ConvertRectToScreen(window->parent(), |
| 494 snap_sizer.target_bounds()); | 494 snap_sizer.target_bounds()); |
| 495 case SNAP_MAXIMIZE: | 495 case SNAP_MAXIMIZE: |
| 496 return ScreenAsh::ConvertRectToScreen( | 496 return ScreenUtil::ConvertRectToScreen( |
| 497 window->parent(), | 497 window->parent(), |
| 498 ScreenAsh::GetMaximizedWindowBoundsInParent(window)); | 498 ScreenUtil::GetMaximizedWindowBoundsInParent(window)); |
| 499 case SNAP_MINIMIZE: { | 499 case SNAP_MINIMIZE: { |
| 500 gfx::Rect rect = GetMinimizeAnimationTargetBoundsInScreen(window); | 500 gfx::Rect rect = GetMinimizeAnimationTargetBoundsInScreen(window); |
| 501 if (!rect.IsEmpty()) { | 501 if (!rect.IsEmpty()) { |
| 502 // PhantomWindowController insets slightly, outset it so the phantom | 502 // PhantomWindowController insets slightly, outset it so the phantom |
| 503 // doesn't appear inset. | 503 // doesn't appear inset. |
| 504 rect.Inset(-8, -8); | 504 rect.Inset(-8, -8); |
| 505 } | 505 } |
| 506 return rect; | 506 return rect; |
| 507 } | 507 } |
| 508 case SNAP_RESTORE: { | 508 case SNAP_RESTORE: { |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 return FRAME_STATE_SNAP_LEFT; | 582 return FRAME_STATE_SNAP_LEFT; |
| 583 if (bounds.right() == screen.right()) | 583 if (bounds.right() == screen.right()) |
| 584 return FRAME_STATE_SNAP_RIGHT; | 584 return FRAME_STATE_SNAP_RIGHT; |
| 585 // If we come here, it is likely caused by the fact that the | 585 // If we come here, it is likely caused by the fact that the |
| 586 // "VerticalResizeDoubleClick" stored a restore rectangle. In that case | 586 // "VerticalResizeDoubleClick" stored a restore rectangle. In that case |
| 587 // we allow all maximize operations (and keep the restore rectangle). | 587 // we allow all maximize operations (and keep the restore rectangle). |
| 588 return FRAME_STATE_NONE; | 588 return FRAME_STATE_NONE; |
| 589 } | 589 } |
| 590 | 590 |
| 591 } // namespace ash | 591 } // namespace ash |
| OLD | NEW |