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.annotation.TargetApi; | 7 import android.annotation.TargetApi; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.content.Intent; | 9 import android.content.Intent; |
10 import android.graphics.Rect; | 10 import android.graphics.Rect; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 import org.chromium.chrome.browser.contextualsearch.ContextualSearchTabHelper; | 42 import org.chromium.chrome.browser.contextualsearch.ContextualSearchTabHelper; |
43 import org.chromium.chrome.browser.crash.MinidumpUploadService; | 43 import org.chromium.chrome.browser.crash.MinidumpUploadService; |
44 import org.chromium.chrome.browser.dom_distiller.ReaderModeActivityDelegate; | 44 import org.chromium.chrome.browser.dom_distiller.ReaderModeActivityDelegate; |
45 import org.chromium.chrome.browser.dom_distiller.ReaderModeManager; | 45 import org.chromium.chrome.browser.dom_distiller.ReaderModeManager; |
46 import org.chromium.chrome.browser.download.ChromeDownloadDelegate; | 46 import org.chromium.chrome.browser.download.ChromeDownloadDelegate; |
47 import org.chromium.chrome.browser.externalnav.ExternalNavigationHandler; | 47 import org.chromium.chrome.browser.externalnav.ExternalNavigationHandler; |
48 import org.chromium.chrome.browser.externalnav.ExternalNavigationHandler.Overrid
eUrlLoadingResult; | 48 import org.chromium.chrome.browser.externalnav.ExternalNavigationHandler.Overrid
eUrlLoadingResult; |
49 import org.chromium.chrome.browser.externalnav.ExternalNavigationParams; | 49 import org.chromium.chrome.browser.externalnav.ExternalNavigationParams; |
50 import org.chromium.chrome.browser.fullscreen.FullscreenManager; | 50 import org.chromium.chrome.browser.fullscreen.FullscreenManager; |
51 import org.chromium.chrome.browser.media.MediaNotificationService; | 51 import org.chromium.chrome.browser.media.MediaNotificationService; |
| 52 import org.chromium.chrome.browser.media.ui.MediaSessionTabHelper; |
52 import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings; | 53 import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings; |
53 import org.chromium.chrome.browser.ntp.NativePageAssassin; | 54 import org.chromium.chrome.browser.ntp.NativePageAssassin; |
54 import org.chromium.chrome.browser.ntp.NativePageFactory; | 55 import org.chromium.chrome.browser.ntp.NativePageFactory; |
55 import org.chromium.chrome.browser.omnibox.geo.GeolocationHeader; | 56 import org.chromium.chrome.browser.omnibox.geo.GeolocationHeader; |
56 import org.chromium.chrome.browser.policy.PolicyAuditor; | 57 import org.chromium.chrome.browser.policy.PolicyAuditor; |
57 import org.chromium.chrome.browser.policy.PolicyAuditor.AuditEvent; | 58 import org.chromium.chrome.browser.policy.PolicyAuditor.AuditEvent; |
58 import org.chromium.chrome.browser.preferences.PrefServiceBridge; | 59 import org.chromium.chrome.browser.preferences.PrefServiceBridge; |
59 import org.chromium.chrome.browser.rlz.RevenueStats; | 60 import org.chromium.chrome.browser.rlz.RevenueStats; |
60 import org.chromium.chrome.browser.search_engines.TemplateUrlService; | 61 import org.chromium.chrome.browser.search_engines.TemplateUrlService; |
61 import org.chromium.chrome.browser.tab.BackgroundContentViewHelper.BackgroundCon
tentViewDelegate; | 62 import org.chromium.chrome.browser.tab.BackgroundContentViewHelper.BackgroundCon
tentViewDelegate; |
(...skipping 26 matching lines...) Expand all Loading... |
88 | 89 |
89 import java.util.Locale; | 90 import java.util.Locale; |
90 | 91 |
91 /** | 92 /** |
92 * A representation of a Tab for Chrome. This manages wrapping a WebContents and
interacting with | 93 * A representation of a Tab for Chrome. This manages wrapping a WebContents and
interacting with |
93 * most of Chromium while representing a consistent version of web content to th
e front end. | 94 * most of Chromium while representing a consistent version of web content to th
e front end. |
94 */ | 95 */ |
95 public class ChromeTab extends Tab { | 96 public class ChromeTab extends Tab { |
96 public static final int NTP_TAB_ID = -2; | 97 public static final int NTP_TAB_ID = -2; |
97 | 98 |
98 private static final String TAG = "ChromeTab"; | 99 private static final String TAG = "cr.ChromeTab"; |
99 | 100 |
100 // URL didFailLoad error code. Should match the value in net_error_list.h. | 101 // URL didFailLoad error code. Should match the value in net_error_list.h. |
101 public static final int BLOCKED_BY_ADMINISTRATOR = -22; | 102 public static final int BLOCKED_BY_ADMINISTRATOR = -22; |
102 | 103 |
103 public static final String PAGESPEED_PASSTHROUGH_HEADERS = | 104 public static final String PAGESPEED_PASSTHROUGH_HEADERS = |
104 "Chrome-Proxy: pass-through\nCache-Control: no-cache"; | 105 "Chrome-Proxy: pass-through\nCache-Control: no-cache"; |
105 | 106 |
106 private static final int MSG_ID_ENABLE_FULLSCREEN_AFTER_LOAD = 1; | 107 private static final int MSG_ID_ENABLE_FULLSCREEN_AFTER_LOAD = 1; |
107 | 108 |
108 /** The maximum amount of time to wait for a page to load before entering fu
llscreen. -1 means | 109 /** The maximum amount of time to wait for a page to load before entering fu
llscreen. -1 means |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 CipherFactory.getInstance().triggerKeyGeneration(); | 224 CipherFactory.getInstance().triggerKeyGeneration(); |
224 } | 225 } |
225 | 226 |
226 mReaderModeManager = new ReaderModeManager(this, activity); | 227 mReaderModeManager = new ReaderModeManager(this, activity); |
227 RevenueStats.getInstance().tabCreated(this); | 228 RevenueStats.getInstance().tabCreated(this); |
228 | 229 |
229 mTabRedirectHandler = new TabRedirectHandler(activity); | 230 mTabRedirectHandler = new TabRedirectHandler(activity); |
230 | 231 |
231 ContextualSearchTabHelper.createForTab(this); | 232 ContextualSearchTabHelper.createForTab(this); |
232 if (nativeWindow != null) ThumbnailTabHelper.createForTab(this); | 233 if (nativeWindow != null) ThumbnailTabHelper.createForTab(this); |
| 234 MediaSessionTabHelper.createForTab(this); |
233 } | 235 } |
234 | 236 |
235 /** | 237 /** |
236 * Creates a minimal {@link ChromeTab} for testing. Do not use outside testi
ng. | 238 * Creates a minimal {@link ChromeTab} for testing. Do not use outside testi
ng. |
237 * | 239 * |
238 * @param id The id of the tab. | 240 * @param id The id of the tab. |
239 * @param incognito Whether the tab is incognito. | 241 * @param incognito Whether the tab is incognito. |
240 */ | 242 */ |
241 @VisibleForTesting | 243 @VisibleForTesting |
242 public ChromeTab(int id, boolean incognito) { | 244 public ChromeTab(int id, boolean incognito) { |
(...skipping 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1434 didFinishPageLoad(); | 1436 didFinishPageLoad(); |
1435 } | 1437 } |
1436 } | 1438 } |
1437 }; | 1439 }; |
1438 | 1440 |
1439 @VisibleForTesting | 1441 @VisibleForTesting |
1440 public OverrideUrlLoadingResult getLastOverrideUrlLoadingResultForTests() { | 1442 public OverrideUrlLoadingResult getLastOverrideUrlLoadingResultForTests() { |
1441 return mLastOverrideUrlLoadingResult; | 1443 return mLastOverrideUrlLoadingResult; |
1442 } | 1444 } |
1443 } | 1445 } |
OLD | NEW |