| 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.externalnav; | 5 package org.chromium.chrome.browser.externalnav; |
| 6 | 6 |
| 7 import android.content.ActivityNotFoundException; | 7 import android.content.ActivityNotFoundException; |
| 8 import android.content.ComponentName; | 8 import android.content.ComponentName; |
| 9 import android.content.Intent; | 9 import android.content.Intent; |
| 10 import android.net.Uri; | 10 import android.net.Uri; |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 mDelegate.startIncognitoIntent(intent, params.getReferrerUrl(), | 353 mDelegate.startIncognitoIntent(intent, params.getReferrerUrl(), |
| 354 hasBrowserFallbackUrl ? browserFallbackUrl : null, param
s.getTab(), | 354 hasBrowserFallbackUrl ? browserFallbackUrl : null, param
s.getTab(), |
| 355 params.shouldCloseContentsOnOverrideUrlLoadingAndLaunchI
ntent()); | 355 params.shouldCloseContentsOnOverrideUrlLoadingAndLaunchI
ntent()); |
| 356 return OverrideUrlLoadingResult.OVERRIDE_WITH_ASYNC_ACTION; | 356 return OverrideUrlLoadingResult.OVERRIDE_WITH_ASYNC_ACTION; |
| 357 } else { | 357 } else { |
| 358 if (params.getRedirectHandler() != null && incomingIntentRedirec
t) { | 358 if (params.getRedirectHandler() != null && incomingIntentRedirec
t) { |
| 359 if (!params.getRedirectHandler().hasNewResolver(intent)) { | 359 if (!params.getRedirectHandler().hasNewResolver(intent)) { |
| 360 return OverrideUrlLoadingResult.NO_OVERRIDE; | 360 return OverrideUrlLoadingResult.NO_OVERRIDE; |
| 361 } | 361 } |
| 362 } | 362 } |
| 363 // The intent can be used to launch Chrome itself, record the us
er |
| 364 // gesture here so that it can be used later. |
| 365 if (params.hasUserGesture()) { |
| 366 IntentWithGesturesHandler.getInstance().onNewIntentWithGestu
re(intent); |
| 367 } |
| 363 if (mDelegate.startActivityIfNeeded(intent)) { | 368 if (mDelegate.startActivityIfNeeded(intent)) { |
| 364 return OverrideUrlLoadingResult.OVERRIDE_WITH_EXTERNAL_INTEN
T; | 369 return OverrideUrlLoadingResult.OVERRIDE_WITH_EXTERNAL_INTEN
T; |
| 365 } else { | 370 } else { |
| 366 return OverrideUrlLoadingResult.NO_OVERRIDE; | 371 return OverrideUrlLoadingResult.NO_OVERRIDE; |
| 367 } | 372 } |
| 368 } | 373 } |
| 369 } catch (ActivityNotFoundException ex) { | 374 } catch (ActivityNotFoundException ex) { |
| 370 // Ignore the error. If no application can handle the URL, | 375 // Ignore the error. If no application can handle the URL, |
| 371 // assume the browser can handle it. | 376 // assume the browser can handle it. |
| 372 } | 377 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 try { | 413 try { |
| 409 Intent intent = Intent.parseUri(url, Intent.URI_INTENT_SCHEME); | 414 Intent intent = Intent.parseUri(url, Intent.URI_INTENT_SCHEME); |
| 410 return intent.getPackage() != null || mDelegate.canResolveActivity(i
ntent); | 415 return intent.getPackage() != null || mDelegate.canResolveActivity(i
ntent); |
| 411 } catch (Exception ex) { | 416 } catch (Exception ex) { |
| 412 // Ignore the error. | 417 // Ignore the error. |
| 413 Log.w(TAG, "Bad URI " + url, ex); | 418 Log.w(TAG, "Bad URI " + url, ex); |
| 414 } | 419 } |
| 415 return false; | 420 return false; |
| 416 } | 421 } |
| 417 } | 422 } |
| OLD | NEW |