| 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; | 5 package org.chromium.chrome.browser; |
| 6 | 6 |
| 7 import android.app.KeyguardManager; | 7 import android.app.KeyguardManager; |
| 8 import android.app.PendingIntent; | 8 import android.app.PendingIntent; |
| 9 import android.app.SearchManager; | 9 import android.app.SearchManager; |
| 10 import android.content.ComponentName; | 10 import android.content.ComponentName; |
| 11 import android.content.Context; | 11 import android.content.Context; |
| 12 import android.content.Intent; | 12 import android.content.Intent; |
| 13 import android.net.Uri; | 13 import android.net.Uri; |
| 14 import android.os.Bundle; | 14 import android.os.Bundle; |
| 15 import android.os.SystemClock; | 15 import android.os.SystemClock; |
| 16 import android.provider.Browser; | 16 import android.provider.Browser; |
| 17 import android.provider.MediaStore; | 17 import android.provider.MediaStore; |
| 18 import android.speech.RecognizerResultsIntent; | 18 import android.speech.RecognizerResultsIntent; |
| 19 import android.text.TextUtils; | 19 import android.text.TextUtils; |
| 20 import android.util.Pair; | 20 import android.util.Pair; |
| 21 | 21 |
| 22 import org.chromium.base.ApiCompatibilityUtils; | 22 import org.chromium.base.ApiCompatibilityUtils; |
| 23 import org.chromium.base.Log; | 23 import org.chromium.base.Log; |
| 24 import org.chromium.base.VisibleForTesting; | 24 import org.chromium.base.VisibleForTesting; |
| 25 import org.chromium.base.metrics.RecordHistogram; | 25 import org.chromium.base.metrics.RecordHistogram; |
| 26 import org.chromium.chrome.browser.externalauth.ExternalAuthUtils; | 26 import org.chromium.chrome.browser.externalauth.ExternalAuthUtils; |
| 27 import org.chromium.chrome.browser.externalnav.ExternalNavigationDelegateImpl; | 27 import org.chromium.chrome.browser.externalnav.ExternalNavigationDelegateImpl; |
| 28 import org.chromium.chrome.browser.externalnav.IntentWithGesturesHandler; | 28 import org.chromium.chrome.browser.externalnav.IntentWithGesturesHandler; |
| 29 import org.chromium.chrome.browser.nfc.NfcIntentHandler; |
| 29 import org.chromium.chrome.browser.omnibox.AutocompleteController; | 30 import org.chromium.chrome.browser.omnibox.AutocompleteController; |
| 30 import org.chromium.chrome.browser.search_engines.TemplateUrlService; | 31 import org.chromium.chrome.browser.search_engines.TemplateUrlService; |
| 31 import org.chromium.chrome.browser.tab.Tab; | 32 import org.chromium.chrome.browser.tab.Tab; |
| 32 import org.chromium.chrome.browser.tabmodel.document.ActivityDelegate; | 33 import org.chromium.chrome.browser.tabmodel.document.ActivityDelegate; |
| 33 import org.chromium.chrome.browser.util.IntentUtils; | 34 import org.chromium.chrome.browser.util.IntentUtils; |
| 34 import org.chromium.content_public.browser.LoadUrlParams; | 35 import org.chromium.content_public.browser.LoadUrlParams; |
| 35 import org.chromium.content_public.common.Referrer; | 36 import org.chromium.content_public.common.Referrer; |
| 36 | 37 |
| 37 import java.util.ArrayList; | 38 import java.util.ArrayList; |
| 38 import java.util.Iterator; | 39 import java.util.Iterator; |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 externalId.ordinal(), ExternalAppId.INDEX_BOUNDARY.ordinal()); | 277 externalId.ordinal(), ExternalAppId.INDEX_BOUNDARY.ordinal()); |
| 277 } | 278 } |
| 278 | 279 |
| 279 /** | 280 /** |
| 280 * Handles an Intent after the ChromeTabbedActivity decides that it shouldn'
t ignore the | 281 * Handles an Intent after the ChromeTabbedActivity decides that it shouldn'
t ignore the |
| 281 * Intent. | 282 * Intent. |
| 282 * | 283 * |
| 283 * @return Whether the Intent was successfully handled. | 284 * @return Whether the Intent was successfully handled. |
| 284 */ | 285 */ |
| 285 boolean onNewIntent(Context context, Intent intent) { | 286 boolean onNewIntent(Context context, Intent intent) { |
| 287 if (NfcIntentHandler.handleIntent(context, intent)) { |
| 288 return true; |
| 289 } |
| 290 |
| 286 assert intentHasValidUrl(intent); | 291 assert intentHasValidUrl(intent); |
| 287 String url = getUrlFromIntent(intent); | 292 String url = getUrlFromIntent(intent); |
| 288 boolean hasUserGesture = | 293 boolean hasUserGesture = |
| 289 IntentWithGesturesHandler.getInstance().getUserGestureAndClear(i
ntent); | 294 IntentWithGesturesHandler.getInstance().getUserGestureAndClear(i
ntent); |
| 290 TabOpenType tabOpenType = getTabOpenType(intent); | 295 TabOpenType tabOpenType = getTabOpenType(intent); |
| 291 int tabIdToBringToFront = IntentUtils.safeGetIntExtra( | 296 int tabIdToBringToFront = IntentUtils.safeGetIntExtra( |
| 292 intent, TabOpenType.BRING_TAB_TO_FRONT.name(), Tab.INVALID_TAB_I
D); | 297 intent, TabOpenType.BRING_TAB_TO_FRONT.name(), Tab.INVALID_TAB_I
D); |
| 293 if (url == null && tabIdToBringToFront == Tab.INVALID_TAB_ID | 298 if (url == null && tabIdToBringToFront == Tab.INVALID_TAB_ID |
| 294 && tabOpenType != TabOpenType.OPEN_NEW_INCOGNITO_TAB) { | 299 && tabOpenType != TabOpenType.OPEN_NEW_INCOGNITO_TAB) { |
| 295 return handleWebSearchIntent(intent); | 300 return handleWebSearchIntent(intent); |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 868 * @param id The referrer id. | 873 * @param id The referrer id. |
| 869 * @return The URL for the referrer or null if none found. | 874 * @return The URL for the referrer or null if none found. |
| 870 */ | 875 */ |
| 871 public static String getPendingReferrerUrl(int id) { | 876 public static String getPendingReferrerUrl(int id) { |
| 872 if (sPendingReferrer != null && (sPendingReferrer.first == id)) { | 877 if (sPendingReferrer != null && (sPendingReferrer.first == id)) { |
| 873 return sPendingReferrer.second; | 878 return sPendingReferrer.second; |
| 874 } | 879 } |
| 875 return null; | 880 return null; |
| 876 } | 881 } |
| 877 } | 882 } |
| OLD | NEW |