Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/datausage/DataUseTabUIManager.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/datausage/DataUseTabUIManager.java b/chrome/android/java/src/org/chromium/chrome/browser/datausage/DataUseTabUIManager.java |
| index c353b1fbfe7cc347506f2d2258713b2197a2bd40..4b89a0bf2e0153e6567e23134475d82fbb4d38be 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/datausage/DataUseTabUIManager.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/datausage/DataUseTabUIManager.java |
| @@ -60,6 +60,33 @@ public class DataUseTabUIManager { |
| } |
| /** |
| + * Notifies that the user clicked "Continue" when the dialog box warning about exiting data use |
| + * was shown. |
| + * |
| + * @param tab The tab on which the dialog box was shown. |
| + */ |
| + public static void userClickedContinueOnDialogBox(Tab tab) { |
| + nativeUserClickedContinueOnDialogBox( |
| + SessionTabHelper.sessionIdForTab(tab.getWebContents()), tab.getProfile()); |
| + } |
| + |
| + /** |
| + * Returns true if data use tracking is currently active on {@link tab} but will stop if the |
| + * navigation continues. |
|
megjablon
2015/12/29 00:38:24
Add "Should only be called before the navigation s
tbansal1
2015/12/29 01:18:41
Done.
|
| + * |
| + * @param tab The tab that is being queried for data use tracking. |
| + * @param pageTransitionType transition type of the navigation |
| + * @param packageName package name of the app package that started this navigation. |
| + * @return true If {@link tab} is currently tracked but would stop if the navigation were to |
| + * continue. |
| + */ |
| + public static boolean wouldDataUseTrackingEnd( |
| + Tab tab, String url, int pageTransitionType, String packageName) { |
| + return nativeWouldDataUseTrackingEnd(SessionTabHelper.sessionIdForTab(tab.getWebContents()), |
| + url, pageTransitionType, packageName, tab.getProfile()); |
| + } |
| + |
| + /** |
| * Returns true if data use tracking has ended within a Tab. When data use tracking has |
| * ended, returns true only once to signify the ended event. |
| * |
| @@ -99,7 +126,8 @@ public class DataUseTabUIManager { |
| public static boolean shouldOverrideUrlLoading(Activity activity, |
| final Tab tab, final String url, final int pageTransitionType, |
| final String referrerUrl) { |
| - if (!getOptedOutOfDataUseDialog(activity) && checkDataUseTrackingEnded(tab)) { |
| + if (!getOptedOutOfDataUseDialog(activity) |
| + && wouldDataUseTrackingEnd(tab, url, pageTransitionType, "")) { |
|
megjablon
2015/12/29 00:38:24
Why have the package name param if you're just usi
tbansal1
2015/12/29 01:18:41
Good point. Done.
|
| startDataUseDialog(activity, tab, url, pageTransitionType, referrerUrl); |
| return true; |
| } |
| @@ -147,6 +175,7 @@ public class DataUseTabUIManager { |
| } |
| tab.loadUrl(loadUrlParams); |
| recordDataUseUIAction(DataUseUIActions.DIALOG_CONTINUE_CLICKED); |
| + userClickedContinueOnDialogBox(tab); |
| } |
| }) |
| .setNegativeButton(R.string.cancel, new OnClickListener() { |
| @@ -199,6 +228,9 @@ public class DataUseTabUIManager { |
| private static native boolean nativeCheckDataUseTrackingStarted(int tabId, Profile profile); |
| private static native boolean nativeCheckDataUseTrackingEnded(int tabId, Profile profile); |
| + private static native void nativeUserClickedContinueOnDialogBox(int tabId, Profile profile); |
| + private static native boolean nativeWouldDataUseTrackingEnd( |
| + int tabId, String url, int pageTransitionType, String packageName, Profile jprofile); |
| private static native void nativeOnCustomTabInitialNavigation(int tabID, String packageName, |
| String url, Profile profile); |
| } |