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); |
229 | 232 |
230 boolean activityStarted = false; | 233 boolean activityStarted = false; |
231 if (pageUrl != null) { | 234 if (pageUrl != null) { |
232 try { | 235 try { |
233 URI pageUri = URI.create(pageUrl); | 236 URI pageUri = URI.create(pageUrl); |
234 if (UrlUtilities.isInternalScheme(pageUri)) { | 237 if (UrlUtilities.isInternalScheme(pageUri)) { |
235 IntentHandler.startChromeLauncherActivityForTrustedIntent(ch
romeIntent); | 238 IntentHandler.startChromeLauncherActivityForTrustedIntent(ch
romeIntent); |
236 activityStarted = true; | 239 activityStarted = true; |
237 } | 240 } |
238 } catch (IllegalArgumentException ex) { | 241 } catch (IllegalArgumentException ex) { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 if (DataReductionProxySettings.getInstance().isDataReductionProxyEnabled
() | 289 if (DataReductionProxySettings.getInstance().isDataReductionProxyEnabled
() |
287 && url != null && !url.toLowerCase(Locale.US).startsWith( | 290 && url != null && !url.toLowerCase(Locale.US).startsWith( |
288 UrlConstants.HTTPS_URL_PREFIX) | 291 UrlConstants.HTTPS_URL_PREFIX) |
289 && !isIncognito()) { | 292 && !isIncognito()) { |
290 return true; | 293 return true; |
291 } | 294 } |
292 return false; | 295 return false; |
293 } | 296 } |
294 | 297 |
295 } | 298 } |
OLD | NEW |