| 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.Manifest.permission; | 7 import android.Manifest.permission; |
| 8 import android.app.Activity; | 8 import android.app.Activity; |
| 9 import android.content.Context; | 9 import android.content.Context; |
| 10 import android.content.DialogInterface; | 10 import android.content.DialogInterface; |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 activityResolved = true; | 120 activityResolved = true; |
| 121 boolean canSelfOpen = false; | 121 boolean canSelfOpen = false; |
| 122 boolean hasPdfViewer = false; | 122 boolean hasPdfViewer = false; |
| 123 for (ResolveInfo resolveInfo : handlers) { | 123 for (ResolveInfo resolveInfo : handlers) { |
| 124 String pName = resolveInfo.activityInfo.packageName; | 124 String pName = resolveInfo.activityInfo.packageName; |
| 125 if (packageName.equals(pName)) { | 125 if (packageName.equals(pName)) { |
| 126 canSelfOpen = true; | 126 canSelfOpen = true; |
| 127 } else if (PDF_VIEWER.equals(pName)) { | 127 } else if (PDF_VIEWER.equals(pName)) { |
| 128 if (isPdfIntent(intent)) { | 128 if (isPdfIntent(intent)) { |
| 129 intent.setClassName(pName, resolveInfo.activ
ityInfo.name); | 129 intent.setClassName(pName, resolveInfo.activ
ityInfo.name); |
| 130 Uri referrer = new Uri.Builder().scheme( |
| 131 IntentHandler.ANDROID_APP_REFERRER_S
CHEME).authority( |
| 132 packageName).build(); |
| 133 intent.putExtra(Intent.EXTRA_REFERRER, refer
rer); |
| 130 hasPdfViewer = true; | 134 hasPdfViewer = true; |
| 131 break; | 135 break; |
| 132 } | 136 } |
| 133 } | 137 } |
| 134 } | 138 } |
| 135 if ((canSelfOpen && !allowSelfOpen) && !hasPdfViewer) { | 139 if ((canSelfOpen && !allowSelfOpen) && !hasPdfViewer) { |
| 136 activityResolved = false; | 140 activityResolved = false; |
| 137 } | 141 } |
| 138 } | 142 } |
| 139 } | 143 } |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 } | 464 } |
| 461 } | 465 } |
| 462 | 466 |
| 463 private void closeTab(Tab tab) { | 467 private void closeTab(Tab tab) { |
| 464 Context context = tab.getWindowAndroid().getContext().get(); | 468 Context context = tab.getWindowAndroid().getContext().get(); |
| 465 if (context instanceof ChromeActivity) { | 469 if (context instanceof ChromeActivity) { |
| 466 ((ChromeActivity) context).getTabModelSelector().closeTab(tab); | 470 ((ChromeActivity) context).getTabModelSelector().closeTab(tab); |
| 467 } | 471 } |
| 468 } | 472 } |
| 469 } | 473 } |
| OLD | NEW |