Chromium Code Reviews| 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 |
| index eb79f9908e34819884cbdef862b6224f8b77879c..1c1dc9ba34df744261d928e98b894587241ae017 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/infobar/DataReductionProxyInfoBar.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/infobar/DataReductionProxyInfoBar.java |
| @@ -4,10 +4,6 @@ |
| 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; |
| /** |
| @@ -24,38 +20,52 @@ public class DataReductionProxyInfoBar extends ConfirmInfoBar { |
| * Launch a data reduction proxy {@link InfoBar} with the specified title and link |
| * text. Clicking the link will open the specified settings page. |
| * @param webContents The {@link WebContents} in which to open the {@link InfoBar}. |
| - * @param settingsClassName. The settings class to open. |
| + * @param settingsClassName The settings class to open. |
| * @param drpSettingsClassName The {@link PreferenceActivity} fragment to show. |
| * @param title The text to display in the {@link InfoBar}. |
| * @param linkText The text to display in the link in the {@link InfoBar}. |
| + * @param linkUrl The URL to be loaded when the link text is clicked. |
| */ |
| public static void launch(WebContents webContents, |
| String settingsClassName, |
| String drpSettingsClassName, |
| String title, |
| - String linkText) { |
| + String linkText, |
| + String linkUrl) { |
| sSettingsClassName = settingsClassName; |
| sDataReductionProxySettingsClassName = drpSettingsClassName; |
| sTitle = title; |
| sLinkText = linkText; |
| - DataReductionProxyInfoBarDelegate.launch(webContents); |
| + DataReductionProxyInfoBarDelegate.launch(webContents, linkUrl); |
| } |
| + /** |
| + * Callers should now pass a linkUrl, which is loaded when the user clicks on linkText. See |
| + * {@link #launch} above. See http://crbug.com/383988. |
| + */ |
| + @Deprecated |
| + public static void launch(WebContents webContents, |
| + String settingsClassName, |
| + String drpSettingsClassName, |
| + String title, |
| + String linkText) { |
| + launch(webContents, settingsClassName, drpSettingsClassName, title, linkText, ""); |
| + } |
| + |
|
Ted C
2014/09/18 00:40:21
remove this extra blank line
bengr
2014/09/18 18:01:14
Done.
|
| + |
| DataReductionProxyInfoBar(long nativeInfoBar, int iconDrawableId) { |
| 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); |
| + public void createContent(InfoBarLayout layout) { |
| + layout.setButtons(sLinkText, null, null); |
|
Ted C
2014/09/18 00:40:21
I think you can just use setButtons(sLinkText, nul
bengr
2014/09/18 18:01:15
Done.
|
| + } |
| + |
| + @Override |
| + public void onButtonClicked(boolean isPrimaryButton) { |
| + if (!isPrimaryButton) return; |
| + onLinkClicked(); |
| } |
| } |