Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/history/HistoryManagerUtils.java

Issue 2552353002: [Android History] Add basic tablet support (Closed)
Patch Set: Address dfalcantara@ comments Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/history/HistoryManagerUtils.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryManagerUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryManagerUtils.java
index 906c445203c26bfe40752dfe61d63e364eb942e7..2e61b311a65eb855f504e59668367a9cc8f6799c 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryManagerUtils.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryManagerUtils.java
@@ -5,12 +5,18 @@
package org.chromium.chrome.browser.history;
import android.app.Activity;
+import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import org.chromium.base.CommandLine;
+import org.chromium.base.ContextUtils;
import org.chromium.chrome.browser.IntentHandler;
+import org.chromium.chrome.browser.UrlConstants;
+import org.chromium.chrome.browser.tab.Tab;
import org.chromium.components.variations.VariationsAssociatedData;
+import org.chromium.content_public.browser.LoadUrlParams;
+import org.chromium.ui.base.DeviceFormFactor;
/**
* Utility methods for the browsing history manager.
@@ -43,15 +49,20 @@ public class HistoryManagerUtils {
/**
* @return Whether the Android-specific browsing history UI is was shown.
*/
- public static boolean showHistoryManager(Activity activity) {
+ public static boolean showHistoryManager(Activity activity, Tab tab) {
if (!isAndroidHistoryManagerEnabled()) return false;
- // TODO(twellington): Add support for tablets
- Intent intent = new Intent();
- intent.setClass(activity.getApplicationContext(), HistoryActivity.class);
- intent.putExtra(IntentHandler.EXTRA_PARENT_COMPONENT, activity.getComponentName());
- activity.startActivity(intent);
-
+ Context appContext = ContextUtils.getApplicationContext();
+ if (DeviceFormFactor.isTablet(appContext)) {
+ // History shows up as a tab on tablets.
+ LoadUrlParams params = new LoadUrlParams(UrlConstants.NATIVE_HISTORY_URL);
+ tab.loadUrl(params);
+ } else {
+ Intent intent = new Intent();
+ intent.setClass(appContext, HistoryActivity.class);
+ intent.putExtra(IntentHandler.EXTRA_PARENT_COMPONENT, activity.getComponentName());
+ activity.startActivity(intent);
+ }
return true;
}
}

Powered by Google App Engine
This is Rietveld 408576698