Index: chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaSessionAction.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaSessionAction.java b/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaSessionAction.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..db3b4fa007dc17e3087568faa12f862118b69518 |
--- /dev/null |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaSessionAction.java |
@@ -0,0 +1,45 @@ |
+// Copyright 2016 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.chrome.browser.media.ui; |
+ |
+/** |
+ * MediaSession action kind enum corresponding to blink::mojom::MediaSessionAction. |
+ */ |
+public enum MediaSessionAction { |
+ ACTION_PLAY(0), |
+ ACTION_PAUSE(1), |
+ ACTION_PLAY_PAUSE(2), |
+ ACTION_PREVIOUS_TRACK(3), |
+ ACTION_NEXT_TRACK(4), |
+ ACTION_SEEK_FORWARD(5), |
+ ACTION_SEEK_BACKWARD(6); |
+ |
+ private final int mValue; |
+ |
+ /** |
+ * Converts an int to its equivalent MediaSessionAction. |
+ * @param i The integer to convert. |
+ * @return The enum that |i| corresponds to. |
+ */ |
+ public static MediaSessionAction fromInt(int i) { |
+ for (MediaSessionAction type : MediaSessionAction.values()) { |
+ if (type.getValue() == i) { |
+ return type; |
+ } |
+ } |
+ return null; |
+ } |
+ |
+ /** |
+ * @return The integer the enum corresponds to. |
+ */ |
+ public int getValue() { |
+ return mValue; |
+ } |
+ |
+ private MediaSessionAction(int value) { |
+ mValue = value; |
+ } |
+} |