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; | 5 package org.chromium.chrome.browser; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.graphics.Bitmap; | 9 import android.graphics.Bitmap; |
10 import android.graphics.Color; | 10 import android.graphics.Color; |
(...skipping 24 matching lines...) Expand all Loading... |
35 import org.chromium.chrome.browser.contextmenu.ContextMenuParams; | 35 import org.chromium.chrome.browser.contextmenu.ContextMenuParams; |
36 import org.chromium.chrome.browser.contextmenu.ContextMenuPopulator; | 36 import org.chromium.chrome.browser.contextmenu.ContextMenuPopulator; |
37 import org.chromium.chrome.browser.contextmenu.ContextMenuPopulatorWrapper; | 37 import org.chromium.chrome.browser.contextmenu.ContextMenuPopulatorWrapper; |
38 import org.chromium.chrome.browser.contextmenu.EmptyChromeContextMenuItemDelegat
e; | 38 import org.chromium.chrome.browser.contextmenu.EmptyChromeContextMenuItemDelegat
e; |
39 import org.chromium.chrome.browser.fullscreen.FullscreenManager; | 39 import org.chromium.chrome.browser.fullscreen.FullscreenManager; |
40 import org.chromium.chrome.browser.infobar.InfoBarContainer; | 40 import org.chromium.chrome.browser.infobar.InfoBarContainer; |
41 import org.chromium.chrome.browser.metrics.UmaSessionStats; | 41 import org.chromium.chrome.browser.metrics.UmaSessionStats; |
42 import org.chromium.chrome.browser.metrics.UmaUtils; | 42 import org.chromium.chrome.browser.metrics.UmaUtils; |
43 import org.chromium.chrome.browser.printing.TabPrinter; | 43 import org.chromium.chrome.browser.printing.TabPrinter; |
44 import org.chromium.chrome.browser.profiles.Profile; | 44 import org.chromium.chrome.browser.profiles.Profile; |
45 import org.chromium.chrome.browser.ssl.ConnectionSecurityHelper; | |
46 import org.chromium.chrome.browser.ssl.ConnectionSecurityHelperSecurityLevel; | |
47 import org.chromium.chrome.browser.tab.SadTabViewFactory; | 45 import org.chromium.chrome.browser.tab.SadTabViewFactory; |
48 import org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType; | 46 import org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType; |
49 import org.chromium.chrome.browser.tabmodel.TabModel.TabSelectionType; | 47 import org.chromium.chrome.browser.tabmodel.TabModel.TabSelectionType; |
50 import org.chromium.chrome.browser.tabmodel.TabModelBase; | 48 import org.chromium.chrome.browser.tabmodel.TabModelBase; |
51 import org.chromium.chrome.browser.tabmodel.TabModelSelector; | 49 import org.chromium.chrome.browser.tabmodel.TabModelSelector; |
| 50 import org.chromium.chrome.browser.toolbar.ToolbarModel; |
| 51 import org.chromium.chrome.browser.ui.toolbar.ToolbarModelSecurityLevel; |
52 import org.chromium.components.navigation_interception.InterceptNavigationDelega
te; | 52 import org.chromium.components.navigation_interception.InterceptNavigationDelega
te; |
53 import org.chromium.content.browser.ContentView; | 53 import org.chromium.content.browser.ContentView; |
54 import org.chromium.content.browser.ContentViewClient; | 54 import org.chromium.content.browser.ContentViewClient; |
55 import org.chromium.content.browser.ContentViewCore; | 55 import org.chromium.content.browser.ContentViewCore; |
56 import org.chromium.content_public.browser.InvalidateTypes; | 56 import org.chromium.content_public.browser.InvalidateTypes; |
57 import org.chromium.content_public.browser.LoadUrlParams; | 57 import org.chromium.content_public.browser.LoadUrlParams; |
58 import org.chromium.content_public.browser.WebContents; | 58 import org.chromium.content_public.browser.WebContents; |
59 import org.chromium.content_public.browser.WebContentsObserver; | 59 import org.chromium.content_public.browser.WebContentsObserver; |
60 import org.chromium.content_public.common.Referrer; | 60 import org.chromium.content_public.common.Referrer; |
61 import org.chromium.content_public.common.TopControlsState; | 61 import org.chromium.content_public.common.TopControlsState; |
(...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1137 | 1137 |
1138 /** | 1138 /** |
1139 * @return Whether or not the {@link ContentViewCore} is using a desktop use
r agent. | 1139 * @return Whether or not the {@link ContentViewCore} is using a desktop use
r agent. |
1140 */ | 1140 */ |
1141 public boolean getUseDesktopUserAgent() { | 1141 public boolean getUseDesktopUserAgent() { |
1142 return getWebContents() != null && getWebContents().getNavigationControl
ler() | 1142 return getWebContents() != null && getWebContents().getNavigationControl
ler() |
1143 .getUseDesktopUserAgent(); | 1143 .getUseDesktopUserAgent(); |
1144 } | 1144 } |
1145 | 1145 |
1146 /** | 1146 /** |
1147 * @return The current {@link ConnectionSecurityHelperSecurityLevel} for the
tab. | 1147 * @return The current {ToolbarModelSecurityLevel} for the tab. |
1148 */ | 1148 */ |
1149 // TODO(tedchoc): Remove this and transition all clients to use ToolbarModel
directly. | 1149 // TODO(tedchoc): Remove this and transition all clients to use ToolbarModel
directly. |
1150 public int getSecurityLevel() { | 1150 public int getSecurityLevel() { |
1151 return ConnectionSecurityHelper.getSecurityLevelForWebContents(getWebCon
tents()); | 1151 return ToolbarModel.getSecurityLevelForWebContents(getWebContents()); |
1152 } | 1152 } |
1153 | 1153 |
1154 /** | 1154 /** |
1155 * @return The sync id of the tab if session sync is enabled, {@code 0} othe
rwise. | 1155 * @return The sync id of the tab if session sync is enabled, {@code 0} othe
rwise. |
1156 */ | 1156 */ |
1157 @CalledByNative | 1157 @CalledByNative |
1158 protected int getSyncId() { | 1158 protected int getSyncId() { |
1159 return mSyncId; | 1159 return mSyncId; |
1160 } | 1160 } |
1161 | 1161 |
(...skipping 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2443 | 2443 |
2444 /** | 2444 /** |
2445 * @return Whether hiding top controls is enabled or not. | 2445 * @return Whether hiding top controls is enabled or not. |
2446 */ | 2446 */ |
2447 protected boolean isHidingTopControlsEnabled() { | 2447 protected boolean isHidingTopControlsEnabled() { |
2448 String url = getUrl(); | 2448 String url = getUrl(); |
2449 boolean enableHidingTopControls = url != null && !url.startsWith(UrlCons
tants.CHROME_SCHEME) | 2449 boolean enableHidingTopControls = url != null && !url.startsWith(UrlCons
tants.CHROME_SCHEME) |
2450 && !url.startsWith(UrlConstants.CHROME_NATIVE_SCHEME); | 2450 && !url.startsWith(UrlConstants.CHROME_NATIVE_SCHEME); |
2451 | 2451 |
2452 int securityState = getSecurityLevel(); | 2452 int securityState = getSecurityLevel(); |
2453 enableHidingTopControls &= | 2453 enableHidingTopControls &= (securityState != ToolbarModelSecurityLevel.S
ECURITY_ERROR |
2454 (securityState != ConnectionSecurityHelperSecurityLevel.SECURITY
_ERROR | 2454 && securityState != ToolbarModelSecurityLevel.SECURITY_WARNING); |
2455 && securityState != ConnectionSecurityHelperSecurityLeve
l.SECURITY_WARNING); | |
2456 | 2455 |
2457 enableHidingTopControls &= | 2456 enableHidingTopControls &= |
2458 !AccessibilityUtil.isAccessibilityEnabled(getApplicationContext(
)); | 2457 !AccessibilityUtil.isAccessibilityEnabled(getApplicationContext(
)); |
2459 enableHidingTopControls &= !mIsImeShowing; | 2458 enableHidingTopControls &= !mIsImeShowing; |
2460 enableHidingTopControls &= !mIsShowingErrorPage; | 2459 enableHidingTopControls &= !mIsShowingErrorPage; |
2461 enableHidingTopControls &= !getWebContents().isShowingInterstitialPage()
; | 2460 enableHidingTopControls &= !getWebContents().isShowingInterstitialPage()
; |
2462 | 2461 |
2463 return enableHidingTopControls; | 2462 return enableHidingTopControls; |
2464 } | 2463 } |
2465 | 2464 |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2775 private native void nativeAttachToTabContentManager(long nativeTabAndroid, | 2774 private native void nativeAttachToTabContentManager(long nativeTabAndroid, |
2776 TabContentManager tabContentManager); | 2775 TabContentManager tabContentManager); |
2777 private native void nativeAttachOverlayContentViewCore(long nativeTabAndroid
, | 2776 private native void nativeAttachOverlayContentViewCore(long nativeTabAndroid
, |
2778 ContentViewCore content, boolean visible); | 2777 ContentViewCore content, boolean visible); |
2779 private native void nativeDetachOverlayContentViewCore(long nativeTabAndroid
, | 2778 private native void nativeDetachOverlayContentViewCore(long nativeTabAndroid
, |
2780 ContentViewCore content); | 2779 ContentViewCore content); |
2781 private native boolean nativeHasPrerenderedUrl(long nativeTabAndroid, String
url); | 2780 private native boolean nativeHasPrerenderedUrl(long nativeTabAndroid, String
url); |
2782 | 2781 |
2783 private static native void nativeRecordStartupToCommitUma(); | 2782 private static native void nativeRecordStartupToCommitUma(); |
2784 } | 2783 } |
OLD | NEW |