Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(346)

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/tabmodel/document/TabDelegate.java

Issue 2898373002: Redirects _blank and window.open() off-origin navigation from PWA to CCT. (Closed)
Patch Set: Merge Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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.tabmodel.document; 5 package org.chromium.chrome.browser.tabmodel.document;
6 6
7 import android.app.Activity; 7 import android.app.Activity;
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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 Intent intent = new Intent( 133 Intent intent = new Intent(
134 Intent.ACTION_VIEW, Uri.parse(asyncParams.getLoadUrlParams().get Url())); 134 Intent.ACTION_VIEW, Uri.parse(asyncParams.getLoadUrlParams().get Url()));
135 135
136 ComponentName componentName = asyncParams.getComponentName(); 136 ComponentName componentName = asyncParams.getComponentName();
137 if (componentName == null) { 137 if (componentName == null) {
138 intent.setClass(ContextUtils.getApplicationContext(), ChromeLauncher Activity.class); 138 intent.setClass(ContextUtils.getApplicationContext(), ChromeLauncher Activity.class);
139 } else { 139 } else {
140 intent.setComponent(componentName); 140 intent.setComponent(componentName);
141 } 141 }
142 142
143 addAsyncTabExtras(asyncParams, parentId, isChromeUI, assignedTabId, inte nt);
144
145 return intent;
146 }
147
148 protected final void addAsyncTabExtras(AsyncTabCreationParams asyncParams, i nt parentId,
149 boolean isChromeUI, int assignedTabId, Intent intent) {
143 Map<String, String> extraHeaders = asyncParams.getLoadUrlParams().getExt raHeaders(); 150 Map<String, String> extraHeaders = asyncParams.getLoadUrlParams().getExt raHeaders();
144 if (extraHeaders != null && !extraHeaders.isEmpty()) { 151 if (extraHeaders != null && !extraHeaders.isEmpty()) {
145 Bundle bundle = new Bundle(); 152 Bundle bundle = new Bundle();
146 for (Map.Entry<String, String> header : extraHeaders.entrySet()) { 153 for (Map.Entry<String, String> header : extraHeaders.entrySet()) {
147 bundle.putString(header.getKey(), header.getValue()); 154 bundle.putString(header.getKey(), header.getValue());
148 } 155 }
149 intent.putExtra(Browser.EXTRA_HEADERS, bundle); 156 intent.putExtra(Browser.EXTRA_HEADERS, bundle);
150 } 157 }
151 158
152 intent.putExtra(IntentHandler.EXTRA_TAB_ID, assignedTabId); 159 intent.putExtra(IntentHandler.EXTRA_TAB_ID, assignedTabId);
(...skipping 11 matching lines...) Expand all
164 if (parentActivity != null && parentActivity.getIntent() != null) { 171 if (parentActivity != null && parentActivity.getIntent() != null) {
165 intent.putExtra(IntentHandler.EXTRA_PARENT_INTENT, parentActivity.ge tIntent()); 172 intent.putExtra(IntentHandler.EXTRA_PARENT_INTENT, parentActivity.ge tIntent());
166 } 173 }
167 174
168 if (asyncParams.getRequestId() != null) { 175 if (asyncParams.getRequestId() != null) {
169 intent.putExtra(ServiceTabLauncher.LAUNCH_REQUEST_ID_EXTRA, 176 intent.putExtra(ServiceTabLauncher.LAUNCH_REQUEST_ID_EXTRA,
170 asyncParams.getRequestId().intValue()); 177 asyncParams.getRequestId().intValue());
171 } 178 }
172 179
173 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 180 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
174 return intent;
175 } 181 }
176 182
177 /** 183 /**
178 * Passes the supplied web app launch intent to the IntentHandler. 184 * Passes the supplied web app launch intent to the IntentHandler.
179 * @param intent Web app launch intent. 185 * @param intent Web app launch intent.
180 */ 186 */
181 public void createNewStandaloneFrame(Intent intent) { 187 public void createNewStandaloneFrame(Intent intent) {
182 assert intent != null; 188 assert intent != null;
183 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK 189 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
184 | ApiCompatibilityUtils.getActivityNewDocumentFlag()); 190 | ApiCompatibilityUtils.getActivityNewDocumentFlag());
185 IntentHandler.startActivityForTrustedIntent(intent); 191 IntentHandler.startActivityForTrustedIntent(intent);
186 } 192 }
187 } 193 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698