Index: content/public/android/java/src/org/chromium/content/browser/accessibility/captioning/CaptioningBridgeFactory.java |
diff --git a/content/public/android/java/src/org/chromium/content/browser/accessibility/captioning/CaptioningBridgeFactory.java b/content/public/android/java/src/org/chromium/content/browser/accessibility/captioning/CaptioningBridgeFactory.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..69372c4b142eb8983000d8ab651037b32a039685 |
--- /dev/null |
+++ b/content/public/android/java/src/org/chromium/content/browser/accessibility/captioning/CaptioningBridgeFactory.java |
@@ -0,0 +1,29 @@ |
+// 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. |
+ |
+package org.chromium.content.browser.accessibility.captioning; |
+ |
+import android.os.Build; |
+ |
+import org.chromium.content.browser.ContentViewCore; |
+ |
+/** |
+ * Returns the best captions bridge available. If the API level is lower than KitKat, a no-op |
+ * bridge is returned since those systems didn't support this functionality. |
+ */ |
+public class CaptioningBridgeFactory { |
+ /** |
+ * Create and return the best SystemCaptioningBridge available. |
+ * |
+ * @param contentViewCore the ContentViewCore to create the bridge with |
+ * @return the best SystemCaptioningBridge available. |
+ */ |
+ public static SystemCaptioningBridge create(ContentViewCore contentViewCore) { |
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { |
+ return new KitKatCaptioningBridge(contentViewCore); |
+ } |
+ // On older systems, return a CaptioningBridge that does nothing. |
+ return new EmptyCaptioningBridge(); |
+ } |
+} |