| OLD | NEW |
| 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.document; | 5 package org.chromium.chrome.browser.document; |
| 6 | 6 |
| 7 import android.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
| 8 import android.app.Activity; | 8 import android.app.Activity; |
| 9 import android.app.Notification; | 9 import android.app.Notification; |
| 10 import android.app.PendingIntent; | 10 import android.app.PendingIntent; |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 // For Elderberry flavored Herbs that are to be launched in a separate t
ask, add a random | 341 // For Elderberry flavored Herbs that are to be launched in a separate t
ask, add a random |
| 342 // UUID to try and prevent Android from refocusing/clobbering items that
share the same | 342 // UUID to try and prevent Android from refocusing/clobbering items that
share the same |
| 343 // base intent. If we do support refocusing of existing Herbs, we need
to do it on the | 343 // base intent. If we do support refocusing of existing Herbs, we need
to do it on the |
| 344 // current URL and not the URL that it was triggered with. | 344 // current URL and not the URL that it was triggered with. |
| 345 if (TextUtils.equals( | 345 if (TextUtils.equals( |
| 346 FeatureUtilities.getHerbFlavor(), ChromeSwitches.HERB_FLAVOR_ELD
ERBERRY) | 346 FeatureUtilities.getHerbFlavor(), ChromeSwitches.HERB_FLAVOR_ELD
ERBERRY) |
| 347 && (newIntent.getFlags() & Intent.FLAG_ACTIVITY_NEW_TASK) != 0 | 347 && (newIntent.getFlags() & Intent.FLAG_ACTIVITY_NEW_TASK) != 0 |
| 348 || (newIntent.getFlags() & Intent.FLAG_ACTIVITY_NEW_DOCU
MENT) != 0) { | 348 || (newIntent.getFlags() & Intent.FLAG_ACTIVITY_NEW_DOCU
MENT) != 0) { |
| 349 newIntent.setClassName(context, SeparateTaskCustomTabActivity.class.
getName()); | 349 newIntent.setClassName(context, SeparateTaskCustomTabActivity.class.
getName()); |
| 350 | 350 |
| 351 // Pre-L, the exclude from recents flag on the launcher does not app
ly to the launched |
| 352 // separate task activity (and provides the desired user behavior).
On L, the flag |
| 353 // needs to be cleared otherwise it is hidden immediately upon exiti
ng. |
| 354 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { |
| 355 newIntent.setFlags( |
| 356 newIntent.getFlags() & ~Intent.FLAG_ACTIVITY_EXCLUDE_FRO
M_RECENTS); |
| 357 } |
| 351 String url = IntentHandler.getUrlFromIntent(newIntent); | 358 String url = IntentHandler.getUrlFromIntent(newIntent); |
| 352 assert url != null; | 359 assert url != null; |
| 353 | 360 |
| 354 newIntent.setData(new Uri.Builder().scheme(UrlConstants.CUSTOM_TAB_S
CHEME) | 361 newIntent.setData(new Uri.Builder().scheme(UrlConstants.CUSTOM_TAB_S
CHEME) |
| 355 .authority(UUID.randomUUID().toString()) | 362 .authority(UUID.randomUUID().toString()) |
| 356 .query(url).build()); | 363 .query(url).build()); |
| 357 } | 364 } |
| 358 | 365 |
| 359 Bundle herbActionButtonBundle = new Bundle(); | 366 Bundle herbActionButtonBundle = new Bundle(); |
| 360 | 367 |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 IntentHandler.ExternalAppId source = | 511 IntentHandler.ExternalAppId source = |
| 505 IntentHandler.determineExternalIntentSource(getPackageName(), in
tent); | 512 IntentHandler.determineExternalIntentSource(getPackageName(), in
tent); |
| 506 if (intent.getPackage() == null && source != IntentHandler.ExternalAppId
.CHROME) { | 513 if (intent.getPackage() == null && source != IntentHandler.ExternalAppId
.CHROME) { |
| 507 int flagsOfInterest = Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_AC
TIVITY_NEW_DOCUMENT; | 514 int flagsOfInterest = Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_AC
TIVITY_NEW_DOCUMENT; |
| 508 int maskedFlags = intent.getFlags() & flagsOfInterest; | 515 int maskedFlags = intent.getFlags() & flagsOfInterest; |
| 509 sIntentFlagsHistogram.record(maskedFlags); | 516 sIntentFlagsHistogram.record(maskedFlags); |
| 510 } | 517 } |
| 511 MediaNotificationUma.recordClickSource(intent); | 518 MediaNotificationUma.recordClickSource(intent); |
| 512 } | 519 } |
| 513 } | 520 } |
| OLD | NEW |