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 |