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 org.chromium.base.VisibleForTesting; | 7 import org.chromium.base.VisibleForTesting; |
8 import org.chromium.base.metrics.RecordHistogram; | 8 import org.chromium.base.metrics.RecordHistogram; |
9 import org.chromium.chrome.R; | 9 import org.chromium.chrome.R; |
10 import org.chromium.chrome.browser.ChromeApplication; | 10 import org.chromium.chrome.browser.ChromeApplication; |
(...skipping 20 matching lines...) Expand all Loading... |
31 private ExternalNavigationHandler.OverrideUrlLoadingResult mLastOverrideUrlL
oadingResult = | 31 private ExternalNavigationHandler.OverrideUrlLoadingResult mLastOverrideUrlL
oadingResult = |
32 ExternalNavigationHandler.OverrideUrlLoadingResult.NO_OVERRIDE; | 32 ExternalNavigationHandler.OverrideUrlLoadingResult.NO_OVERRIDE; |
33 | 33 |
34 /** | 34 /** |
35 * Whether forward history should be cleared after navigation is committed. | 35 * Whether forward history should be cleared after navigation is committed. |
36 */ | 36 */ |
37 private boolean mClearAllForwardHistoryRequired; | 37 private boolean mClearAllForwardHistoryRequired; |
38 private boolean mShouldClearRedirectHistoryForTabClobbering; | 38 private boolean mShouldClearRedirectHistoryForTabClobbering; |
39 | 39 |
40 /** | 40 /** |
41 * Default constructor of {@link InterceptNavigationDelegateImpl}. | 41 * Creates {@link InterceptNavigationDelegateImpl} with default arguments. |
| 42 * @param tab The associated tab. |
| 43 * @return The InterceptNavigationDelegateImpl. |
42 */ | 44 */ |
43 public InterceptNavigationDelegateImpl(Tab tab) { | 45 public static InterceptNavigationDelegateImpl createDefault(Tab tab) { |
44 this(new ExternalNavigationHandler(tab), tab); | 46 return new InterceptNavigationDelegateImpl( |
| 47 ExternalNavigationHandler.createDefault(tab), tab); |
45 } | 48 } |
46 | 49 |
47 /** | 50 /** |
48 * Constructs a new instance of {@link InterceptNavigationDelegateImpl} with
the given | 51 * Constructs a new instance of {@link InterceptNavigationDelegateImpl} with
the given |
49 * {@link ExternalNavigationHandler}. | 52 * {@link ExternalNavigationHandler}. |
50 */ | 53 */ |
51 public InterceptNavigationDelegateImpl(ExternalNavigationHandler externalNav
Handler, Tab tab) { | 54 public InterceptNavigationDelegateImpl(ExternalNavigationHandler externalNav
Handler, Tab tab) { |
52 mTab = tab; | 55 mTab = tab; |
53 mExternalNavHandler = externalNavHandler; | 56 mExternalNavHandler = externalNavHandler; |
54 mAuthenticatorHelper = ((ChromeApplication) mTab.getApplicationContext()
) | 57 mAuthenticatorHelper = ((ChromeApplication) mTab.getApplicationContext()
) |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 } | 249 } |
247 | 250 |
248 private void logBlockedNavigationToDevToolsConsole(String url) { | 251 private void logBlockedNavigationToDevToolsConsole(String url) { |
249 int resId = mExternalNavHandler.canExternalAppHandleUrl(url) | 252 int resId = mExternalNavHandler.canExternalAppHandleUrl(url) |
250 ? R.string.blocked_navigation_warning | 253 ? R.string.blocked_navigation_warning |
251 : R.string.unreachable_navigation_warning; | 254 : R.string.unreachable_navigation_warning; |
252 mTab.getWebContents().addMessageToDevToolsConsole( | 255 mTab.getWebContents().addMessageToDevToolsConsole( |
253 ConsoleMessageLevel.WARNING, mTab.getApplicationContext().getStr
ing(resId, url)); | 256 ConsoleMessageLevel.WARNING, mTab.getApplicationContext().getStr
ing(resId, url)); |
254 } | 257 } |
255 } | 258 } |
OLD | NEW |