| 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; |
| 11 import android.view.ContextMenu; | 11 import android.view.ContextMenu; |
| 12 import android.view.View; | 12 import android.view.View; |
| 13 | 13 |
| 14 import org.chromium.base.CalledByNative; | 14 import org.chromium.base.CalledByNative; |
| 15 import org.chromium.base.ObserverList; | 15 import org.chromium.base.ObserverList; |
| 16 import org.chromium.base.TraceEvent; | 16 import org.chromium.base.TraceEvent; |
| 17 import org.chromium.base.VisibleForTesting; | 17 import org.chromium.base.VisibleForTesting; |
| 18 import org.chromium.chrome.R; | 18 import org.chromium.chrome.R; |
| 19 import org.chromium.chrome.browser.banners.AppBannerManager; | 19 import org.chromium.chrome.browser.banners.AppBannerManager; |
| 20 import org.chromium.chrome.browser.contextmenu.ChromeContextMenuItemDelegate; | 20 import org.chromium.chrome.browser.contextmenu.ChromeContextMenuItemDelegate; |
| 21 import org.chromium.chrome.browser.contextmenu.ChromeContextMenuPopulator; | 21 import org.chromium.chrome.browser.contextmenu.ChromeContextMenuPopulator; |
| 22 import org.chromium.chrome.browser.contextmenu.ContextMenuParams; | 22 import org.chromium.chrome.browser.contextmenu.ContextMenuParams; |
| 23 import org.chromium.chrome.browser.contextmenu.ContextMenuPopulator; | 23 import org.chromium.chrome.browser.contextmenu.ContextMenuPopulator; |
| 24 import org.chromium.chrome.browser.contextmenu.ContextMenuPopulatorWrapper; | 24 import org.chromium.chrome.browser.contextmenu.ContextMenuPopulatorWrapper; |
| 25 import org.chromium.chrome.browser.contextmenu.EmptyChromeContextMenuItemDelegat
e; | 25 import org.chromium.chrome.browser.contextmenu.EmptyChromeContextMenuItemDelegat
e; |
| 26 import org.chromium.chrome.browser.dom_distiller.DomDistillerFeedbackReporter; | 26 import org.chromium.chrome.browser.dom_distiller.DomDistillerFeedbackReporter; |
| 27 import org.chromium.chrome.browser.fullscreen.FullscreenManager; |
| 27 import org.chromium.chrome.browser.infobar.InfoBarContainer; | 28 import org.chromium.chrome.browser.infobar.InfoBarContainer; |
| 28 import org.chromium.chrome.browser.printing.TabPrinter; | 29 import org.chromium.chrome.browser.printing.TabPrinter; |
| 29 import org.chromium.chrome.browser.profiles.Profile; | 30 import org.chromium.chrome.browser.profiles.Profile; |
| 30 import org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType; | 31 import org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType; |
| 32 import org.chromium.chrome.browser.tabmodel.TabModelBase; |
| 31 import org.chromium.chrome.browser.toolbar.ToolbarModel; | 33 import org.chromium.chrome.browser.toolbar.ToolbarModel; |
| 34 import org.chromium.chrome.browser.ui.toolbar.ToolbarModelSecurityLevel; |
| 32 import org.chromium.content.browser.ContentView; | 35 import org.chromium.content.browser.ContentView; |
| 33 import org.chromium.content.browser.ContentViewClient; | 36 import org.chromium.content.browser.ContentViewClient; |
| 34 import org.chromium.content.browser.ContentViewCore; | 37 import org.chromium.content.browser.ContentViewCore; |
| 35 import org.chromium.content.browser.WebContentsObserver; | 38 import org.chromium.content.browser.WebContentsObserver; |
| 36 import org.chromium.content_public.browser.LoadUrlParams; | 39 import org.chromium.content_public.browser.LoadUrlParams; |
| 37 import org.chromium.content_public.browser.WebContents; | 40 import org.chromium.content_public.browser.WebContents; |
| 41 import org.chromium.content_public.common.TopControlsState; |
| 38 import org.chromium.printing.PrintManagerDelegateImpl; | 42 import org.chromium.printing.PrintManagerDelegateImpl; |
| 39 import org.chromium.printing.PrintingController; | 43 import org.chromium.printing.PrintingController; |
| 40 import org.chromium.printing.PrintingControllerImpl; | 44 import org.chromium.printing.PrintingControllerImpl; |
| 41 import org.chromium.ui.base.Clipboard; | 45 import org.chromium.ui.base.Clipboard; |
| 42 import org.chromium.ui.base.WindowAndroid; | 46 import org.chromium.ui.base.WindowAndroid; |
| 43 import org.chromium.ui.gfx.DeviceDisplayInfo; | 47 import org.chromium.ui.gfx.DeviceDisplayInfo; |
| 44 | 48 |
| 45 import java.nio.ByteBuffer; | 49 import java.nio.ByteBuffer; |
| 46 import java.util.concurrent.atomic.AtomicInteger; | 50 import java.util.concurrent.atomic.AtomicInteger; |
| 47 | 51 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 /** | 164 /** |
| 161 * Saves how this tab was launched (from a link, external app, etc) so that | 165 * Saves how this tab was launched (from a link, external app, etc) so that |
| 162 * we can determine the different circumstances in which it should be | 166 * we can determine the different circumstances in which it should be |
| 163 * closed. For example, a tab opened from an external app should be closed | 167 * closed. For example, a tab opened from an external app should be closed |
| 164 * when the back stack is empty and the user uses the back hardware key. A | 168 * when the back stack is empty and the user uses the back hardware key. A |
| 165 * standard tab however should be kept open and the entire activity should | 169 * standard tab however should be kept open and the entire activity should |
| 166 * be moved to the background. | 170 * be moved to the background. |
| 167 */ | 171 */ |
| 168 private final TabLaunchType mLaunchType; | 172 private final TabLaunchType mLaunchType; |
| 169 | 173 |
| 174 private FullscreenManager mFullscreenManager; |
| 175 private float mPreviousFullscreenTopControlsOffsetY = Float.NaN; |
| 176 private float mPreviousFullscreenContentOffsetY = Float.NaN; |
| 177 private float mPreviousFullscreenOverdrawBottomHeight = Float.NaN; |
| 178 private int mFullscreenHungRendererToken = FullscreenManager.INVALID_TOKEN; |
| 179 |
| 170 /** | 180 /** |
| 171 * A default {@link ChromeContextMenuItemDelegate} that supports some of the
context menu | 181 * A default {@link ChromeContextMenuItemDelegate} that supports some of the
context menu |
| 172 * functionality. | 182 * functionality. |
| 173 */ | 183 */ |
| 174 protected class TabChromeContextMenuItemDelegate | 184 protected class TabChromeContextMenuItemDelegate |
| 175 extends EmptyChromeContextMenuItemDelegate { | 185 extends EmptyChromeContextMenuItemDelegate { |
| 176 private final Clipboard mClipboard; | 186 private final Clipboard mClipboard; |
| 177 | 187 |
| 178 /** | 188 /** |
| 179 * Builds a {@link TabChromeContextMenuItemDelegate} instance. | 189 * Builds a {@link TabChromeContextMenuItemDelegate} instance. |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 public void run() { | 254 public void run() { |
| 245 getWebContents().getNavigationController().continueP
endingReload(); | 255 getWebContents().getNavigationController().continueP
endingReload(); |
| 246 } | 256 } |
| 247 }); | 257 }); |
| 248 Activity activity = (Activity) mContext; | 258 Activity activity = (Activity) mContext; |
| 249 warningDialog.show(activity.getFragmentManager(), null); | 259 warningDialog.show(activity.getFragmentManager(), null); |
| 250 } | 260 } |
| 251 | 261 |
| 252 @Override | 262 @Override |
| 253 public void toggleFullscreenModeForTab(boolean enableFullscreen) { | 263 public void toggleFullscreenModeForTab(boolean enableFullscreen) { |
| 264 if (mFullscreenManager != null) { |
| 265 mFullscreenManager.setPersistentFullscreenMode(enableFullscreen)
; |
| 266 } |
| 267 |
| 254 for (TabObserver observer : mObservers) { | 268 for (TabObserver observer : mObservers) { |
| 255 observer.onToggleFullscreenMode(Tab.this, enableFullscreen); | 269 observer.onToggleFullscreenMode(Tab.this, enableFullscreen); |
| 256 } | 270 } |
| 257 } | 271 } |
| 258 | 272 |
| 259 @Override | 273 @Override |
| 260 public void navigationStateChanged(int flags) { | 274 public void navigationStateChanged(int flags) { |
| 261 if ((flags & INVALIDATE_TYPE_TITLE) != 0) { | 275 if ((flags & INVALIDATE_TYPE_TITLE) != 0) { |
| 262 for (TabObserver observer : mObservers) observer.onTitleUpdated(
Tab.this); | 276 for (TabObserver observer : mObservers) observer.onTitleUpdated(
Tab.this); |
| 263 } | 277 } |
| 264 if ((flags & INVALIDATE_TYPE_URL) != 0) { | 278 if ((flags & INVALIDATE_TYPE_URL) != 0) { |
| 265 for (TabObserver observer : mObservers) observer.onUrlUpdated(Ta
b.this); | 279 for (TabObserver observer : mObservers) observer.onUrlUpdated(Ta
b.this); |
| 266 } | 280 } |
| 267 } | 281 } |
| 268 | 282 |
| 269 @Override | 283 @Override |
| 270 public void visibleSSLStateChanged() { | 284 public void visibleSSLStateChanged() { |
| 271 for (TabObserver observer : mObservers) observer.onSSLStateUpdated(T
ab.this); | 285 for (TabObserver observer : mObservers) observer.onSSLStateUpdated(T
ab.this); |
| 272 } | 286 } |
| 273 | 287 |
| 274 @Override | 288 @Override |
| 275 public void webContentsCreated(long sourceWebContents, long openerRender
FrameId, | 289 public void webContentsCreated(long sourceWebContents, long openerRender
FrameId, |
| 276 String frameName, String targetUrl, long newWebContents) { | 290 String frameName, String targetUrl, long newWebContents) { |
| 277 for (TabObserver observer : mObservers) { | 291 for (TabObserver observer : mObservers) { |
| 278 observer.webContentsCreated(Tab.this, sourceWebContents, openerR
enderFrameId, | 292 observer.webContentsCreated(Tab.this, sourceWebContents, openerR
enderFrameId, |
| 279 frameName, targetUrl, newWebContents); | 293 frameName, targetUrl, newWebContents); |
| 280 } | 294 } |
| 281 } | 295 } |
| 296 |
| 297 @Override |
| 298 public void rendererUnresponsive() { |
| 299 super.rendererUnresponsive(); |
| 300 if (mFullscreenManager == null) return; |
| 301 mFullscreenHungRendererToken = |
| 302 mFullscreenManager.showControlsPersistentAndClearOldToken( |
| 303 mFullscreenHungRendererToken); |
| 304 } |
| 305 |
| 306 @Override |
| 307 public void rendererResponsive() { |
| 308 super.rendererResponsive(); |
| 309 if (mFullscreenManager == null) return; |
| 310 mFullscreenManager.hideControlsPersistent(mFullscreenHungRendererTok
en); |
| 311 mFullscreenHungRendererToken = FullscreenManager.INVALID_TOKEN; |
| 312 } |
| 313 |
| 314 @Override |
| 315 public boolean isFullscreenForTabOrPending() { |
| 316 return mFullscreenManager == null |
| 317 ? false : mFullscreenManager.getPersistentFullscreenMode(); |
| 318 } |
| 282 } | 319 } |
| 283 | 320 |
| 284 private class TabContextMenuPopulator extends ContextMenuPopulatorWrapper { | 321 private class TabContextMenuPopulator extends ContextMenuPopulatorWrapper { |
| 285 public TabContextMenuPopulator(ContextMenuPopulator populator) { | 322 public TabContextMenuPopulator(ContextMenuPopulator populator) { |
| 286 super(populator); | 323 super(populator); |
| 287 } | 324 } |
| 288 | 325 |
| 289 @Override | 326 @Override |
| 290 public void buildContextMenu(ContextMenu menu, Context context, ContextM
enuParams params) { | 327 public void buildContextMenu(ContextMenu menu, Context context, ContextM
enuParams params) { |
| 291 super.buildContextMenu(menu, context, params); | 328 super.buildContextMenu(menu, context, params); |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 */ | 826 */ |
| 790 protected void show() { | 827 protected void show() { |
| 791 if (mContentViewCore != null) mContentViewCore.onShow(); | 828 if (mContentViewCore != null) mContentViewCore.onShow(); |
| 792 } | 829 } |
| 793 | 830 |
| 794 /** | 831 /** |
| 795 * Triggers the hiding logic for the view backing the tab. | 832 * Triggers the hiding logic for the view backing the tab. |
| 796 */ | 833 */ |
| 797 protected void hide() { | 834 protected void hide() { |
| 798 if (mContentViewCore != null) mContentViewCore.onHide(); | 835 if (mContentViewCore != null) mContentViewCore.onHide(); |
| 836 |
| 837 // Clean up any fullscreen state that might impact other tabs. |
| 838 if (mFullscreenManager != null) { |
| 839 mFullscreenManager.setPersistentFullscreenMode(false); |
| 840 mFullscreenManager.hideControlsPersistent(mFullscreenHungRendererTok
en); |
| 841 mFullscreenHungRendererToken = FullscreenManager.INVALID_TOKEN; |
| 842 mPreviousFullscreenOverdrawBottomHeight = Float.NaN; |
| 843 } |
| 799 } | 844 } |
| 800 | 845 |
| 801 /** | 846 /** |
| 802 * Shows the given {@code nativePage} if it's not already showing. | 847 * Shows the given {@code nativePage} if it's not already showing. |
| 803 * @param nativePage The {@link NativePage} to show. | 848 * @param nativePage The {@link NativePage} to show. |
| 804 */ | 849 */ |
| 805 protected void showNativePage(NativePage nativePage) { | 850 protected void showNativePage(NativePage nativePage) { |
| 806 if (mNativePage == nativePage) return; | 851 if (mNativePage == nativePage) return; |
| 807 NativePage previousNativePage = mNativePage; | 852 NativePage previousNativePage = mNativePage; |
| 808 mNativePage = nativePage; | 853 mNativePage = nativePage; |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 947 // destroying the native tab cleanups up any remaining infobars. The inf
obar container | 992 // destroying the native tab cleanups up any remaining infobars. The inf
obar container |
| 948 // expects all infobars to be cleaned up before its own destruction. | 993 // expects all infobars to be cleaned up before its own destruction. |
| 949 assert mNativeTabAndroid != 0; | 994 assert mNativeTabAndroid != 0; |
| 950 nativeDestroy(mNativeTabAndroid); | 995 nativeDestroy(mNativeTabAndroid); |
| 951 assert mNativeTabAndroid == 0; | 996 assert mNativeTabAndroid == 0; |
| 952 | 997 |
| 953 if (mInfoBarContainer != null) { | 998 if (mInfoBarContainer != null) { |
| 954 mInfoBarContainer.destroy(); | 999 mInfoBarContainer.destroy(); |
| 955 mInfoBarContainer = null; | 1000 mInfoBarContainer = null; |
| 956 } | 1001 } |
| 1002 |
| 1003 mPreviousFullscreenTopControlsOffsetY = Float.NaN; |
| 1004 mPreviousFullscreenContentOffsetY = Float.NaN; |
| 957 } | 1005 } |
| 958 | 1006 |
| 959 /** | 1007 /** |
| 960 * @return Whether or not this Tab has a live native component. | 1008 * @return Whether or not this Tab has a live native component. |
| 961 */ | 1009 */ |
| 962 public boolean isInitialized() { | 1010 public boolean isInitialized() { |
| 963 return mNativeTabAndroid != 0; | 1011 return mNativeTabAndroid != 0; |
| 964 } | 1012 } |
| 965 | 1013 |
| 966 /** | 1014 /** |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1280 } | 1328 } |
| 1281 | 1329 |
| 1282 /** | 1330 /** |
| 1283 * @return The reason the Tab was launched. | 1331 * @return The reason the Tab was launched. |
| 1284 */ | 1332 */ |
| 1285 public TabLaunchType getLaunchType() { | 1333 public TabLaunchType getLaunchType() { |
| 1286 return mLaunchType; | 1334 return mLaunchType; |
| 1287 } | 1335 } |
| 1288 | 1336 |
| 1289 /** | 1337 /** |
| 1338 * @return true iff the tab doesn't hold a live page. This happens before in
itialize() and when |
| 1339 * the tab holds frozen WebContents state that is yet to be inflated. |
| 1340 */ |
| 1341 @VisibleForTesting |
| 1342 public boolean isFrozen() { |
| 1343 return getNativePage() == null && getContentViewCore() == null; |
| 1344 } |
| 1345 |
| 1346 /** |
| 1347 * @return An instance of a {@link FullscreenManager}. |
| 1348 */ |
| 1349 protected FullscreenManager getFullscreenManager() { |
| 1350 return mFullscreenManager; |
| 1351 } |
| 1352 |
| 1353 /** |
| 1354 * Clears hung renderer state. |
| 1355 */ |
| 1356 protected void clearHungRendererState() { |
| 1357 if (mFullscreenManager == null) return; |
| 1358 |
| 1359 mFullscreenManager.hideControlsPersistent(mFullscreenHungRendererToken); |
| 1360 mFullscreenHungRendererToken = FullscreenManager.INVALID_TOKEN; |
| 1361 updateFullscreenEnabledState(); |
| 1362 } |
| 1363 |
| 1364 /** |
| 1365 * Called when offset values related with fullscreen functionality has been
changed by the |
| 1366 * compositor. |
| 1367 * @param topControlsOffsetY The Y offset of the top controls in physical pi
xels. |
| 1368 * @param contentOffsetY The Y offset of the content in physical pixels. |
| 1369 * @param overdrawBottomHeight The overdraw height. |
| 1370 * @param isNonFullscreenPage Whether a current page is non-fullscreen page
or not. |
| 1371 */ |
| 1372 protected void onOffsetsChanged(float topControlsOffsetY, float contentOffse
tY, |
| 1373 float overdrawBottomHeight, boolean isNonFullscreenPage) { |
| 1374 mPreviousFullscreenTopControlsOffsetY = topControlsOffsetY; |
| 1375 mPreviousFullscreenContentOffsetY = contentOffsetY; |
| 1376 mPreviousFullscreenOverdrawBottomHeight = overdrawBottomHeight; |
| 1377 |
| 1378 if (mFullscreenManager == null) return; |
| 1379 if (isNonFullscreenPage || isNativePage()) { |
| 1380 mFullscreenManager.setPositionsForTabToNonFullscreen(); |
| 1381 } else { |
| 1382 mFullscreenManager.setPositionsForTab(topControlsOffsetY, contentOff
setY); |
| 1383 } |
| 1384 TabModelBase.setActualTabSwitchLatencyMetricRequired(); |
| 1385 } |
| 1386 |
| 1387 /** |
| 1388 * Push state about whether or not the top controls can show or hide to the
renderer. |
| 1389 */ |
| 1390 public void updateFullscreenEnabledState() { |
| 1391 if (isFrozen() || mFullscreenManager == null) return; |
| 1392 |
| 1393 updateTopControlsState(getTopControlsStateConstraints(), TopControlsStat
e.BOTH, true); |
| 1394 |
| 1395 if (getContentViewCore() != null) { |
| 1396 getContentViewCore().updateMultiTouchZoomSupport( |
| 1397 !mFullscreenManager.getPersistentFullscreenMode()); |
| 1398 } |
| 1399 } |
| 1400 |
| 1401 /** |
| 1402 * Updates the top controls state for this tab. As these values are set at
the renderer |
| 1403 * level, there is potential for this impacting other tabs that might share
the same |
| 1404 * process. |
| 1405 * |
| 1406 * @param constraints The constraints that determine whether the controls ca
n be shown |
| 1407 * or hidden at all. |
| 1408 * @param current The desired current state for the controls. Pass |
| 1409 * {@link TopControlsState#BOTH} to preserve the current posi
tion. |
| 1410 * @param animate Whether the controls should animate to the specified endin
g condition or |
| 1411 * should jump immediately. |
| 1412 */ |
| 1413 protected void updateTopControlsState(int constraints, int current, boolean
animate) { |
| 1414 if (mNativeTabAndroid == 0) return; |
| 1415 nativeUpdateTopControlsState(mNativeTabAndroid, constraints, current, an
imate); |
| 1416 } |
| 1417 |
| 1418 /** |
| 1419 * Updates the top controls state for this tab. As these values are set at
the renderer |
| 1420 * level, there is potential for this impacting other tabs that might share
the same |
| 1421 * process. |
| 1422 * |
| 1423 * @param current The desired current state for the controls. Pass |
| 1424 * {@link TopControlsState#BOTH} to preserve the current posi
tion. |
| 1425 * @param animate Whether the controls should animate to the specified endin
g condition or |
| 1426 * should jump immediately. |
| 1427 */ |
| 1428 public void updateTopControlsState(int current, boolean animate) { |
| 1429 int constraints = getTopControlsStateConstraints(); |
| 1430 // Do nothing if current and constraints conflict to avoid error in |
| 1431 // renderer. |
| 1432 if ((constraints == TopControlsState.HIDDEN && current == TopControlsSta
te.SHOWN) |
| 1433 || (constraints == TopControlsState.SHOWN && current == TopContr
olsState.HIDDEN)) { |
| 1434 return; |
| 1435 } |
| 1436 updateTopControlsState(getTopControlsStateConstraints(), current, animat
e); |
| 1437 } |
| 1438 |
| 1439 /** |
| 1440 * @return Whether hiding top controls is enabled or not. |
| 1441 */ |
| 1442 protected boolean isHidingTopControlsEnabled() { |
| 1443 String url = getUrl(); |
| 1444 boolean enableHidingTopControls = url != null && !url.startsWith(UrlCons
tants.CHROME_SCHEME) |
| 1445 && !url.startsWith(UrlConstants.CHROME_NATIVE_SCHEME); |
| 1446 |
| 1447 int securityState = getSecurityLevel(); |
| 1448 enableHidingTopControls &= (securityState != ToolbarModelSecurityLevel.S
ECURITY_ERROR |
| 1449 && securityState != ToolbarModelSecurityLevel.SECURITY_WARNING); |
| 1450 |
| 1451 enableHidingTopControls &= |
| 1452 !AccessibilityUtil.isAccessibilityEnabled(getApplicationContext(
)); |
| 1453 return enableHidingTopControls; |
| 1454 } |
| 1455 |
| 1456 /** |
| 1457 * @return The current visibility constraints for the display of top control
s. |
| 1458 * {@link TopControlsState} defines the valid return options. |
| 1459 */ |
| 1460 protected int getTopControlsStateConstraints() { |
| 1461 if (mFullscreenManager == null) return TopControlsState.SHOWN; |
| 1462 |
| 1463 boolean enableHidingTopControls = isHidingTopControlsEnabled(); |
| 1464 boolean enableShowingTopControls = !mFullscreenManager.getPersistentFull
screenMode(); |
| 1465 |
| 1466 int constraints = TopControlsState.BOTH; |
| 1467 if (!enableShowingTopControls) { |
| 1468 constraints = TopControlsState.HIDDEN; |
| 1469 } else if (!enableHidingTopControls) { |
| 1470 constraints = TopControlsState.SHOWN; |
| 1471 } |
| 1472 return constraints; |
| 1473 } |
| 1474 |
| 1475 /** |
| 1476 * @param manager The fullscreen manager that should be notified of changes
to this tab (if |
| 1477 * set to null, no more updates will come from this tab). |
| 1478 */ |
| 1479 public void setFullscreenManager(FullscreenManager manager) { |
| 1480 mFullscreenManager = manager; |
| 1481 if (mFullscreenManager != null) { |
| 1482 if (Float.isNaN(mPreviousFullscreenTopControlsOffsetY) |
| 1483 || Float.isNaN(mPreviousFullscreenContentOffsetY)) { |
| 1484 mFullscreenManager.setPositionsForTabToNonFullscreen(); |
| 1485 } else { |
| 1486 mFullscreenManager.setPositionsForTab( |
| 1487 mPreviousFullscreenTopControlsOffsetY, mPreviousFullscre
enContentOffsetY); |
| 1488 } |
| 1489 mFullscreenManager.showControlsTransient(); |
| 1490 updateFullscreenEnabledState(); |
| 1491 } |
| 1492 } |
| 1493 |
| 1494 /** |
| 1495 * @return The most recent frame's overdraw bottom height in pixels. |
| 1496 */ |
| 1497 public float getFullscreenOverdrawBottomHeightPix() { |
| 1498 return mPreviousFullscreenOverdrawBottomHeight; |
| 1499 } |
| 1500 |
| 1501 /** |
| 1290 * @return An unused id. | 1502 * @return An unused id. |
| 1291 */ | 1503 */ |
| 1292 private static int generateNextId() { | 1504 private static int generateNextId() { |
| 1293 return sIdCounter.getAndIncrement(); | 1505 return sIdCounter.getAndIncrement(); |
| 1294 } | 1506 } |
| 1295 | 1507 |
| 1296 private void pushNativePageStateToNavigationEntry() { | 1508 private void pushNativePageStateToNavigationEntry() { |
| 1297 assert mNativeTabAndroid != 0 && getNativePage() != null; | 1509 assert mNativeTabAndroid != 0 && getNativePage() != null; |
| 1298 nativeSetActiveNavigationEntryTitleForUrl(mNativeTabAndroid, getNativePa
ge().getUrl(), | 1510 nativeSetActiveNavigationEntryTitleForUrl(mNativeTabAndroid, getNativePa
ge().getUrl(), |
| 1299 getNativePage().getTitle()); | 1511 getNativePage().getTitle()); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1323 private native void nativeDestroyWebContents(long nativeTabAndroid, boolean
deleteNative); | 1535 private native void nativeDestroyWebContents(long nativeTabAndroid, boolean
deleteNative); |
| 1324 private native Profile nativeGetProfileAndroid(long nativeTabAndroid); | 1536 private native Profile nativeGetProfileAndroid(long nativeTabAndroid); |
| 1325 private native int nativeLoadUrl(long nativeTabAndroid, String url, String e
xtraHeaders, | 1537 private native int nativeLoadUrl(long nativeTabAndroid, String url, String e
xtraHeaders, |
| 1326 byte[] postData, int transition, String referrerUrl, int referrerPol
icy, | 1538 byte[] postData, int transition, String referrerUrl, int referrerPol
icy, |
| 1327 boolean isRendererInitiated); | 1539 boolean isRendererInitiated); |
| 1328 private native void nativeSetActiveNavigationEntryTitleForUrl(long nativeTab
Android, String url, | 1540 private native void nativeSetActiveNavigationEntryTitleForUrl(long nativeTab
Android, String url, |
| 1329 String title); | 1541 String title); |
| 1330 private native boolean nativePrint(long nativeTabAndroid); | 1542 private native boolean nativePrint(long nativeTabAndroid); |
| 1331 private native Bitmap nativeGetFavicon(long nativeTabAndroid); | 1543 private native Bitmap nativeGetFavicon(long nativeTabAndroid); |
| 1332 private native void nativeCreateHistoricalTab(long nativeTabAndroid); | 1544 private native void nativeCreateHistoricalTab(long nativeTabAndroid); |
| 1545 private native void nativeUpdateTopControlsState( |
| 1546 long nativeTabAndroid, int constraints, int current, boolean animate
); |
| 1333 } | 1547 } |
| OLD | NEW |