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

Unified Diff: ash/wm/gestures/edge_gesture_handler.cc

Issue 13315002: Add in gesture for immersive mode (Closed) Base URL: https://codereview.chromium.org/12529026/
Patch Set: Rebasing Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/wm/gestures/edge_gesture_handler.h ('k') | ash/wm/window_properties.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/gestures/edge_gesture_handler.cc
diff --git a/ash/wm/gestures/edge_gesture_handler.cc b/ash/wm/gestures/edge_gesture_handler.cc
index 9ba7ff3d0ae310ca7efde0662840d19340addd91..faf37285aeec4e1a7838ac265d0cfc9b081fa698 100644
--- a/ash/wm/gestures/edge_gesture_handler.cc
+++ b/ash/wm/gestures/edge_gesture_handler.cc
@@ -9,6 +9,8 @@
#include "ash/shelf/shelf_types.h"
#include "ash/shelf/shelf_widget.h"
#include "ash/shell.h"
+#include "ash/wm/property_util.h"
+#include "ui/aura/window.h"
#include "ui/base/events/event.h"
#include "ui/gfx/screen.h"
@@ -53,11 +55,9 @@ bool EdgeGestureHandler::ProcessGestureEvent(aura::Window* target,
case ui::ET_GESTURE_SCROLL_BEGIN:
return HandleEdgeGestureStart(target, event);
case ui::ET_GESTURE_SCROLL_UPDATE:
- if (ANY_FLAGS_SET(start_location_)) {
- if (DetermineGestureOrientation(event)) {
+ if (ANY_FLAGS_SET(start_location_))
+ if (DetermineGestureOrientation(event))
return HandleEdgeGestureUpdate(target, event);
- }
- }
break;
case ui::ET_GESTURE_SCROLL_END:
case ui::ET_SCROLL_FLING_START:
@@ -95,6 +95,29 @@ bool EdgeGestureHandler::HandleLauncherControl(const ui::GestureEvent& event) {
return false;
}
+bool EdgeGestureHandler::HandleImmersiveControl(aura::Window* target,
+ const ui::GestureEvent& event) {
+ // If not in immersive mode let the gesture pass through
+ if (!GetRootWindowController(target->GetRootWindow())->IsImmersiveMode())
+ return false;
+
+ switch (event.type()) {
+ case ui::ET_GESTURE_SCROLL_BEGIN:
+ return true;
+ case ui::ET_GESTURE_SCROLL_UPDATE:
+ GetRootWindowController(
+ target->GetRootWindow())->SetPendingImmersiveGesture(true);
+ break;
+ case ui::ET_GESTURE_SCROLL_END:
+ case ui::ET_SCROLL_FLING_START:
+ return true;
+ break;
+ default:
+ break;
+ }
+ return false;
+}
+
bool EdgeGestureHandler::HandleEdgeGestureStart(
aura::Window* target,
const ui::GestureEvent& event) {
@@ -102,8 +125,12 @@ bool EdgeGestureHandler::HandleEdgeGestureStart(
Shell::GetScreen()->GetDisplayNearestWindow(target).bounds();
orientation_ = EDGE_SCROLL_ORIENTATION_UNSET;
- if (GestureStartInEdgeArea(screen, event))
- return HandleLauncherControl(event);
+ if (GestureStartInEdgeArea(screen, event)) {
+ if (IS_FLAG_SET(start_location_, EDGE_START_TOP))
+ return HandleImmersiveControl(target, event);
+ else
+ return HandleLauncherControl(event);
+ }
return false;
}
@@ -122,6 +149,9 @@ bool EdgeGestureHandler::DetermineGestureOrientation(
bool EdgeGestureHandler::HandleEdgeGestureUpdate(
aura::Window* target,
const ui::GestureEvent& event) {
+ if (IsGestureInImmersiveOrientation(event))
+ return HandleImmersiveControl(target, event);
+
if (IsGestureInLauncherOrientation(event))
return HandleLauncherControl(event);
return false;
@@ -166,10 +196,6 @@ bool EdgeGestureHandler::IsGestureInLauncherOrientation(
ShelfLayoutManager* shelf =
Shell::GetPrimaryRootWindowController()->GetShelfLayoutManager();
switch (shelf->GetAlignment()) {
- case SHELF_ALIGNMENT_BOTTOM:
- if (orientation_ == EDGE_SCROLL_ORIENTATION_VERTICAL)
- return true;
- break;
case SHELF_ALIGNMENT_LEFT:
if (orientation_ == EDGE_SCROLL_ORIENTATION_HORIZONTAL)
return true;
@@ -178,15 +204,19 @@ bool EdgeGestureHandler::IsGestureInLauncherOrientation(
if (orientation_ == EDGE_SCROLL_ORIENTATION_HORIZONTAL)
return true;
break;
- case SHELF_ALIGNMENT_TOP:
- if (orientation_ == EDGE_SCROLL_ORIENTATION_VERTICAL)
- return true;
- break;
default:
break;
}
return false;
}
+bool EdgeGestureHandler::IsGestureInImmersiveOrientation(
+ const ui::GestureEvent& event) {
+ if (IS_FLAG_SET(start_location_, EDGE_START_TOP) &&
+ (orientation_ == EDGE_SCROLL_ORIENTATION_VERTICAL))
+ return true;
+ return false;
+}
+
} // namespace internal
} // namespace ash
« no previous file with comments | « ash/wm/gestures/edge_gesture_handler.h ('k') | ash/wm/window_properties.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698