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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 import org.chromium.components.navigation_interception.InterceptNavigationDelega
te; | 91 import org.chromium.components.navigation_interception.InterceptNavigationDelega
te; |
92 import org.chromium.components.security_state.ConnectionSecurityLevel; | 92 import org.chromium.components.security_state.ConnectionSecurityLevel; |
93 import org.chromium.content.browser.ChildProcessLauncher; | 93 import org.chromium.content.browser.ChildProcessLauncher; |
94 import org.chromium.content.browser.ContentView; | 94 import org.chromium.content.browser.ContentView; |
95 import org.chromium.content.browser.ContentViewClient; | 95 import org.chromium.content.browser.ContentViewClient; |
96 import org.chromium.content.browser.ContentViewCore; | 96 import org.chromium.content.browser.ContentViewCore; |
97 import org.chromium.content.browser.crypto.CipherFactory; | 97 import org.chromium.content.browser.crypto.CipherFactory; |
98 import org.chromium.content_public.browser.GestureStateListener; | 98 import org.chromium.content_public.browser.GestureStateListener; |
99 import org.chromium.content_public.browser.LoadUrlParams; | 99 import org.chromium.content_public.browser.LoadUrlParams; |
100 import org.chromium.content_public.browser.WebContents; | 100 import org.chromium.content_public.browser.WebContents; |
| 101 import org.chromium.content_public.common.BrowserControlsState; |
101 import org.chromium.content_public.common.Referrer; | 102 import org.chromium.content_public.common.Referrer; |
102 import org.chromium.content_public.common.ResourceRequestBody; | 103 import org.chromium.content_public.common.ResourceRequestBody; |
103 import org.chromium.content_public.common.TopControlsState; | |
104 import org.chromium.printing.PrintManagerDelegateImpl; | 104 import org.chromium.printing.PrintManagerDelegateImpl; |
105 import org.chromium.printing.PrintingController; | 105 import org.chromium.printing.PrintingController; |
106 import org.chromium.printing.PrintingControllerImpl; | 106 import org.chromium.printing.PrintingControllerImpl; |
107 import org.chromium.ui.base.LocalizationUtils; | 107 import org.chromium.ui.base.LocalizationUtils; |
108 import org.chromium.ui.base.PageTransition; | 108 import org.chromium.ui.base.PageTransition; |
109 import org.chromium.ui.base.ViewAndroidDelegate; | 109 import org.chromium.ui.base.ViewAndroidDelegate; |
110 import org.chromium.ui.base.WindowAndroid; | 110 import org.chromium.ui.base.WindowAndroid; |
111 import org.chromium.ui.mojom.WindowOpenDisposition; | 111 import org.chromium.ui.mojom.WindowOpenDisposition; |
112 | 112 |
113 import java.lang.ref.WeakReference; | 113 import java.lang.ref.WeakReference; |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 * didCommitProvisionalLoadForFrame(). However, we mustn't show a new native
page (page B) in | 340 * didCommitProvisionalLoadForFrame(). However, we mustn't show a new native
page (page B) in |
341 * loadUrl() if the current native page hasn't yet been committed. Otherwise
, we'll show each | 341 * loadUrl() if the current native page hasn't yet been committed. Otherwise
, we'll show each |
342 * page twice (A, B, A, B): the first two times in loadUrl(), the second two
times in | 342 * page twice (A, B, A, B): the first two times in loadUrl(), the second two
times in |
343 * didCommitProvisionalLoadForFrame(). | 343 * didCommitProvisionalLoadForFrame(). |
344 */ | 344 */ |
345 private boolean mIsNativePageCommitPending; | 345 private boolean mIsNativePageCommitPending; |
346 | 346 |
347 private TabRedirectHandler mTabRedirectHandler; | 347 private TabRedirectHandler mTabRedirectHandler; |
348 | 348 |
349 private FullscreenManager mFullscreenManager; | 349 private FullscreenManager mFullscreenManager; |
350 private float mPreviousFullscreenTopControlsOffsetY = Float.NaN; | 350 private float mPreviousFullscreenBrowserControlsOffsetY = Float.NaN; |
351 private float mPreviousFullscreenContentOffsetY = Float.NaN; | 351 private float mPreviousFullscreenContentOffsetY = Float.NaN; |
352 private int mFullscreenHungRendererToken = FullscreenManager.INVALID_TOKEN; | 352 private int mFullscreenHungRendererToken = FullscreenManager.INVALID_TOKEN; |
353 private boolean mIsFullscreenWaitingForLoad = false; | 353 private boolean mIsFullscreenWaitingForLoad = false; |
354 | 354 |
355 /** | 355 /** |
356 * Indicates whether this tab has been detached from its activity and the co
rresponding | 356 * Indicates whether this tab has been detached from its activity and the co
rresponding |
357 * {@link WindowAndroid} for reparenting to a new activity. | 357 * {@link WindowAndroid} for reparenting to a new activity. |
358 */ | 358 */ |
359 private boolean mIsDetachedForReparenting; | 359 private boolean mIsDetachedForReparenting; |
360 | 360 |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 | 544 |
545 if (didFinishLoad) { | 545 if (didFinishLoad) { |
546 // Simulate the PAGE_LOAD_FINISHED notification that we did not
get. | 546 // Simulate the PAGE_LOAD_FINISHED notification that we did not
get. |
547 didFinishPageLoad(); | 547 didFinishPageLoad(); |
548 } | 548 } |
549 } | 549 } |
550 }; | 550 }; |
551 | 551 |
552 private TabDelegateFactory mDelegateFactory; | 552 private TabDelegateFactory mDelegateFactory; |
553 | 553 |
554 private TopControlsVisibilityDelegate mTopControlsVisibilityDelegate; | 554 private BrowserControlsVisibilityDelegate mBrowserControlsVisibilityDelegate
; |
555 | 555 |
556 /** | 556 /** |
557 * Creates an instance of a {@link Tab}. | 557 * Creates an instance of a {@link Tab}. |
558 * | 558 * |
559 * This constructor may be called before the native library has been loaded,
so any additions | 559 * This constructor may be called before the native library has been loaded,
so any additions |
560 * must be vetted for library calls. | 560 * must be vetted for library calls. |
561 * | 561 * |
562 * @param id The id this tab should be identified with. | 562 * @param id The id this tab should be identified with. |
563 * @param incognito Whether or not this tab is incognito. | 563 * @param incognito Whether or not this tab is incognito. |
564 * @param window An instance of a {@link WindowAndroid}. | 564 * @param window An instance of a {@link WindowAndroid}. |
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1444 public final void initialize(WebContents webContents, TabContentManager tabC
ontentManager, | 1444 public final void initialize(WebContents webContents, TabContentManager tabC
ontentManager, |
1445 TabDelegateFactory delegateFactory, boolean initiallyHidden, boolean
unfreeze) { | 1445 TabDelegateFactory delegateFactory, boolean initiallyHidden, boolean
unfreeze) { |
1446 try { | 1446 try { |
1447 TraceEvent.begin("Tab.initialize"); | 1447 TraceEvent.begin("Tab.initialize"); |
1448 | 1448 |
1449 mDelegateFactory = delegateFactory; | 1449 mDelegateFactory = delegateFactory; |
1450 initializeNative(); | 1450 initializeNative(); |
1451 | 1451 |
1452 RevenueStats.getInstance().tabCreated(this); | 1452 RevenueStats.getInstance().tabCreated(this); |
1453 | 1453 |
1454 mTopControlsVisibilityDelegate = | 1454 mBrowserControlsVisibilityDelegate = |
1455 mDelegateFactory.createTopControlsVisibilityDelegate(this); | 1455 mDelegateFactory.createBrowserControlsVisibilityDelegate(thi
s); |
1456 | 1456 |
1457 mBlimp = BlimpClientContextFactory | 1457 mBlimp = BlimpClientContextFactory |
1458 .getBlimpClientContextForProfile( | 1458 .getBlimpClientContextForProfile( |
1459 Profile.getLastUsedProfile().getOriginalPro
file()) | 1459 Profile.getLastUsedProfile().getOriginalPro
file()) |
1460 .isBlimpEnabled() | 1460 .isBlimpEnabled() |
1461 && !mIncognito; | 1461 && !mIncognito; |
1462 | 1462 |
1463 // Attach the TabContentManager if we have one. This will bind this
Tab's content layer | 1463 // Attach the TabContentManager if we have one. This will bind this
Tab's content layer |
1464 // to this manager. | 1464 // to this manager. |
1465 // TODO(dtrainor): Remove this and move to a pull model instead of p
ushing the layer. | 1465 // TODO(dtrainor): Remove this and move to a pull model instead of p
ushing the layer. |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1587 // Update for the controllers that need the Compositor from the new Acti
vity. | 1587 // Update for the controllers that need the Compositor from the new Acti
vity. |
1588 attachTabContentManager(activity.getTabContentManager()); | 1588 attachTabContentManager(activity.getTabContentManager()); |
1589 mFullscreenManager = activity.getFullscreenManager(); | 1589 mFullscreenManager = activity.getFullscreenManager(); |
1590 activity.getCompositorViewHolder().prepareForTabReparenting(); | 1590 activity.getCompositorViewHolder().prepareForTabReparenting(); |
1591 | 1591 |
1592 // Update the delegate factory, then recreate and propagate all delegate
s. | 1592 // Update the delegate factory, then recreate and propagate all delegate
s. |
1593 mDelegateFactory = tabDelegateFactory; | 1593 mDelegateFactory = tabDelegateFactory; |
1594 mWebContentsDelegate = mDelegateFactory.createWebContentsDelegate(this); | 1594 mWebContentsDelegate = mDelegateFactory.createWebContentsDelegate(this); |
1595 nativeUpdateDelegates(mNativeTabAndroid, | 1595 nativeUpdateDelegates(mNativeTabAndroid, |
1596 mWebContentsDelegate, mDelegateFactory.createContextMenuPopulato
r(this)); | 1596 mWebContentsDelegate, mDelegateFactory.createContextMenuPopulato
r(this)); |
1597 mTopControlsVisibilityDelegate = mDelegateFactory.createTopControlsVisib
ilityDelegate(this); | 1597 mBrowserControlsVisibilityDelegate = |
| 1598 mDelegateFactory.createBrowserControlsVisibilityDelegate(this); |
1598 setInterceptNavigationDelegate(mDelegateFactory.createInterceptNavigatio
nDelegate(this)); | 1599 setInterceptNavigationDelegate(mDelegateFactory.createInterceptNavigatio
nDelegate(this)); |
1599 getAppBannerManager().setIsEnabledForTab(mDelegateFactory.canShowAppBann
ers(this)); | 1600 getAppBannerManager().setIsEnabledForTab(mDelegateFactory.canShowAppBann
ers(this)); |
1600 | 1601 |
1601 reparentingParams.finalizeTabReparenting(); | 1602 reparentingParams.finalizeTabReparenting(); |
1602 mIsDetachedForReparenting = false; | 1603 mIsDetachedForReparenting = false; |
1603 | 1604 |
1604 // Reload the NativePage (if any), since the old NativePage has a refere
nce to the old | 1605 // Reload the NativePage (if any), since the old NativePage has a refere
nce to the old |
1605 // activity. | 1606 // activity. |
1606 maybeShowNativePage(getUrl(), true); | 1607 maybeShowNativePage(getUrl(), true); |
1607 | 1608 |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2021 // expects all infobars to be cleaned up before its own destruction. | 2022 // expects all infobars to be cleaned up before its own destruction. |
2022 assert mNativeTabAndroid != 0; | 2023 assert mNativeTabAndroid != 0; |
2023 nativeDestroy(mNativeTabAndroid); | 2024 nativeDestroy(mNativeTabAndroid); |
2024 assert mNativeTabAndroid == 0; | 2025 assert mNativeTabAndroid == 0; |
2025 | 2026 |
2026 if (mInfoBarContainer != null) { | 2027 if (mInfoBarContainer != null) { |
2027 mInfoBarContainer.destroy(); | 2028 mInfoBarContainer.destroy(); |
2028 mInfoBarContainer = null; | 2029 mInfoBarContainer = null; |
2029 } | 2030 } |
2030 | 2031 |
2031 mPreviousFullscreenTopControlsOffsetY = Float.NaN; | 2032 mPreviousFullscreenBrowserControlsOffsetY = Float.NaN; |
2032 mPreviousFullscreenContentOffsetY = Float.NaN; | 2033 mPreviousFullscreenContentOffsetY = Float.NaN; |
2033 | 2034 |
2034 mNeedsReload = false; | 2035 mNeedsReload = false; |
2035 | 2036 |
2036 // Remove pending handler actions to prevent memory leaks. | 2037 // Remove pending handler actions to prevent memory leaks. |
2037 mHandler.removeCallbacksAndMessages(null); | 2038 mHandler.removeCallbacksAndMessages(null); |
2038 } | 2039 } |
2039 | 2040 |
2040 /** | 2041 /** |
2041 * @return Whether or not this Tab has a live native component. This will b
e true prior to | 2042 * @return Whether or not this Tab has a live native component. This will b
e true prior to |
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2669 if (mFullscreenManager == null) return; | 2670 if (mFullscreenManager == null) return; |
2670 | 2671 |
2671 mFullscreenManager.hideControlsPersistent(mFullscreenHungRendererToken); | 2672 mFullscreenManager.hideControlsPersistent(mFullscreenHungRendererToken); |
2672 mFullscreenHungRendererToken = FullscreenManager.INVALID_TOKEN; | 2673 mFullscreenHungRendererToken = FullscreenManager.INVALID_TOKEN; |
2673 updateFullscreenEnabledState(); | 2674 updateFullscreenEnabledState(); |
2674 } | 2675 } |
2675 | 2676 |
2676 /** | 2677 /** |
2677 * Called when offset values related with fullscreen functionality has been
changed by the | 2678 * Called when offset values related with fullscreen functionality has been
changed by the |
2678 * compositor. | 2679 * compositor. |
2679 * @param topControlsOffsetY The Y offset of the top controls in physical pi
xels. | 2680 * @param browserControlsOffsetY The Y offset of the browser controls in phy
sical pixels. |
2680 * @param contentOffsetY The Y offset of the content in physical pixels. | 2681 * @param contentOffsetY The Y offset of the content in physical pixels. |
2681 * @param isNonFullscreenPage Whether a current page is non-fullscreen page
or not. | 2682 * @param isNonFullscreenPage Whether a current page is non-fullscreen page
or not. |
2682 */ | 2683 */ |
2683 private void onOffsetsChanged(float topControlsOffsetY, float contentOffsetY
, | 2684 private void onOffsetsChanged( |
2684 boolean isNonFullscreenPage) { | 2685 float browserControlsOffsetY, float contentOffsetY, boolean isNonFul
lscreenPage) { |
2685 mPreviousFullscreenTopControlsOffsetY = topControlsOffsetY; | 2686 mPreviousFullscreenBrowserControlsOffsetY = browserControlsOffsetY; |
2686 mPreviousFullscreenContentOffsetY = contentOffsetY; | 2687 mPreviousFullscreenContentOffsetY = contentOffsetY; |
2687 | 2688 |
2688 if (mFullscreenManager == null) return; | 2689 if (mFullscreenManager == null) return; |
2689 if (isNonFullscreenPage || isNativePage()) { | 2690 if (isNonFullscreenPage || isNativePage()) { |
2690 mFullscreenManager.setPositionsForTabToNonFullscreen(); | 2691 mFullscreenManager.setPositionsForTabToNonFullscreen(); |
2691 } else { | 2692 } else { |
2692 mFullscreenManager.setPositionsForTab(topControlsOffsetY, contentOff
setY); | 2693 mFullscreenManager.setPositionsForTab(browserControlsOffsetY, conten
tOffsetY); |
2693 } | 2694 } |
2694 TabModelImpl.setActualTabSwitchLatencyMetricRequired(); | 2695 TabModelImpl.setActualTabSwitchLatencyMetricRequired(); |
2695 } | 2696 } |
2696 | 2697 |
2697 /** | 2698 /** |
2698 * Push state about whether or not the top controls can show or hide to the
renderer. | 2699 * Push state about whether or not the browser controls can show or hide to
the renderer. |
2699 */ | 2700 */ |
2700 public void updateFullscreenEnabledState() { | 2701 public void updateFullscreenEnabledState() { |
2701 if (isFrozen()) return; | 2702 if (isFrozen()) return; |
2702 | 2703 |
2703 updateTopControlsState(getTopControlsStateConstraints(), TopControlsStat
e.BOTH, true); | 2704 updateBrowserControlsState( |
| 2705 getBrowserControlsStateConstraints(), BrowserControlsState.BOTH,
true); |
2704 | 2706 |
2705 if (getContentViewCore() != null && mFullscreenManager != null) { | 2707 if (getContentViewCore() != null && mFullscreenManager != null) { |
2706 getContentViewCore().updateMultiTouchZoomSupport( | 2708 getContentViewCore().updateMultiTouchZoomSupport( |
2707 !mFullscreenManager.getPersistentFullscreenMode()); | 2709 !mFullscreenManager.getPersistentFullscreenMode()); |
2708 } | 2710 } |
2709 } | 2711 } |
2710 | 2712 |
2711 /** | 2713 /** |
2712 * Updates the top controls state for this tab. As these values are set at
the renderer | 2714 * Updates the browser controls state for this tab. As these values are set
at the renderer |
2713 * level, there is potential for this impacting other tabs that might share
the same | 2715 * level, there is potential for this impacting other tabs that might share
the same |
2714 * process. | 2716 * process. |
2715 * | 2717 * |
2716 * @param constraints The constraints that determine whether the controls ca
n be shown | 2718 * @param constraints The constraints that determine whether the controls ca
n be shown |
2717 * or hidden at all. | 2719 * or hidden at all. |
2718 * @param current The desired current state for the controls. Pass | 2720 * @param current The desired current state for the controls. Pass |
2719 * {@link TopControlsState#BOTH} to preserve the current posi
tion. | 2721 * {@link BrowserControlsState#BOTH} to preserve the current
position. |
2720 * @param animate Whether the controls should animate to the specified endin
g condition or | 2722 * @param animate Whether the controls should animate to the specified endin
g condition or |
2721 * should jump immediately. | 2723 * should jump immediately. |
2722 */ | 2724 */ |
2723 protected void updateTopControlsState(int constraints, int current, boolean
animate) { | 2725 protected void updateBrowserControlsState(int constraints, int current, bool
ean animate) { |
2724 if (mNativeTabAndroid == 0) return; | 2726 if (mNativeTabAndroid == 0) return; |
2725 nativeUpdateTopControlsState(mNativeTabAndroid, constraints, current, an
imate); | 2727 nativeUpdateBrowserControlsState(mNativeTabAndroid, constraints, current
, animate); |
2726 } | 2728 } |
2727 | 2729 |
2728 /** | 2730 /** |
2729 * Updates the top controls state for this tab. As these values are set at
the renderer | 2731 * Updates the browser controls state for this tab. As these values are set
at the renderer |
2730 * level, there is potential for this impacting other tabs that might share
the same | 2732 * level, there is potential for this impacting other tabs that might share
the same |
2731 * process. | 2733 * process. |
2732 * | 2734 * |
2733 * @param current The desired current state for the controls. Pass | 2735 * @param current The desired current state for the controls. Pass |
2734 * {@link TopControlsState#BOTH} to preserve the current posi
tion. | 2736 * {@link BrowserControlsState#BOTH} to preserve the current
position. |
2735 * @param animate Whether the controls should animate to the specified endin
g condition or | 2737 * @param animate Whether the controls should animate to the specified endin
g condition or |
2736 * should jump immediately. | 2738 * should jump immediately. |
2737 */ | 2739 */ |
2738 public void updateTopControlsState(int current, boolean animate) { | 2740 public void updateBrowserControlsState(int current, boolean animate) { |
2739 int constraints = getTopControlsStateConstraints(); | 2741 int constraints = getBrowserControlsStateConstraints(); |
2740 // Do nothing if current and constraints conflict to avoid error in | 2742 // Do nothing if current and constraints conflict to avoid error in |
2741 // renderer. | 2743 // renderer. |
2742 if ((constraints == TopControlsState.HIDDEN && current == TopControlsSta
te.SHOWN) | 2744 if ((constraints == BrowserControlsState.HIDDEN && current == BrowserCon
trolsState.SHOWN) |
2743 || (constraints == TopControlsState.SHOWN && current == TopContr
olsState.HIDDEN)) { | 2745 || (constraints == BrowserControlsState.SHOWN |
| 2746 && current == BrowserControlsState.HIDDEN)) { |
2744 return; | 2747 return; |
2745 } | 2748 } |
2746 updateTopControlsState(getTopControlsStateConstraints(), current, animat
e); | 2749 updateBrowserControlsState(getBrowserControlsStateConstraints(), current
, animate); |
2747 } | 2750 } |
2748 | 2751 |
2749 /** | 2752 /** |
2750 * @return Whether hiding top controls is enabled or not. | 2753 * @return Whether hiding browser controls is enabled or not. |
2751 */ | 2754 */ |
2752 private boolean isHidingTopControlsEnabled() { | 2755 private boolean isHidingBrowserControlsEnabled() { |
2753 return mTopControlsVisibilityDelegate.isHidingTopControlsEnabled(); | 2756 return mBrowserControlsVisibilityDelegate.isHidingBrowserControlsEnabled
(); |
2754 } | 2757 } |
2755 | 2758 |
2756 /** | 2759 /** |
2757 * Performs any subclass-specific tasks when the Tab crashes. | 2760 * Performs any subclass-specific tasks when the Tab crashes. |
2758 */ | 2761 */ |
2759 void handleTabCrash() { | 2762 void handleTabCrash() { |
2760 mIsLoading = false; | 2763 mIsLoading = false; |
2761 mIsBeingRestored = false; | 2764 mIsBeingRestored = false; |
2762 | 2765 |
2763 if (mTabUma != null) mTabUma.onRendererCrashed(); | 2766 if (mTabUma != null) mTabUma.onRendererCrashed(); |
2764 } | 2767 } |
2765 | 2768 |
2766 /** | 2769 /** |
2767 * @return Whether showing top controls is enabled or not. | 2770 * @return Whether showing browser controls is enabled or not. |
2768 */ | 2771 */ |
2769 public boolean isShowingTopControlsEnabled() { | 2772 public boolean isShowingBrowserControlsEnabled() { |
2770 return mTopControlsVisibilityDelegate.isShowingTopControlsEnabled(); | 2773 return mBrowserControlsVisibilityDelegate.isShowingBrowserControlsEnable
d(); |
2771 } | 2774 } |
2772 | 2775 |
2773 /** | 2776 /** |
2774 * @return The current visibility constraints for the display of top control
s. | 2777 * @return The current visibility constraints for the display of browser con
trols. |
2775 * {@link TopControlsState} defines the valid return options. | 2778 * {@link BrowserControlsState} defines the valid return options. |
2776 */ | 2779 */ |
2777 public int getTopControlsStateConstraints() { | 2780 public int getBrowserControlsStateConstraints() { |
2778 boolean enableHidingTopControls = isHidingTopControlsEnabled(); | 2781 boolean enableHidingBrowserControls = isHidingBrowserControlsEnabled(); |
2779 boolean enableShowingTopControls = isShowingTopControlsEnabled(); | 2782 boolean enableShowingBrowserControls = isShowingBrowserControlsEnabled()
; |
2780 | 2783 |
2781 int constraints = TopControlsState.BOTH; | 2784 int constraints = BrowserControlsState.BOTH; |
2782 if (!enableShowingTopControls) { | 2785 if (!enableShowingBrowserControls) { |
2783 constraints = TopControlsState.HIDDEN; | 2786 constraints = BrowserControlsState.HIDDEN; |
2784 } else if (!enableHidingTopControls) { | 2787 } else if (!enableHidingBrowserControls) { |
2785 constraints = TopControlsState.SHOWN; | 2788 constraints = BrowserControlsState.SHOWN; |
2786 } | 2789 } |
2787 return constraints; | 2790 return constraints; |
2788 } | 2791 } |
2789 | 2792 |
2790 /** | 2793 /** |
2791 * @param manager The fullscreen manager that should be notified of changes
to this tab (if | 2794 * @param manager The fullscreen manager that should be notified of changes
to this tab (if |
2792 * set to null, no more updates will come from this tab). | 2795 * set to null, no more updates will come from this tab). |
2793 */ | 2796 */ |
2794 public void setFullscreenManager(FullscreenManager manager) { | 2797 public void setFullscreenManager(FullscreenManager manager) { |
2795 mFullscreenManager = manager; | 2798 mFullscreenManager = manager; |
2796 if (mFullscreenManager != null) { | 2799 if (mFullscreenManager != null) { |
2797 if (Float.isNaN(mPreviousFullscreenTopControlsOffsetY) | 2800 if (Float.isNaN(mPreviousFullscreenBrowserControlsOffsetY) |
2798 || Float.isNaN(mPreviousFullscreenContentOffsetY)) { | 2801 || Float.isNaN(mPreviousFullscreenContentOffsetY)) { |
2799 mFullscreenManager.setPositionsForTabToNonFullscreen(); | 2802 mFullscreenManager.setPositionsForTabToNonFullscreen(); |
2800 } else { | 2803 } else { |
2801 mFullscreenManager.setPositionsForTab( | 2804 mFullscreenManager.setPositionsForTab(mPreviousFullscreenBrowser
ControlsOffsetY, |
2802 mPreviousFullscreenTopControlsOffsetY, mPreviousFullscre
enContentOffsetY); | 2805 mPreviousFullscreenContentOffsetY); |
2803 } | 2806 } |
2804 mFullscreenManager.showControlsTransient(); | 2807 mFullscreenManager.showControlsTransient(); |
2805 updateFullscreenEnabledState(); | 2808 updateFullscreenEnabledState(); |
2806 } | 2809 } |
2807 | 2810 |
2808 // For blimp mode, offset the blimp view by the height of top controls.
This will ensure | 2811 // For blimp mode, offset the blimp view by the height of browser contro
ls. This will ensure |
2809 // that the view doesn't get clipped at the bottom of the page and also
the touch offsets | 2812 // that the view doesn't get clipped at the bottom of the page and also
the touch offsets |
2810 // would work correctly. | 2813 // would work correctly. |
2811 if (getBlimpContents() != null && mFullscreenManager != null) { | 2814 if (getBlimpContents() != null && mFullscreenManager != null) { |
2812 ViewGroup blimpView = getBlimpContents().getView(); | 2815 ViewGroup blimpView = getBlimpContents().getView(); |
2813 FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) blimpView.g
etLayoutParams(); | 2816 FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) blimpView.g
etLayoutParams(); |
2814 if (lp == null) { | 2817 if (lp == null) { |
2815 lp = new FrameLayout.LayoutParams( | 2818 lp = new FrameLayout.LayoutParams( |
2816 LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); | 2819 LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); |
2817 } | 2820 } |
2818 | 2821 |
2819 lp.topMargin = mFullscreenManager.getTopControlsHeight(); | 2822 lp.topMargin = mFullscreenManager.getBrowserControlsHeight(); |
2820 blimpView.setLayoutParams(lp); | 2823 blimpView.setLayoutParams(lp); |
2821 } | 2824 } |
2822 } | 2825 } |
2823 | 2826 |
2824 /** | 2827 /** |
2825 * Add a new navigation entry for the current URL and page title. | 2828 * Add a new navigation entry for the current URL and page title. |
2826 */ | 2829 */ |
2827 void pushNativePageStateToNavigationEntry() { | 2830 void pushNativePageStateToNavigationEntry() { |
2828 assert mNativeTabAndroid != 0 && getNativePage() != null; | 2831 assert mNativeTabAndroid != 0 && getNativePage() != null; |
2829 nativeSetActiveNavigationEntryTitleForUrl(mNativeTabAndroid, getNativePa
ge().getUrl(), | 2832 nativeSetActiveNavigationEntryTitleForUrl(mNativeTabAndroid, getNativePa
ge().getUrl(), |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3238 private native Profile nativeGetProfileAndroid(long nativeTabAndroid); | 3241 private native Profile nativeGetProfileAndroid(long nativeTabAndroid); |
3239 private native int nativeLoadUrl(long nativeTabAndroid, String url, String e
xtraHeaders, | 3242 private native int nativeLoadUrl(long nativeTabAndroid, String url, String e
xtraHeaders, |
3240 ResourceRequestBody postData, int transition, String referrerUrl, in
t referrerPolicy, | 3243 ResourceRequestBody postData, int transition, String referrerUrl, in
t referrerPolicy, |
3241 boolean isRendererInitiated, boolean shoulReplaceCurrentEntry, | 3244 boolean isRendererInitiated, boolean shoulReplaceCurrentEntry, |
3242 long intentReceivedTimestamp, boolean hasUserGesture); | 3245 long intentReceivedTimestamp, boolean hasUserGesture); |
3243 private native void nativeSetActiveNavigationEntryTitleForUrl(long nativeTab
Android, String url, | 3246 private native void nativeSetActiveNavigationEntryTitleForUrl(long nativeTab
Android, String url, |
3244 String title); | 3247 String title); |
3245 private native boolean nativePrint(long nativeTabAndroid); | 3248 private native boolean nativePrint(long nativeTabAndroid); |
3246 private native Bitmap nativeGetFavicon(long nativeTabAndroid); | 3249 private native Bitmap nativeGetFavicon(long nativeTabAndroid); |
3247 private native void nativeCreateHistoricalTab(long nativeTabAndroid); | 3250 private native void nativeCreateHistoricalTab(long nativeTabAndroid); |
3248 private native void nativeUpdateTopControlsState( | 3251 private native void nativeUpdateBrowserControlsState( |
3249 long nativeTabAndroid, int constraints, int current, boolean animate
); | 3252 long nativeTabAndroid, int constraints, int current, boolean animate
); |
3250 private native void nativeLoadOriginalImage(long nativeTabAndroid); | 3253 private native void nativeLoadOriginalImage(long nativeTabAndroid); |
3251 private native long nativeGetBookmarkId(long nativeTabAndroid, boolean onlyE
ditable); | 3254 private native long nativeGetBookmarkId(long nativeTabAndroid, boolean onlyE
ditable); |
3252 private native boolean nativeIsOfflinePage(long nativeTabAndroid); | 3255 private native boolean nativeIsOfflinePage(long nativeTabAndroid); |
3253 private native OfflinePageItem nativeGetOfflinePage(long nativeTabAndroid); | 3256 private native OfflinePageItem nativeGetOfflinePage(long nativeTabAndroid); |
3254 private native void nativeSetInterceptNavigationDelegate(long nativeTabAndro
id, | 3257 private native void nativeSetInterceptNavigationDelegate(long nativeTabAndro
id, |
3255 InterceptNavigationDelegate delegate); | 3258 InterceptNavigationDelegate delegate); |
3256 private native void nativeAttachToTabContentManager(long nativeTabAndroid, | 3259 private native void nativeAttachToTabContentManager(long nativeTabAndroid, |
3257 TabContentManager tabContentManager); | 3260 TabContentManager tabContentManager); |
3258 private native boolean nativeHasPrerenderedUrl(long nativeTabAndroid, String
url); | 3261 private native boolean nativeHasPrerenderedUrl(long nativeTabAndroid, String
url); |
3259 } | 3262 } |
OLD | NEW |