| 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/immersive_fullscreen_controller.h" | 5 #include "ash/wm/immersive_fullscreen_controller.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "ash/common/ash_constants.h" | 9 #include "ash/common/ash_constants.h" |
| 10 #include "ash/common/wm/immersive/wm_immersive_fullscreen_controller_delegate.h" | 10 #include "ash/common/wm/immersive/wm_immersive_fullscreen_controller_delegate.h" |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 void ImmersiveFullscreenController::OnGestureEvent(ui::GestureEvent* event) { | 399 void ImmersiveFullscreenController::OnGestureEvent(ui::GestureEvent* event) { |
| 400 if (!enabled_) | 400 if (!enabled_) |
| 401 return; | 401 return; |
| 402 | 402 |
| 403 // Touch gestures should not initiate revealing the top-of-window views while | 403 // Touch gestures should not initiate revealing the top-of-window views while |
| 404 // |widget_| is inactive. | 404 // |widget_| is inactive. |
| 405 if (!widget_->IsActive()) | 405 if (!widget_->IsActive()) |
| 406 return; | 406 return; |
| 407 | 407 |
| 408 switch (event->type()) { | 408 switch (event->type()) { |
| 409 #if defined(OS_WIN) | |
| 410 case ui::ET_GESTURE_WIN8_EDGE_SWIPE: | |
| 411 UpdateRevealedLocksForSwipe(GetSwipeType(event)); | |
| 412 event->SetHandled(); | |
| 413 break; | |
| 414 #endif | |
| 415 case ui::ET_GESTURE_SCROLL_BEGIN: | 409 case ui::ET_GESTURE_SCROLL_BEGIN: |
| 416 if (ShouldHandleGestureEvent(GetEventLocationInScreen(*event))) { | 410 if (ShouldHandleGestureEvent(GetEventLocationInScreen(*event))) { |
| 417 gesture_begun_ = true; | 411 gesture_begun_ = true; |
| 418 // Do not consume the event. Otherwise, we end up consuming all | 412 // Do not consume the event. Otherwise, we end up consuming all |
| 419 // ui::ET_GESTURE_SCROLL_BEGIN events in the top-of-window views | 413 // ui::ET_GESTURE_SCROLL_BEGIN events in the top-of-window views |
| 420 // when the top-of-window views are revealed. | 414 // when the top-of-window views are revealed. |
| 421 } | 415 } |
| 422 break; | 416 break; |
| 423 case ui::ET_GESTURE_SCROLL_UPDATE: | 417 case ui::ET_GESTURE_SCROLL_UPDATE: |
| 424 if (gesture_begun_) { | 418 if (gesture_begun_) { |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 851 } | 845 } |
| 852 | 846 |
| 853 void ImmersiveFullscreenController::OnSlideClosedAnimationCompleted() { | 847 void ImmersiveFullscreenController::OnSlideClosedAnimationCompleted() { |
| 854 DCHECK_EQ(SLIDING_CLOSED, reveal_state_); | 848 DCHECK_EQ(SLIDING_CLOSED, reveal_state_); |
| 855 reveal_state_ = CLOSED; | 849 reveal_state_ = CLOSED; |
| 856 delegate_->OnImmersiveRevealEnded(); | 850 delegate_->OnImmersiveRevealEnded(); |
| 857 } | 851 } |
| 858 | 852 |
| 859 ImmersiveFullscreenController::SwipeType | 853 ImmersiveFullscreenController::SwipeType |
| 860 ImmersiveFullscreenController::GetSwipeType(ui::GestureEvent* event) const { | 854 ImmersiveFullscreenController::GetSwipeType(ui::GestureEvent* event) const { |
| 861 #if defined(OS_WIN) | |
| 862 if (event->type() == ui::ET_GESTURE_WIN8_EDGE_SWIPE) | |
| 863 return SWIPE_OPEN; | |
| 864 #endif | |
| 865 if (event->type() != ui::ET_GESTURE_SCROLL_UPDATE) | 855 if (event->type() != ui::ET_GESTURE_SCROLL_UPDATE) |
| 866 return SWIPE_NONE; | 856 return SWIPE_NONE; |
| 867 // Make sure that it is a clear vertical gesture. | 857 // Make sure that it is a clear vertical gesture. |
| 868 if (std::abs(event->details().scroll_y()) <= | 858 if (std::abs(event->details().scroll_y()) <= |
| 869 kSwipeVerticalThresholdMultiplier * std::abs(event->details().scroll_x())) | 859 kSwipeVerticalThresholdMultiplier * std::abs(event->details().scroll_x())) |
| 870 return SWIPE_NONE; | 860 return SWIPE_NONE; |
| 871 if (event->details().scroll_y() < 0) | 861 if (event->details().scroll_y() < 0) |
| 872 return SWIPE_CLOSE; | 862 return SWIPE_CLOSE; |
| 873 else if (event->details().scroll_y() > 0) | 863 else if (event->details().scroll_y() > 0) |
| 874 return SWIPE_OPEN; | 864 return SWIPE_OPEN; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 934 ::wm::GetTransientChildren(native_window_); | 924 ::wm::GetTransientChildren(native_window_); |
| 935 for (size_t i = 0; i < transient_children.size(); ++i) { | 925 for (size_t i = 0; i < transient_children.size(); ++i) { |
| 936 aura::Window* transient_child = transient_children[i]; | 926 aura::Window* transient_child = transient_children[i]; |
| 937 views::View* anchor_view = GetAnchorView(transient_child); | 927 views::View* anchor_view = GetAnchorView(transient_child); |
| 938 if (anchor_view && top_container_->Contains(anchor_view)) | 928 if (anchor_view && top_container_->Contains(anchor_view)) |
| 939 bubble_observer_->StartObserving(transient_child); | 929 bubble_observer_->StartObserving(transient_child); |
| 940 } | 930 } |
| 941 } | 931 } |
| 942 | 932 |
| 943 } // namespace ash | 933 } // namespace ash |
| OLD | NEW |