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.tab; | 5 package org.chromium.chrome.browser.tab; |
6 | 6 |
7 import android.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
8 import android.app.Activity; | 8 import android.app.Activity; |
9 import android.app.Application; | 9 import android.app.Application; |
10 import android.content.Context; | 10 import android.content.Context; |
(...skipping 2491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2502 | 2502 |
2503 /** | 2503 /** |
2504 * Toggles fullscreen mode and notifies all observers. | 2504 * Toggles fullscreen mode and notifies all observers. |
2505 * @param enableFullscreen Whether fullscreen should be enabled. | 2505 * @param enableFullscreen Whether fullscreen should be enabled. |
2506 */ | 2506 */ |
2507 public void toggleFullscreenMode(boolean enableFullscreen) { | 2507 public void toggleFullscreenMode(boolean enableFullscreen) { |
2508 if (mFullscreenManager != null) { | 2508 if (mFullscreenManager != null) { |
2509 mFullscreenManager.setPersistentFullscreenMode(enableFullscreen); | 2509 mFullscreenManager.setPersistentFullscreenMode(enableFullscreen); |
2510 } | 2510 } |
2511 | 2511 |
2512 // When going into fullscreen, we want to remove any cached thumbnail of the Tab. | |
2513 if (enableFullscreen) { | |
2514 clearThumbnailPlaceholder(); | |
2515 } | |
2516 | |
2512 RewindableIterator<TabObserver> observers = getTabObservers(); | 2517 RewindableIterator<TabObserver> observers = getTabObservers(); |
2513 while (observers.hasNext()) { | 2518 while (observers.hasNext()) { |
2514 observers.next().onToggleFullscreenMode(this, enableFullscreen); | 2519 observers.next().onToggleFullscreenMode(this, enableFullscreen); |
2515 } | 2520 } |
2516 } | 2521 } |
2517 | 2522 |
2518 /** | 2523 /** |
2519 * Called when offset values related with fullscreen functionality has been changed by the | 2524 * Called when offset values related with fullscreen functionality has been changed by the |
2520 * compositor. | 2525 * compositor. |
2521 * @param topControlsOffsetY The Y offset of the top controls in physical pi xels. | 2526 * @param topControlsOffsetY The Y offset of the top controls in physical pi xels. |
(...skipping 14 matching lines...) Expand all Loading... | |
2536 if (isShowingSadTab() || isNativePage()) { | 2541 if (isShowingSadTab() || isNativePage()) { |
2537 mFullscreenManager.setPositionsForTabToNonFullscreen(); | 2542 mFullscreenManager.setPositionsForTabToNonFullscreen(); |
2538 } else { | 2543 } else { |
2539 mFullscreenManager.setPositionsForTab(mPreviousTopControlsOffsetY, | 2544 mFullscreenManager.setPositionsForTab(mPreviousTopControlsOffsetY, |
2540 mPreviousBottomControlsOffsetY, mPreviousContentOffsetY); | 2545 mPreviousBottomControlsOffsetY, mPreviousContentOffsetY); |
2541 } | 2546 } |
2542 TabModelImpl.setActualTabSwitchLatencyMetricRequired(); | 2547 TabModelImpl.setActualTabSwitchLatencyMetricRequired(); |
2543 } | 2548 } |
2544 | 2549 |
2545 /** | 2550 /** |
2551 * Clears the cached thumbnail for this Tab. | |
2552 */ | |
2553 public void clearThumbnailPlaceholder() { | |
Khushal
2017/07/12 17:15:39
You don't need this public function. Use the nativ
steimel
2017/07/12 18:24:21
Done.
| |
2554 if (mNativeTabAndroid != 0) nativeClearThumbnailPlaceholder(mNativeTabAn droid); | |
2555 } | |
2556 | |
2557 /** | |
2546 * Push state about whether or not the browser controls can show or hide to the renderer. | 2558 * Push state about whether or not the browser controls can show or hide to the renderer. |
2547 */ | 2559 */ |
2548 public void updateFullscreenEnabledState() { | 2560 public void updateFullscreenEnabledState() { |
2549 if (isFrozen()) return; | 2561 if (isFrozen()) return; |
2550 | 2562 |
2551 updateBrowserControlsState( | 2563 updateBrowserControlsState( |
2552 getBrowserControlsStateConstraints(), BrowserControlsState.BOTH, true); | 2564 getBrowserControlsStateConstraints(), BrowserControlsState.BOTH, true); |
2553 | 2565 |
2554 if (getContentViewCore() != null && mFullscreenManager != null) { | 2566 if (getContentViewCore() != null && mFullscreenManager != null) { |
2555 getContentViewCore().updateMultiTouchZoomSupport( | 2567 getContentViewCore().updateMultiTouchZoomSupport( |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3126 private native Bitmap nativeGetFavicon(long nativeTabAndroid); | 3138 private native Bitmap nativeGetFavicon(long nativeTabAndroid); |
3127 private native void nativeCreateHistoricalTab(long nativeTabAndroid); | 3139 private native void nativeCreateHistoricalTab(long nativeTabAndroid); |
3128 private native void nativeUpdateBrowserControlsState( | 3140 private native void nativeUpdateBrowserControlsState( |
3129 long nativeTabAndroid, int constraints, int current, boolean animate ); | 3141 long nativeTabAndroid, int constraints, int current, boolean animate ); |
3130 private native void nativeLoadOriginalImage(long nativeTabAndroid); | 3142 private native void nativeLoadOriginalImage(long nativeTabAndroid); |
3131 private native long nativeGetBookmarkId(long nativeTabAndroid, boolean onlyE ditable); | 3143 private native long nativeGetBookmarkId(long nativeTabAndroid, boolean onlyE ditable); |
3132 private native void nativeSetInterceptNavigationDelegate(long nativeTabAndro id, | 3144 private native void nativeSetInterceptNavigationDelegate(long nativeTabAndro id, |
3133 InterceptNavigationDelegate delegate); | 3145 InterceptNavigationDelegate delegate); |
3134 private native void nativeAttachToTabContentManager(long nativeTabAndroid, | 3146 private native void nativeAttachToTabContentManager(long nativeTabAndroid, |
3135 TabContentManager tabContentManager); | 3147 TabContentManager tabContentManager); |
3148 private native void nativeClearThumbnailPlaceholder(long nativeTabAndroid); | |
3136 private native boolean nativeHasPrerenderedUrl(long nativeTabAndroid, String url); | 3149 private native boolean nativeHasPrerenderedUrl(long nativeTabAndroid, String url); |
3137 private native void nativeSetWebappManifestScope(long nativeTabAndroid, Stri ng scope); | 3150 private native void nativeSetWebappManifestScope(long nativeTabAndroid, Stri ng scope); |
3138 private native void nativeEnableEmbeddedMediaExperience(long nativeTabAndroi d, boolean enabled); | 3151 private native void nativeEnableEmbeddedMediaExperience(long nativeTabAndroi d, boolean enabled); |
3139 private native void nativeAttachDetachedTab(long nativeTabAndroid); | 3152 private native void nativeAttachDetachedTab(long nativeTabAndroid); |
3140 } | 3153 } |
OLD | NEW |