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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/document/DocumentActivity.java

Issue 1817083003: Add pathway to auto-migrate users when Chrome launches (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@assassin
Patch Set: Comments Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/document/DocumentActivity.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/document/DocumentActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/document/DocumentActivity.java
index eee242a190066f3eb00c2ccd946cf4551cd4b336..62d9864026f24e63dbf1b23e621a5561b77e5c87 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/document/DocumentActivity.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/document/DocumentActivity.java
@@ -230,8 +230,30 @@ public class DocumentActivity extends ChromeActivity {
@Override
protected boolean isStartedUpCorrectly(Intent intent) {
- int tabId = ActivityDelegate.getTabIdFromIntent(getIntent());
boolean isDocumentMode = FeatureUtilities.isDocumentMode(this);
+ int tabId = ActivityDelegate.getTabIdFromIntent(getIntent());
+
+ if (!isDocumentMode) {
+ // Fire a MAIN Intent to send the user back through ChromeLauncherActivity.
+ Log.e(TAG, "User is not in document mode. Sending back to ChromeLauncherActivity.");
+
+ // Try to bring this tab forward after migration.
+ Intent tabbedIntent = null;
+ if (tabId != Tab.INVALID_TAB_ID) tabbedIntent = Tab.createBringTabToFrontIntent(tabId);
+
+ if (tabbedIntent == null) {
+ tabbedIntent = new Intent(Intent.ACTION_MAIN);
+ tabbedIntent.setPackage(getPackageName());
+ }
+
+ // Launch the other Activity in its own task so it stays when this one finishes.
+ tabbedIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ tabbedIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
+
+ startActivity(tabbedIntent);
+ overridePendingTransition(0, 0);
+ }
+
boolean isStartedUpCorrectly = tabId != Tab.INVALID_TAB_ID && isDocumentMode;
if (!isStartedUpCorrectly) {
Log.e(TAG, "Discarding Intent: Tab = " + tabId + ", Document mode = " + isDocumentMode);

Powered by Google App Engine
This is Rietveld 408576698