Presubmit: Warn about using XSelectInput

New code running in the browser process should always use
ui::XScopedEventSelector instead of XSelectInput.

BUG=634084

Review-Url: https://codereview.chromium.org/2316373003
Cr-Commit-Position: refs/heads/master@{#418653}
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index e2e0423..0076836 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -164,6 +164,21 @@
       (),
     ),
     (
+      r'XSelectInput|CWEventMask|XCB_CW_EVENT_MASK',
+      (
+       'Chrome clients wishing to select events on X windows should use',
+       'ui::XScopedEventSelector.  It is safe to ignore this warning only if',
+       'you are selecting events from the GPU process, or if you are using',
+       'an XDisplay other than gfx::GetXDisplay().',
+      ),
+      True,
+      (
+        r"^ui[\\\/]gl[\\\/].*\.cc$",
+        r"^media[\\\/]gpu[\\\/].*\.cc$",
+        r"^gpu[\\\/].*\.cc$",
+      ),
+    ),
+    (
       'ScopedAllowIO',
       (
        'New code should not use ScopedAllowIO. Post a task to the blocking',