OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 package org.chromium.chrome.browser.infobar; |
| 6 |
| 7 import org.chromium.base.annotations.CalledByNative; |
| 8 import org.chromium.chrome.R; |
| 9 import org.chromium.chrome.browser.ResourceId; |
| 10 |
| 11 /** |
| 12 * After user proceed through Safe Browsing warning interstitials that are displ
ayed when the site |
| 13 * ahead contains deceptive embedded content, the infobar appears, it explains t
he user that some |
| 14 * subresources were filtered and presents the "Detals" link. If the link is pre
ssed full infobar |
| 15 * with detailed text and the action buttons appears, it gives the user an abili
ty to reload the |
| 16 * page with the content we've blocked previously. |
| 17 */ |
| 18 public class SubresourceFilterExperimentalInfoBar extends ConfirmInfoBar { |
| 19 private final String mMessage; |
| 20 private final String mFollowUpMessage; |
| 21 private final String mOKButtonText; |
| 22 private final String mReloadButtonText; |
| 23 private boolean mShowExplanation; |
| 24 |
| 25 @CalledByNative |
| 26 private static InfoBar show(int enumeratedIconId, String message, String oKB
uttonText, |
| 27 String reloadButtonText, String followUpMessage) { |
| 28 return new SubresourceFilterExperimentalInfoBar( |
| 29 ResourceId.mapToDrawableId(enumeratedIconId), message, oKButtonT
ext, |
| 30 reloadButtonText, followUpMessage); |
| 31 } |
| 32 |
| 33 private SubresourceFilterExperimentalInfoBar(int iconDrawbleId, String messa
ge, |
| 34 String oKButtonText, String reloadButtonText, String followUpMessage
) { |
| 35 super(iconDrawbleId, null, message, null, null, null); //, oKButtonText,
reloadButtonText); |
| 36 mFollowUpMessage = followUpMessage; |
| 37 mMessage = message; |
| 38 mOKButtonText = oKButtonText; |
| 39 mReloadButtonText = reloadButtonText; |
| 40 } |
| 41 |
| 42 @Override |
| 43 public void createContent(InfoBarLayout layout) { |
| 44 super.createContent(layout); |
| 45 if (mShowExplanation) { |
| 46 layout.setMessage(mFollowUpMessage); |
| 47 setButtons(layout, mOKButtonText, mReloadButtonText); |
| 48 } else { |
| 49 String link = layout.getContext().getString(R.string.details_link); |
| 50 layout.setMessage(mMessage); |
| 51 layout.setMessageLinkText(link); |
| 52 } |
| 53 } |
| 54 |
| 55 @Override |
| 56 public void onLinkClicked() { |
| 57 mShowExplanation = true; |
| 58 replaceView(createView()); |
| 59 } |
| 60 } |
OLD | NEW |