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

Unified Diff: ui/events/gesture_detection/gesture_detection_switches.cc

Issue 1049383003: Postpone rail application for touch scrolling - chrome side. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
Index: ui/events/gesture_detection/gesture_detection_switches.cc
diff --git a/ui/events/gesture_detection/gesture_detection_switches.cc b/ui/events/gesture_detection/gesture_detection_switches.cc
new file mode 100644
index 0000000000000000000000000000000000000000..3404de5ac80ec70652b2fb4284a4e546b35f450a
--- /dev/null
+++ b/ui/events/gesture_detection/gesture_detection_switches.cc
@@ -0,0 +1,45 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/events/gesture_detection/gesture_detection_switches.h"
+
+#include "base/command_line.h"
+#include "base/logging.h"
+
+namespace switches {
+
+// Postpone the application of scroll rails until after gesture
+// recognition. This will result in views logic seeing unrailed
+// scrolls. See crbug.com/469789 for details, and crbug.com/472223 for
+// the bug to remove this flag.
+const char kScrollRailsPostponed[] = "scroll-rails-postponed";
+const char kScrollRailsPostponedAuto[] = "auto";
+const char kScrollRailsPostponedEnabled[] = "enabled";
+const char kScrollRailsPostponedDisabled[] = "disabled";
+
+} // namespace switches
+
+namespace ui {
+
+bool PostponeRailApplication() {
+ const base::CommandLine& command_line =
+ *base::CommandLine::ForCurrentProcess();
+ const std::string scroll_rails_postponed_switch =
+ command_line.HasSwitch(switches::kScrollRailsPostponed) ?
+ command_line.GetSwitchValueASCII(switches::kScrollRailsPostponed) :
+ switches::kScrollRailsPostponedAuto;
+ bool default_value = true;
+
+ if (scroll_rails_postponed_switch == switches::kScrollRailsPostponedEnabled)
+ return true;
+ if (scroll_rails_postponed_switch == switches::kScrollRailsPostponedDisabled)
+ return false;
+ if (scroll_rails_postponed_switch == switches::kScrollRailsPostponedAuto)
+ return default_value;
+ LOG(ERROR) << "Invalid --scroll-rails-postponed option: "
+ << scroll_rails_postponed_switch;
+ return default_value;
+}
+
+} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698