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.tabmodel; | 5 package org.chromium.chrome.browser.tabmodel; |
6 | 6 |
7 import android.content.Intent; | 7 import android.content.Intent; |
8 import android.os.Handler; | 8 import android.os.Handler; |
9 import android.text.TextUtils; | 9 import android.text.TextUtils; |
10 | 10 |
11 import org.chromium.base.SysUtils; | 11 import org.chromium.base.SysUtils; |
12 import org.chromium.base.TraceEvent; | 12 import org.chromium.base.TraceEvent; |
13 import org.chromium.chrome.R; | 13 import org.chromium.chrome.R; |
14 import org.chromium.chrome.browser.ChromeActivity; | 14 import org.chromium.chrome.browser.ChromeActivity; |
15 import org.chromium.chrome.browser.IntentHandler; | 15 import org.chromium.chrome.browser.IntentHandler; |
16 import org.chromium.chrome.browser.ServiceTabLauncher; | 16 import org.chromium.chrome.browser.ServiceTabLauncher; |
17 import org.chromium.chrome.browser.TabState; | 17 import org.chromium.chrome.browser.TabState; |
18 import org.chromium.chrome.browser.compositor.layouts.content.TabContentManager; | 18 import org.chromium.chrome.browser.compositor.layouts.content.TabContentManager; |
19 import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings; | 19 import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings; |
20 import org.chromium.chrome.browser.tab.Tab; | 20 import org.chromium.chrome.browser.tab.Tab; |
21 import org.chromium.chrome.browser.tab.TabDelegateFactory; | 21 import org.chromium.chrome.browser.tab.TabDelegateFactory; |
22 import org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType; | 22 import org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType; |
23 import org.chromium.chrome.browser.util.IntentUtils; | 23 import org.chromium.chrome.browser.util.IntentUtils; |
24 import org.chromium.chrome.browser.util.UrlUtilities; | 24 import org.chromium.components.url_formatter.UrlFormatter; |
25 import org.chromium.content_public.browser.LoadUrlParams; | 25 import org.chromium.content_public.browser.LoadUrlParams; |
26 import org.chromium.content_public.browser.WebContents; | 26 import org.chromium.content_public.browser.WebContents; |
27 import org.chromium.content_public.common.Referrer; | 27 import org.chromium.content_public.common.Referrer; |
28 import org.chromium.ui.base.PageTransition; | 28 import org.chromium.ui.base.PageTransition; |
29 import org.chromium.ui.base.WindowAndroid; | 29 import org.chromium.ui.base.WindowAndroid; |
30 import org.chromium.ui.widget.Toast; | 30 import org.chromium.ui.widget.Toast; |
31 | 31 |
32 /** | 32 /** |
33 * This class creates various kinds of new tabs and adds them to the right {@lin
k TabModel}. | 33 * This class creates various kinds of new tabs and adds them to the right {@lin
k TabModel}. |
34 */ | 34 */ |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 * @param intent the source of the url if it isn't null. | 99 * @param intent the source of the url if it isn't null. |
100 * @return The new tab. | 100 * @return The new tab. |
101 */ | 101 */ |
102 private Tab createNewTab(LoadUrlParams loadUrlParams, TabModel.TabLaunchType
type, | 102 private Tab createNewTab(LoadUrlParams loadUrlParams, TabModel.TabLaunchType
type, |
103 Tab parent, int position, Intent intent) { | 103 Tab parent, int position, Intent intent) { |
104 try { | 104 try { |
105 TraceEvent.begin("ChromeTabCreator.createNewTab"); | 105 TraceEvent.begin("ChromeTabCreator.createNewTab"); |
106 int parentId = parent != null ? parent.getId() : Tab.INVALID_TAB_ID; | 106 int parentId = parent != null ? parent.getId() : Tab.INVALID_TAB_ID; |
107 | 107 |
108 // Sanitize the url. | 108 // Sanitize the url. |
109 loadUrlParams.setUrl(UrlUtilities.fixupUrl(loadUrlParams.getUrl())); | 109 loadUrlParams.setUrl(UrlFormatter.fixupUrl(loadUrlParams.getUrl())); |
110 loadUrlParams.setTransitionType(getTransitionType(type, intent)); | 110 loadUrlParams.setTransitionType(getTransitionType(type, intent)); |
111 | 111 |
112 // Check if the tab is being created asynchronously. | 112 // Check if the tab is being created asynchronously. |
113 int assignedTabId = intent == null ? Tab.INVALID_TAB_ID : IntentUtil
s.safeGetIntExtra( | 113 int assignedTabId = intent == null ? Tab.INVALID_TAB_ID : IntentUtil
s.safeGetIntExtra( |
114 intent, IntentHandler.EXTRA_TAB_ID, Tab.INVALID_TAB_ID); | 114 intent, IntentHandler.EXTRA_TAB_ID, Tab.INVALID_TAB_ID); |
115 AsyncTabParams asyncParams = | 115 AsyncTabParams asyncParams = |
116 AsyncTabParamsManager.remove(assignedTabId); | 116 AsyncTabParamsManager.remove(assignedTabId); |
117 | 117 |
118 boolean openInForeground = mOrderController.willOpenInForeground(typ
e, mIncognito); | 118 boolean openInForeground = mOrderController.willOpenInForeground(typ
e, mIncognito); |
119 TabDelegateFactory delegateFactory = parent == null ? new TabDelegat
eFactory() | 119 TabDelegateFactory delegateFactory = parent == null ? new TabDelegat
eFactory() |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 * Sets the tab model and tab content manager to use. | 339 * Sets the tab model and tab content manager to use. |
340 * @param model The new {@link TabModel} to use. | 340 * @param model The new {@link TabModel} to use. |
341 * @param manager The new {@link TabContentManager} to use. | 341 * @param manager The new {@link TabContentManager} to use. |
342 */ | 342 */ |
343 public void setTabModel(TabModel model, TabContentManager manager) { | 343 public void setTabModel(TabModel model, TabContentManager manager) { |
344 mTabModel = model; | 344 mTabModel = model; |
345 mTabContentManager = manager; | 345 mTabContentManager = manager; |
346 } | 346 } |
347 | 347 |
348 } | 348 } |
OLD | NEW |