Skip to content

Commit

Permalink
[WebLayer] Add option to WebLayer shell to clear browsing data
Browse files Browse the repository at this point in the history
This is useful for testing any features that may need browsing data
cleared.

Change-Id: I5dfdcb90bc1f0ce03799da4eca71965bfd6dd398
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2283259
Reviewed-by: Scott Violet <sky@chromium.org>
Commit-Queue: Clark DuVall <cduvall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#785594}
  • Loading branch information
clarkduvall authored and Commit Bot committed Jul 7, 2020
1 parent 6567577 commit 6e95a74
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions weblayer/shell/android/shell_apk/res/menu/app_menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@
android:title="Site Settings" />
<item android:id="@+id/translate_menu_id"
android:title="Translate" />
<item android:id="@+id/clear_browsing_data_menu_id"
android:title="Clear all browsing data" />
</menu>
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import android.widget.PopupMenu;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.ViewSwitcher;

import androidx.fragment.app.Fragment;
Expand All @@ -37,6 +38,7 @@
import org.chromium.base.CommandLine;
import org.chromium.base.IntentUtils;
import org.chromium.weblayer.Browser;
import org.chromium.weblayer.BrowsingDataType;
import org.chromium.weblayer.ContextMenuParams;
import org.chromium.weblayer.ErrorPageCallback;
import org.chromium.weblayer.FindInPageCallback;
Expand Down Expand Up @@ -227,6 +229,16 @@ protected void onCreate(final Bundle savedInstanceState) {
return true;
}

if (item.getItemId() == R.id.clear_browsing_data_menu_id) {
mProfile.clearBrowsingData(new int[] {BrowsingDataType.COOKIES_AND_SITE_DATA,
BrowsingDataType.CACHE},
() -> {
Toast.makeText(getApplicationContext(), "Data cleared!",
Toast.LENGTH_SHORT)
.show();
});
}

return false;
});
popup.show();
Expand Down

0 comments on commit 6e95a74

Please sign in to comment.