| OLD | NEW |
| 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 } | 126 } |
| 127 | 127 |
| 128 private Intent createNewTabIntent( | 128 private Intent createNewTabIntent( |
| 129 AsyncTabCreationParams asyncParams, int parentId, boolean isChromeUI
) { | 129 AsyncTabCreationParams asyncParams, int parentId, boolean isChromeUI
) { |
| 130 int assignedTabId = TabIdManager.getInstance().generateValidId(Tab.INVAL
ID_TAB_ID); | 130 int assignedTabId = TabIdManager.getInstance().generateValidId(Tab.INVAL
ID_TAB_ID); |
| 131 AsyncTabParamsManager.add(assignedTabId, asyncParams); | 131 AsyncTabParamsManager.add(assignedTabId, asyncParams); |
| 132 | 132 |
| 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(); |
| 137 if (componentName == null) { |
| 138 intent.setClass(ContextUtils.getApplicationContext(), ChromeLauncher
Activity.class); |
| 139 } else { |
| 140 intent.setComponent(componentName); |
| 141 } |
| 142 |
| 136 addAsyncTabExtras(asyncParams, parentId, isChromeUI, assignedTabId, inte
nt); | 143 addAsyncTabExtras(asyncParams, parentId, isChromeUI, assignedTabId, inte
nt); |
| 137 | 144 |
| 138 return intent; | 145 return intent; |
| 139 } | 146 } |
| 140 | 147 |
| 141 protected final void addAsyncTabExtras(AsyncTabCreationParams asyncParams, i
nt parentId, | 148 protected final void addAsyncTabExtras(AsyncTabCreationParams asyncParams, i
nt parentId, |
| 142 boolean isChromeUI, int assignedTabId, Intent intent) { | 149 boolean isChromeUI, int assignedTabId, Intent intent) { |
| 143 ComponentName componentName = asyncParams.getComponentName(); | |
| 144 if (componentName == null) { | |
| 145 intent.setClass(ContextUtils.getApplicationContext(), ChromeLauncher
Activity.class); | |
| 146 } else { | |
| 147 intent.setComponent(componentName); | |
| 148 } | |
| 149 | |
| 150 Map<String, String> extraHeaders = asyncParams.getLoadUrlParams().getExt
raHeaders(); | 150 Map<String, String> extraHeaders = asyncParams.getLoadUrlParams().getExt
raHeaders(); |
| 151 if (extraHeaders != null && !extraHeaders.isEmpty()) { | 151 if (extraHeaders != null && !extraHeaders.isEmpty()) { |
| 152 Bundle bundle = new Bundle(); | 152 Bundle bundle = new Bundle(); |
| 153 for (Map.Entry<String, String> header : extraHeaders.entrySet()) { | 153 for (Map.Entry<String, String> header : extraHeaders.entrySet()) { |
| 154 bundle.putString(header.getKey(), header.getValue()); | 154 bundle.putString(header.getKey(), header.getValue()); |
| 155 } | 155 } |
| 156 intent.putExtra(Browser.EXTRA_HEADERS, bundle); | 156 intent.putExtra(Browser.EXTRA_HEADERS, bundle); |
| 157 } | 157 } |
| 158 | 158 |
| 159 intent.putExtra(IntentHandler.EXTRA_TAB_ID, assignedTabId); | 159 intent.putExtra(IntentHandler.EXTRA_TAB_ID, assignedTabId); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 184 * Passes the supplied web app launch intent to the IntentHandler. | 184 * Passes the supplied web app launch intent to the IntentHandler. |
| 185 * @param intent Web app launch intent. | 185 * @param intent Web app launch intent. |
| 186 */ | 186 */ |
| 187 public void createNewStandaloneFrame(Intent intent) { | 187 public void createNewStandaloneFrame(Intent intent) { |
| 188 assert intent != null; | 188 assert intent != null; |
| 189 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | 189 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
| 190 | ApiCompatibilityUtils.getActivityNewDocumentFlag()); | 190 | ApiCompatibilityUtils.getActivityNewDocumentFlag()); |
| 191 IntentHandler.startActivityForTrustedIntent(intent); | 191 IntentHandler.startActivityForTrustedIntent(intent); |
| 192 } | 192 } |
| 193 } | 193 } |
| OLD | NEW |