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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java

Issue 2829193003: Autopresent WebVR content in CCT if it was opened by a Daydream Intent (Closed)
Patch Set: Created 3 years, 8 months 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser.customtabs; 5 package org.chromium.chrome.browser.customtabs;
6 6
7 import android.app.PendingIntent; 7 import android.app.PendingIntent;
8 import android.content.Context; 8 import android.content.Context;
9 import android.content.Intent; 9 import android.content.Intent;
10 import android.content.SharedPreferences; 10 import android.content.SharedPreferences;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 import org.chromium.chrome.browser.tabmodel.ChromeTabCreator; 67 import org.chromium.chrome.browser.tabmodel.ChromeTabCreator;
68 import org.chromium.chrome.browser.tabmodel.EmptyTabModelObserver; 68 import org.chromium.chrome.browser.tabmodel.EmptyTabModelObserver;
69 import org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType; 69 import org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType;
70 import org.chromium.chrome.browser.tabmodel.TabModelObserver; 70 import org.chromium.chrome.browser.tabmodel.TabModelObserver;
71 import org.chromium.chrome.browser.tabmodel.TabModelSelector; 71 import org.chromium.chrome.browser.tabmodel.TabModelSelector;
72 import org.chromium.chrome.browser.tabmodel.TabModelSelectorImpl; 72 import org.chromium.chrome.browser.tabmodel.TabModelSelectorImpl;
73 import org.chromium.chrome.browser.tabmodel.TabReparentingParams; 73 import org.chromium.chrome.browser.tabmodel.TabReparentingParams;
74 import org.chromium.chrome.browser.toolbar.ToolbarControlContainer; 74 import org.chromium.chrome.browser.toolbar.ToolbarControlContainer;
75 import org.chromium.chrome.browser.util.ColorUtils; 75 import org.chromium.chrome.browser.util.ColorUtils;
76 import org.chromium.chrome.browser.util.UrlUtilities; 76 import org.chromium.chrome.browser.util.UrlUtilities;
77 import org.chromium.chrome.browser.vr_shell.VrShellDelegate;
77 import org.chromium.chrome.browser.widget.findinpage.FindToolbarManager; 78 import org.chromium.chrome.browser.widget.findinpage.FindToolbarManager;
78 import org.chromium.components.dom_distiller.core.DomDistillerUrlUtils; 79 import org.chromium.components.dom_distiller.core.DomDistillerUrlUtils;
79 import org.chromium.content_public.browser.LoadUrlParams; 80 import org.chromium.content_public.browser.LoadUrlParams;
80 import org.chromium.content_public.browser.WebContents; 81 import org.chromium.content_public.browser.WebContents;
81 import org.chromium.ui.base.PageTransition; 82 import org.chromium.ui.base.PageTransition;
82 import org.chromium.ui.base.WindowAndroid; 83 import org.chromium.ui.base.WindowAndroid;
83 84
84 /** 85 /**
85 * The activity for custom tabs. It will be launched on top of a client's task. 86 * The activity for custom tabs. It will be launched on top of a client's task.
86 */ 87 */
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 if (!mHasCreatedTabEarly && !successfulStateRestore) { 526 if (!mHasCreatedTabEarly && !successfulStateRestore) {
526 loadUrlInTab(mMainTab, new LoadUrlParams(url), 527 loadUrlInTab(mMainTab, new LoadUrlParams(url),
527 IntentHandler.getTimestampFromIntent(getIntent())); 528 IntentHandler.getTimestampFromIntent(getIntent()));
528 } 529 }
529 530
530 // Put Sync in the correct state by calling tab state initialized. crbug .com/581811. 531 // Put Sync in the correct state by calling tab state initialized. crbug .com/581811.
531 getTabModelSelector().markTabStateInitialized(); 532 getTabModelSelector().markTabStateInitialized();
532 super.finishNativeInitialization(); 533 super.finishNativeInitialization();
533 } 534 }
534 535
536 @Override
537 public final boolean shouldAutoPresent() {
mthiesse 2017/04/21 14:24:27 If you call this shouldAutoPresentOnVrIntent(), yo
bshe 2017/04/21 17:54:01 See below. It looks like VrShellDelegate wont get
538 return VrShellDelegate.isDaydreamVrIntent(getIntent());
mthiesse 2017/04/21 14:24:27 Instead of using getIntent(), you should have VrSh
bshe 2017/04/21 17:54:01 If I understand correctly, onNewIntentWithNative w
mthiesse 2017/04/21 18:35:39 Why look at the intent at all? Why not tie into CC
Yusuf 2017/04/21 23:10:38 I am assuming they dont connect through our servic
bshe 2017/04/24 13:59:12 There is no VR specific way of checking it. For is
539 }
540
535 /** 541 /**
536 * Encapsulates CustomTabsConnection#takeHiddenTab() 542 * Encapsulates CustomTabsConnection#takeHiddenTab()
537 * with additional initialization logic. 543 * with additional initialization logic.
538 */ 544 */
539 private Tab getHiddenTab(CustomTabsConnection connection) { 545 private Tab getHiddenTab(CustomTabsConnection connection) {
540 String url = getUrlToLoad(); 546 String url = getUrlToLoad();
541 String referrerUrl = connection.getReferrer(mSession, getIntent()); 547 String referrerUrl = connection.getReferrer(mSession, getIntent());
542 Tab tab = connection.takeHiddenTab(mSession, url, referrerUrl); 548 Tab tab = connection.takeHiddenTab(mSession, url, referrerUrl);
543 mUsingHiddenTab = tab != null; 549 mUsingHiddenTab = tab != null;
544 if (!mUsingHiddenTab) return null; 550 if (!mUsingHiddenTab) return null;
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 Intent intent = ChromeLauncherActivity.createCustomTabActivityIntent( 1148 Intent intent = ChromeLauncherActivity.createCustomTabActivityIntent(
1143 context, customTabIntent.intent, false); 1149 context, customTabIntent.intent, false);
1144 intent.setPackage(context.getPackageName()); 1150 intent.setPackage(context.getPackageName());
1145 intent.putExtra(CustomTabIntentDataProvider.EXTRA_IS_INFO_PAGE, true); 1151 intent.putExtra(CustomTabIntentDataProvider.EXTRA_IS_INFO_PAGE, true);
1146 intent.putExtra(Browser.EXTRA_APPLICATION_ID, context.getPackageName()); 1152 intent.putExtra(Browser.EXTRA_APPLICATION_ID, context.getPackageName());
1147 IntentHandler.addTrustedIntentExtras(intent); 1153 IntentHandler.addTrustedIntentExtras(intent);
1148 1154
1149 context.startActivity(intent); 1155 context.startActivity(intent);
1150 } 1156 }
1151 } 1157 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698