Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4608)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/infobar/DataReductionProxyInfoBarDelegate.java

Issue 384853002: Add notification of data reduction proxy field trial (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/infobar/DataReductionProxyInfoBarDelegate.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/infobar/DataReductionProxyInfoBarDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/infobar/DataReductionProxyInfoBarDelegate.java
new file mode 100644
index 0000000000000000000000000000000000000000..4cbbd6ff6ac373290524d8a4434c2410f0e1a218
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/infobar/DataReductionProxyInfoBarDelegate.java
@@ -0,0 +1,47 @@
+// Copyright 2014 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.infobar;
+
+import org.chromium.base.CalledByNative;
+import org.chromium.chrome.browser.ResourceId;
+import org.chromium.content_public.browser.WebContents;
+
+/**
+ * Provides JNI methods for DataReductionProxyInfoBars.
+ */
+public class DataReductionProxyInfoBarDelegate {
+ /**
+ * Launches the {@link InfoBar}.
+ * @param webContents The {@link WebContents} in which to laucnh the {@link InfoBar}.
+ */
+ static void launch(WebContents webContents) {
+ nativeLaunch(webContents);
+ }
+
+ private DataReductionProxyInfoBarDelegate() {
+ }
+
+ @CalledByNative
+ public static DataReductionProxyInfoBarDelegate create() {
+ return new DataReductionProxyInfoBarDelegate();
+ }
+
+ /**
+ * Creates and begins the process for showing a DataReductionProxyInfoBarDelegate.
+ * @param nativeInfoBar Pointer to the C++ InfoBar corresponding to the Java InfoBar.
+ * @param enumeratedIconId ID corresponding to the icon that will be shown for the InfoBar.
+ * The ID must have been mapped using the ResourceMapper class before
+ * passing it to this function.
+ */
+ @CalledByNative
+ InfoBar showDataReductionProxyInfoBar(long nativeInfoBar, int enumeratedIconId) {
+ int drawableId = ResourceId.mapToDrawableId(enumeratedIconId);
+ DataReductionProxyInfoBar infoBar = new DataReductionProxyInfoBar(
+ nativeInfoBar, drawableId);
+ return infoBar;
+ }
+
+ protected static native void nativeLaunch(WebContents webContents);
+}

Powered by Google App Engine
This is Rietveld 408576698