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; | |
gone
2017/03/24 21:16:13
use a regular boolean instead of Boolean
melandory
2017/03/28 13:43:26
Done.
| |
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 mShowExplanation = false; | |
gone
2017/03/24 21:16:13
this is false by default in Java
melandory
2017/03/28 13:43:26
Done.
| |
41 } | |
42 | |
43 @Override | |
44 public void createContent(InfoBarLayout layout) { | |
45 super.createContent(layout); | |
46 if (mShowExplanation) { | |
47 layout.setMessage(mFollowUpMessage); | |
48 setButtons(layout, mOKButtonText, mReloadButtonText); | |
49 | |
gone
2017/03/24 21:16:13
nit: remove extra newline
melandory
2017/03/28 13:43:26
Done.
| |
50 } else { | |
51 String link = layout.getContext().getString(R.string.subresource_fil ter_details_link); | |
52 layout.setMessage(mMessage); | |
53 layout.setMessageLinkText(link); | |
54 } | |
55 } | |
56 | |
57 @Override | |
58 public void onLinkClicked() { | |
59 mShowExplanation = true; | |
60 replaceView(createView()); | |
61 } | |
62 } | |
OLD | NEW |