Index: content/public/android/java/src/org/chromium/content/browser/ViewUtils.java |
diff --git a/content/public/android/java/src/org/chromium/content/browser/ViewUtils.java b/content/public/android/java/src/org/chromium/content/browser/ViewUtils.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..44260621121e7c2ca56e20f4ed9a41ffca19ca0f |
--- /dev/null |
+++ b/content/public/android/java/src/org/chromium/content/browser/ViewUtils.java |
@@ -0,0 +1,24 @@ |
+// Copyright 2017 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. |
+ |
+package org.chromium.content.browser; |
+ |
+import android.view.View; |
+ |
+/** |
+ * A utility class that has helper methods for Android view. |
+ */ |
+public final class ViewUtils { |
+ // Prevent instantiation. |
+ private ViewUtils() {} |
+ |
+ /** |
+ * @return {@code true} if the given view has a focus. |
+ */ |
+ public static boolean hasFocus(View view) { |
+ // If the container view is not focusable, we consider it always focused from |
+ // Chromium's point of view. |
+ return !view.isFocusable() ? true : view.hasFocus(); |
+ } |
+} |