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

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

Issue 384853002: Add notification of data reduction proxy field trial (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/DataReductionProxyInfoBar.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/infobar/DataReductionProxyInfoBar.java b/chrome/android/java/src/org/chromium/chrome/browser/infobar/DataReductionProxyInfoBar.java
new file mode 100644
index 0000000000000000000000000000000000000000..7c32cdf22c25bb22edc602b17c02c5265f1361aa
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/infobar/DataReductionProxyInfoBar.java
@@ -0,0 +1,52 @@
+// 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 android.content.Context;
+import android.content.Intent;
+import android.preference.PreferenceActivity;
+
+import org.chromium.content_public.browser.WebContents;
+
+/**
+ * Generates an InfoBar for the data reduction proxy that contains a message and a link to the
+ * data reduction proxy settings menu.
+ */
+public class DataReductionProxyInfoBar extends ConfirmInfoBar {
+ static String sSettingsClassName;
gone 2014/07/11 21:50:15 private static where appropriate also make sure t
bengr 2014/07/11 23:02:24 Done.
+ static String sDataReductionProxySettingsClassName;
+ static String sTitle;
+ static String sLinkText;
+
+ public static void launch(WebContents webContents,
gone 2014/07/11 21:50:15 Little odd that we're setting the static variables
bengr 2014/07/11 23:02:24 Right. I agree it's a little odd. The alternative
+ String settingsClassName,
+ String drpSettingsClassName,
+ String title,
+ String linkText) {
+ sSettingsClassName = settingsClassName;
+ sDataReductionProxySettingsClassName = drpSettingsClassName;
+ sTitle = title;
+ sLinkText = linkText;
+ DataReductionProxyInfoBarDelegate.launch(webContents);
+ }
+
+ public DataReductionProxyInfoBar(long nativeInfoBar, int iconDrawableId) {
gone 2014/07/11 21:50:15 should this constructor be public?
bengr 2014/07/11 23:02:24 Done.
+ super(nativeInfoBar, null, iconDrawableId, sTitle,
+ sLinkText, null, null);
+ }
+
+ @Override
+ public void onLinkClicked() {
+ Context context = getContext();
+ if (context == null) return;
+ Intent intent = new Intent(Intent.ACTION_VIEW);
+ intent.setClassName(context, sSettingsClassName);
+ intent.setFlags(
+ Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_SINGLE_TOP);
+ intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT,
+ sDataReductionProxySettingsClassName);
+ context.startActivity(intent);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698