| 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.tab; | 5 package org.chromium.chrome.browser.tab; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 import android.content.Intent; | 8 import android.content.Intent; |
| 9 import android.net.MailTo; | 9 import android.net.MailTo; |
| 10 import android.net.Uri; | 10 import android.net.Uri; |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 loadUrlParams.setReferrer(referrer); | 219 loadUrlParams.setReferrer(referrer); |
| 220 mTab.getActivity().getTabModelSelector().openNewTab(loadUrlParams, | 220 mTab.getActivity().getTabModelSelector().openNewTab(loadUrlParams, |
| 221 TabLaunchType.FROM_LONGPRESS_BACKGROUND, mTab, isIncognito()); | 221 TabLaunchType.FROM_LONGPRESS_BACKGROUND, mTab, isIncognito()); |
| 222 } | 222 } |
| 223 | 223 |
| 224 @Override | 224 @Override |
| 225 public void onOpenInChrome(String linkUrl, String pageUrl) { | 225 public void onOpenInChrome(String linkUrl, String pageUrl) { |
| 226 Intent chromeIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(linkUrl))
; | 226 Intent chromeIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(linkUrl))
; |
| 227 chromeIntent.setPackage(mTab.getApplicationContext().getPackageName()); | 227 chromeIntent.setPackage(mTab.getApplicationContext().getPackageName()); |
| 228 chromeIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | 228 chromeIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| 229 // For "Open in Chrome" from the context menu in FullscreenActivity we w
ant to bypass | |
| 230 // CustomTab, and this flag ensures we open in TabbedChrome. | |
| 231 chromeIntent.putExtra(ChromeLauncherActivity.EXTRA_IS_ALLOWED_TO_RETURN_
TO_PARENT, false); | |
| 232 | 229 |
| 233 boolean activityStarted = false; | 230 boolean activityStarted = false; |
| 234 if (pageUrl != null) { | 231 if (pageUrl != null) { |
| 235 try { | 232 try { |
| 236 URI pageUri = URI.create(pageUrl); | 233 URI pageUri = URI.create(pageUrl); |
| 237 if (UrlUtilities.isInternalScheme(pageUri)) { | 234 if (UrlUtilities.isInternalScheme(pageUri)) { |
| 238 IntentHandler.startChromeLauncherActivityForTrustedIntent(ch
romeIntent); | 235 IntentHandler.startChromeLauncherActivityForTrustedIntent(ch
romeIntent); |
| 239 activityStarted = true; | 236 activityStarted = true; |
| 240 } | 237 } |
| 241 } catch (IllegalArgumentException ex) { | 238 } catch (IllegalArgumentException ex) { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 if (DataReductionProxySettings.getInstance().isDataReductionProxyEnabled
() | 286 if (DataReductionProxySettings.getInstance().isDataReductionProxyEnabled
() |
| 290 && url != null && !url.toLowerCase(Locale.US).startsWith( | 287 && url != null && !url.toLowerCase(Locale.US).startsWith( |
| 291 UrlConstants.HTTPS_URL_PREFIX) | 288 UrlConstants.HTTPS_URL_PREFIX) |
| 292 && !isIncognito()) { | 289 && !isIncognito()) { |
| 293 return true; | 290 return true; |
| 294 } | 291 } |
| 295 return false; | 292 return false; |
| 296 } | 293 } |
| 297 | 294 |
| 298 } | 295 } |
| OLD | NEW |