summaryrefslogtreecommitdiffstats
path: root/src/com/android/browser/BrowserHistoryPage.java
diff options
context:
space:
mode:
authorLeon Scroggins <scroggo@google.com>2010-01-11 10:20:53 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2010-01-11 10:20:53 -0800
commit87ec20cb906d9728de80471cf6b536c74237b0fc (patch)
treea6039be1c77c109602d5537b8d4faf2060e1e6e9 /src/com/android/browser/BrowserHistoryPage.java
parent15b8ec6b226f4d57307716e1f495e10a91f8cbf4 (diff)
parent58c3d985682495d6563cafe21fa19a47ef349971 (diff)
downloadpackages_apps_Browser-87ec20cb906d9728de80471cf6b536c74237b0fc.tar.gz
packages_apps_Browser-87ec20cb906d9728de80471cf6b536c74237b0fc.tar.bz2
packages_apps_Browser-87ec20cb906d9728de80471cf6b536c74237b0fc.zip
am 58c3d985: am fde9746a: Clear parent/child tab relationships when clearing history.
Merge commit '58c3d985682495d6563cafe21fa19a47ef349971' * commit '58c3d985682495d6563cafe21fa19a47ef349971': Clear parent/child tab relationships when clearing history.
Diffstat (limited to 'src/com/android/browser/BrowserHistoryPage.java')
-rw-r--r--src/com/android/browser/BrowserHistoryPage.java24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/com/android/browser/BrowserHistoryPage.java b/src/com/android/browser/BrowserHistoryPage.java
index 57ea87990..0c2bfae75 100644
--- a/src/com/android/browser/BrowserHistoryPage.java
+++ b/src/com/android/browser/BrowserHistoryPage.java
@@ -131,7 +131,12 @@ public class BrowserHistoryPage extends ExpandableListActivity {
false);
CombinedBookmarkHistoryActivity.getIconListenerSet()
.addListener(mIconReceiver);
-
+ Activity parent = getParent();
+ if (null == parent
+ || !(parent instanceof CombinedBookmarkHistoryActivity)) {
+ throw new AssertionError("history page can only be viewed as a tab"
+ + "in CombinedBookmarkHistoryActivity");
+ }
// initialize the result to canceled, so that if the user just presses
// back then it will have the correct result
setResultToParent(RESULT_CANCELED, null);
@@ -162,9 +167,11 @@ public class BrowserHistoryPage extends ExpandableListActivity {
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.clear_history_menu_id:
- // FIXME: Need to clear the tab control in browserActivity
- // as well
Browser.clearHistory(getContentResolver());
+ // BrowserHistoryPage is always a child of
+ // CombinedBookmarkHistoryActivity
+ ((CombinedBookmarkHistoryActivity) getParent())
+ .removeParentChildRelationShips();
mAdapter.refreshData();
return true;
@@ -272,13 +279,12 @@ public class BrowserHistoryPage extends ExpandableListActivity {
return false;
}
- // This Activity is generally a sub-Activity of CombinedHistoryActivity. In
- // that situation, we need to pass our result code up to our parent.
- // However, if someone calls this Activity directly, then this has no
- // parent, and it needs to set it on itself.
+ // This Activity is always a sub-Activity of
+ // CombinedBookmarkHistoryActivity. Therefore, we need to pass our
+ // result code up to our parent.
private void setResultToParent(int resultCode, Intent data) {
- Activity a = getParent() == null ? this : getParent();
- a.setResult(resultCode, data);
+ ((CombinedBookmarkHistoryActivity) getParent()).setResultFromChild(
+ resultCode, data);
}
private class ChangeObserver extends ContentObserver {