OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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.content.Intent; | 7 import android.content.Intent; |
8 import android.os.SystemClock; | 8 import android.os.SystemClock; |
9 | 9 |
10 import org.chromium.chrome.browser.IntentHandler.IntentHandlerDelegate; | 10 import org.chromium.chrome.browser.IntentHandler.IntentHandlerDelegate; |
11 import org.chromium.chrome.browser.IntentHandler.TabOpenType; | 11 import org.chromium.chrome.browser.IntentHandler.TabOpenType; |
12 import org.chromium.chrome.browser.tab.Tab; | 12 import org.chromium.chrome.browser.tab.Tab; |
13 import org.chromium.chrome.browser.tabmodel.ChromeTabCreator; | 13 import org.chromium.chrome.browser.tabmodel.ChromeTabCreator; |
14 import org.chromium.chrome.browser.tabmodel.TabModel; | 14 import org.chromium.chrome.browser.tabmodel.TabModel; |
15 import org.chromium.chrome.browser.webapps.ActivityAssigner; | 15 import org.chromium.chrome.browser.webapps.ActivityAssigner; |
16 | 16 |
17 /** | 17 /** |
18 * Manages the state of separate task Custom Tabs for Android versions prior to
L. | 18 * Manages the state of separate task Custom Tabs for Android versions prior to
L. |
19 * | 19 * |
20 * L provides the ability to force tasks to be in separate stacks via the NEW_DO
CUMENT flag, but | 20 * L provides the ability to force tasks to be in separate stacks via the NEW_DO
CUMENT flag, but |
21 * no corresponding flag is available in KitKat and before. To work around this
, we predefine an | 21 * no corresponding flag is available in KitKat and before. To work around this
, we predefine an |
22 * limited number of activities that we will cycle through. | 22 * limited number of activities that we will cycle through. |
23 */ | 23 */ |
24 public class SeparateTaskManagedCustomTabActivity extends SeparateTaskCustomTabA
ctivity { | 24 public class SeparateTaskManagedCustomTabActivity extends SeparateTaskCustomTabA
ctivity { |
25 private static final String FORCE_FINISH = "CCT.ForceFinish"; | 25 private static final String FORCE_FINISH = "CCT.ForceFinish"; |
26 | 26 |
27 // Time at which an intent was received and handled. | 27 // Time at which an intent was received and handled. |
28 private long mIntentHandlingTimeMs = 0; | 28 private long mIntentHandlingTimeMs; |
29 | 29 |
30 @Override | 30 @Override |
31 public void onStartWithNative() { | 31 public void onStartWithNative() { |
32 super.onStartWithNative(); | 32 super.onStartWithNative(); |
33 | 33 |
34 if (!isFinishing()) { | 34 if (!isFinishing()) { |
35 ActivityAssigner.instance(ActivityAssigner.SEPARATE_TASK_CCT_NAMESPA
CE) | 35 ActivityAssigner.instance(ActivityAssigner.SEPARATE_TASK_CCT_NAMESPA
CE) |
36 .markActivityUsed(getActivityIndex(), getIntent().getData().
getAuthority()); | 36 .markActivityUsed(getActivityIndex(), getIntent().getData().
getAuthority()); |
37 } | 37 } |
38 } | 38 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 89 |
90 @Override | 90 @Override |
91 protected void handleFinishAndClose() { | 91 protected void handleFinishAndClose() { |
92 Intent intent = new Intent(getIntent()); | 92 Intent intent = new Intent(getIntent()); |
93 intent.setFlags(intent.getFlags() & ~Intent.FLAG_ACTIVITY_NEW_TASK); | 93 intent.setFlags(intent.getFlags() & ~Intent.FLAG_ACTIVITY_NEW_TASK); |
94 intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); | 94 intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); |
95 intent.putExtra(FORCE_FINISH, true); | 95 intent.putExtra(FORCE_FINISH, true); |
96 startActivity(intent); | 96 startActivity(intent); |
97 } | 97 } |
98 } | 98 } |
OLD | NEW |