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

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

Issue 2542203002: [Android History] Add Android history manager UI and bridge (Closed)
Patch Set: Add OWNERS files 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.chrome.browser.history;
6
7 import android.app.Activity;
8 import android.content.Intent;
9 import android.text.TextUtils;
10
11 import org.chromium.base.CommandLine;
12 import org.chromium.chrome.browser.IntentHandler;
13 import org.chromium.components.variations.VariationsAssociatedData;
14
15 /**
16 * Utility methods for the browsing history manager.
17 */
18 public class HistoryManagerUtils {
19 private static final String FIELD_TRIAL_NAME = "AndroidHistoryManager";
20 private static final String ENABLE_HISTORY_SWTICH = "enable_android_history_ manager";
21 private static Boolean sNativeHistoryEnabled;
22
23 /**
24 * @return Whether the Android-specific browsing history manager is enabled.
25 */
26 public static boolean isAndroidHistoryManagerEnabled() {
gone 2016/12/02 19:34:37 Does this need to worry about what thread it's cal
Theresa 2016/12/02 20:49:33 It's currently only called from the UI thread but
27 if (sNativeHistoryEnabled == null) {
28 if (CommandLine.getInstance().hasSwitch(ENABLE_HISTORY_SWTICH)) {
29 sNativeHistoryEnabled = true;
30 } else {
31 sNativeHistoryEnabled = TextUtils.equals("true",
32 VariationsAssociatedData.getVariationParamValue(FIELD_TR IAL_NAME,
33 ENABLE_HISTORY_SWTICH));
34 }
35 }
36
37 return sNativeHistoryEnabled;
38 }
39
40 /**
41 * @return Whether the Android-specific browsing history UI is was shown.
42 */
43 public static boolean showHistoryManager(Activity activity) {
44 if (!isAndroidHistoryManagerEnabled()) return false;
45
46 // TODO(twellington): Add support for tablets
47 Intent intent = new Intent();
48 intent.setClass(activity.getApplicationContext(), HistoryActivity.class) ;
49 intent.putExtra(IntentHandler.EXTRA_PARENT_COMPONENT, activity.getCompon entName());
50 activity.startActivity(intent);
51
52 return true;
53 }
54 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698