diff options
author | Ben Murdoch <benm@google.com> | 2009-09-14 10:48:24 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2009-09-14 15:33:09 +0100 |
commit | b9daacb7513c5a42000285ad456cc614af1915c0 (patch) | |
tree | ea3e3f0dd774cc206abedbe21e10c48b706fdf56 /src/com/android | |
parent | 3bbb6caa3ceaec1106fe1de76066f5e1a186795e (diff) | |
download | packages_apps_Browser-b9daacb7513c5a42000285ad456cc614af1915c0.zip packages_apps_Browser-b9daacb7513c5a42000285ad456cc614af1915c0.tar.gz packages_apps_Browser-b9daacb7513c5a42000285ad456cc614af1915c0.tar.bz2 |
Add an options menu to the web site settings activity with just one option to clear all websites' storage/geolocation permissions.
Change-Id: Idbcf24f5340491e8d75353838c482bc2d5039da8
Diffstat (limited to 'src/com/android')
-rw-r--r-- | src/com/android/browser/WebsiteSettingsActivity.java | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/com/android/browser/WebsiteSettingsActivity.java b/src/com/android/browser/WebsiteSettingsActivity.java index 577fc1c..fc72b62 100644 --- a/src/com/android/browser/WebsiteSettingsActivity.java +++ b/src/com/android/browser/WebsiteSettingsActivity.java @@ -29,6 +29,9 @@ import android.provider.Browser; import android.util.Log; import android.view.KeyEvent; import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.webkit.GeolocationPermissions; @@ -433,4 +436,41 @@ public class WebsiteSettingsActivity extends ListActivity { setListAdapter(mAdapter); getListView().setOnItemClickListener(mAdapter); } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + MenuInflater inflater = getMenuInflater(); + inflater.inflate(R.menu.websitesettings, menu); + return true; + } + + @Override + public boolean onPrepareOptionsMenu(Menu menu) { + // If we aren't listing any sites hide the clear all button (and hence the menu). + return mAdapter.getCount() > 0; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case R.id.website_settings_menu_clear_all: + // Show the prompt to clear all origins of their data and geolocation permissions. + new AlertDialog.Builder(this) + .setTitle(R.string.website_settings_clear_all_dialog_title) + .setMessage(R.string.website_settings_clear_all_dialog_message) + .setPositiveButton(R.string.website_settings_clear_all_dialog_ok_button, + new AlertDialog.OnClickListener() { + public void onClick(DialogInterface dlg, int which) { + WebStorage.getInstance().deleteAllData(); + GeolocationPermissions.getInstance().clearAll(); + mAdapter.populateOrigins(); + mAdapter.notifyDataSetChanged(); + }}) + .setNegativeButton(R.string.website_settings_clear_all_dialog_cancel_button, null) + .setIcon(android.R.drawable.ic_dialog_alert) + .show(); + return true; + } + return false; + } } |