summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Kolb <kolby@google.com>2010-08-10 12:49:33 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-08-10 12:49:33 -0700
commit0119718346454292bc13ccc77109376a8e59e78c (patch)
tree19ecc46ddf93122bc757860955d2cadb9df856b9
parente2ce23d48063017d163073a6c00bedae92e1dd14 (diff)
parent68792c84eded7f83e2f086d3efe81f9cfc07f9c3 (diff)
downloadpackages_apps_Browser-0119718346454292bc13ccc77109376a8e59e78c.zip
packages_apps_Browser-0119718346454292bc13ccc77109376a8e59e78c.tar.gz
packages_apps_Browser-0119718346454292bc13ccc77109376a8e59e78c.tar.bz2
Merge "New tab flow through Bookmarks/History screen"
-rw-r--r--src/com/android/browser/BrowserActivity.java27
-rw-r--r--src/com/android/browser/CombinedBookmarkHistoryActivity.java15
-rw-r--r--src/com/android/browser/TabBar.java2
-rw-r--r--src/com/android/browser/TitleBarXLarge.java3
4 files changed, 33 insertions, 14 deletions
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java
index 40ada94..d6f7177 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -1367,7 +1367,7 @@ public class BrowserActivity extends Activity
break;
case R.id.bookmarks_menu_id:
- bookmarksOrHistoryPicker(false);
+ bookmarksOrHistoryPicker(false, false);
break;
case R.id.active_tabs_menu_id:
@@ -1451,7 +1451,7 @@ public class BrowserActivity extends Activity
break;
case R.id.classic_history_menu_id:
- bookmarksOrHistoryPicker(true);
+ bookmarksOrHistoryPicker(true, false);
break;
case R.id.title_bar_share_page_url:
@@ -1752,7 +1752,7 @@ public class BrowserActivity extends Activity
new MenuItem.OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
final Tab parent = mTabControl.getCurrentTab();
- final Tab newTab = openTab(extra);
+ final Tab newTab = openTab(extra, false);
if (newTab != parent) {
parent.addChildTab(newTab);
}
@@ -1895,8 +1895,8 @@ public class BrowserActivity extends Activity
}
}
- private Tab openTab(String url) {
- if (mSettings.openInBackground()) {
+ private Tab openTab(String url, boolean forceForeground) {
+ if (mSettings.openInBackground() && !forceForeground) {
Tab t = mTabControl.createNewTab();
if (t != null) {
WebView view = t.getWebView();
@@ -2239,7 +2239,7 @@ public class BrowserActivity extends Activity
return true;
} else if (mCustomView == null && mActiveTabsPage == null
&& event.isLongPress()) {
- bookmarksOrHistoryPicker(true);
+ bookmarksOrHistoryPicker(true, false);
return true;
}
break;
@@ -2789,7 +2789,7 @@ public class BrowserActivity extends Activity
}
if (mMenuIsDown) {
- openTab(url);
+ openTab(url, false);
closeOptionsMenu();
return true;
}
@@ -3732,10 +3732,12 @@ public class BrowserActivity extends Activity
String data = intent.getAction();
Bundle extras = intent.getExtras();
if (extras != null && extras.getBoolean("new_window", false)) {
- openTab(data);
+ openTab(data, false);
+ } else if ((extras != null) &&
+ extras.getBoolean(CombinedBookmarkHistoryActivity.NEWTAB_MODE)) {
+ openTab(data, true);
} else {
- final Tab currentTab =
- mTabControl.getCurrentTab();
+ final Tab currentTab = mTabControl.getCurrentTab();
dismissSubWindow(currentTab);
if (data != null && data.length() != 0) {
loadUrl(getTopWindow(), data);
@@ -3842,7 +3844,7 @@ public class BrowserActivity extends Activity
* @param startWithHistory If true, open starting on the history tab.
* Otherwise, start with the bookmarks tab.
*/
- /* package */ void bookmarksOrHistoryPicker(boolean startWithHistory) {
+ /* package */ void bookmarksOrHistoryPicker(boolean startWithHistory, boolean newTabMode) {
WebView current = mTabControl.getCurrentWebView();
if (current == null) {
return;
@@ -3877,6 +3879,9 @@ public class BrowserActivity extends Activity
intent.putExtra(CombinedBookmarkHistoryActivity.STARTING_TAB,
CombinedBookmarkHistoryActivity.HISTORY_TAB);
}
+ if (newTabMode) {
+ intent.putExtra(CombinedBookmarkHistoryActivity.NEWTAB_MODE, true);
+ }
startActivityForResult(intent, COMBO_PAGE);
}
diff --git a/src/com/android/browser/CombinedBookmarkHistoryActivity.java b/src/com/android/browser/CombinedBookmarkHistoryActivity.java
index 194956f..64e8673 100644
--- a/src/com/android/browser/CombinedBookmarkHistoryActivity.java
+++ b/src/com/android/browser/CombinedBookmarkHistoryActivity.java
@@ -48,11 +48,18 @@ public class CombinedBookmarkHistoryActivity extends TabActivity
*/
private int mResultCode;
+ /**
+ * Flag to inform the browser to force the result to open in a new tab.
+ */
+ private boolean mNewTabMode;
+
/* package */ static String BOOKMARKS_TAB = "bookmark";
/* package */ static String VISITED_TAB = "visited";
/* package */ static String HISTORY_TAB = "history";
/* package */ static String STARTING_TAB = "tab";
+ final static String NEWTAB_MODE = "newtab_mode";
+
static class IconListenerSet implements IconListener {
// Used to store favicons as we get them from the database
// FIXME: We use a different method to get the Favicons in
@@ -99,6 +106,10 @@ public class CombinedBookmarkHistoryActivity extends TabActivity
Bundle extras = getIntent().getExtras();
+ if (extras != null) {
+ mNewTabMode = extras.getBoolean(NEWTAB_MODE);
+ }
+
Intent bookmarksIntent = new Intent(this, BrowserBookmarksPage.class);
if (extras != null) {
bookmarksIntent.putExtras(extras);
@@ -186,6 +197,10 @@ public class CombinedBookmarkHistoryActivity extends TabActivity
if (mResultData == null) mResultData = new Intent();
mResultData.putExtra(Intent.EXTRA_TEXT, mExtraData);
}
+ if (mNewTabMode) {
+ if (mResultData == null) mResultData = new Intent();
+ mResultData.putExtra(NEWTAB_MODE, true);
+ }
setResult(mResultCode, mResultData);
super.finish();
}
diff --git a/src/com/android/browser/TabBar.java b/src/com/android/browser/TabBar.java
index f73185f..da18614 100644
--- a/src/com/android/browser/TabBar.java
+++ b/src/com/android/browser/TabBar.java
@@ -116,7 +116,7 @@ public class TabBar extends LinearLayout
mBrowserActivity.showFakeTitleBar();
mUserRequestedUrlbar = true;
} else if (mNewButton == view) {
- mBrowserActivity.openTabToHomePage();
+ mBrowserActivity.bookmarksOrHistoryPicker(false, true);
} else if (mTabs.getSelectedTab() == view) {
mBrowserActivity.showFakeTitleBar();
mTitleBar.requestUrlInputFocus();
diff --git a/src/com/android/browser/TitleBarXLarge.java b/src/com/android/browser/TitleBarXLarge.java
index 4e65375..c1fdee3 100644
--- a/src/com/android/browser/TitleBarXLarge.java
+++ b/src/com/android/browser/TitleBarXLarge.java
@@ -104,8 +104,7 @@ public class TitleBarXLarge extends TitleBarBase
} else if (mMenu == v) {
mBrowserActivity.openOptionsMenu();
} else if (mAllButton == v) {
- // TODO: Show the new bookmarks/windows view.
- mBrowserActivity.bookmarksOrHistoryPicker(false);
+ mBrowserActivity.bookmarksOrHistoryPicker(false, false);
} else if (mSearchButton == v) {
search();
} else if (mStopButton == v) {