Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1208)

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java

Issue 2233023002: Adding BlimpNavigationController to Tab (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@nav_handler_remove
Patch Set: initial comments Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.app.Activity; 7 import android.app.Activity;
8 import android.app.Application; 8 import android.app.Application;
9 import android.content.Context; 9 import android.content.Context;
10 import android.content.Intent; 10 import android.content.Intent;
(...skipping 21 matching lines...) Expand all
32 import org.chromium.base.ApplicationStatus; 32 import org.chromium.base.ApplicationStatus;
33 import org.chromium.base.ContextUtils; 33 import org.chromium.base.ContextUtils;
34 import org.chromium.base.ObserverList; 34 import org.chromium.base.ObserverList;
35 import org.chromium.base.ObserverList.RewindableIterator; 35 import org.chromium.base.ObserverList.RewindableIterator;
36 import org.chromium.base.ThreadUtils; 36 import org.chromium.base.ThreadUtils;
37 import org.chromium.base.TraceEvent; 37 import org.chromium.base.TraceEvent;
38 import org.chromium.base.VisibleForTesting; 38 import org.chromium.base.VisibleForTesting;
39 import org.chromium.base.annotations.CalledByNative; 39 import org.chromium.base.annotations.CalledByNative;
40 import org.chromium.base.metrics.RecordHistogram; 40 import org.chromium.base.metrics.RecordHistogram;
41 import org.chromium.base.metrics.RecordUserAction; 41 import org.chromium.base.metrics.RecordUserAction;
42 import org.chromium.blimp_public.contents.BlimpContents;
43 import org.chromium.blimp_public.contents.BlimpContentsObserver;
42 import org.chromium.chrome.R; 44 import org.chromium.chrome.R;
43 import org.chromium.chrome.browser.ChromeActivity; 45 import org.chromium.chrome.browser.ChromeActivity;
44 import org.chromium.chrome.browser.ChromeApplication; 46 import org.chromium.chrome.browser.ChromeApplication;
45 import org.chromium.chrome.browser.ChromeFeatureList; 47 import org.chromium.chrome.browser.ChromeFeatureList;
46 import org.chromium.chrome.browser.ChromeVersionInfo; 48 import org.chromium.chrome.browser.ChromeVersionInfo;
47 import org.chromium.chrome.browser.FrozenNativePage; 49 import org.chromium.chrome.browser.FrozenNativePage;
48 import org.chromium.chrome.browser.IntentHandler; 50 import org.chromium.chrome.browser.IntentHandler;
49 import org.chromium.chrome.browser.IntentHandler.TabOpenType; 51 import org.chromium.chrome.browser.IntentHandler.TabOpenType;
50 import org.chromium.chrome.browser.NativePage; 52 import org.chromium.chrome.browser.NativePage;
51 import org.chromium.chrome.browser.SwipeRefreshHandler; 53 import org.chromium.chrome.browser.SwipeRefreshHandler;
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 /** 208 /**
207 * A list of {@link ContentViewCore} overlay objects that are managed by ext ernal components but 209 * A list of {@link ContentViewCore} overlay objects that are managed by ext ernal components but
208 * need to be sized and rendered along side this {@link Tab}s content. 210 * need to be sized and rendered along side this {@link Tab}s content.
209 */ 211 */
210 private final List<ContentViewCore> mOverlayContentViewCores = new ArrayList <ContentViewCore>(); 212 private final List<ContentViewCore> mOverlayContentViewCores = new ArrayList <ContentViewCore>();
211 213
212 // Content layer Observers and Delegates 214 // Content layer Observers and Delegates
213 private ContentViewClient mContentViewClient; 215 private ContentViewClient mContentViewClient;
214 private TabWebContentsObserver mWebContentsObserver; 216 private TabWebContentsObserver mWebContentsObserver;
215 private TabWebContentsDelegateAndroid mWebContentsDelegate; 217 private TabWebContentsDelegateAndroid mWebContentsDelegate;
218 private BlimpContents mBlimpContents;
216 219
217 /** 220 /**
218 * If this tab was opened from another tab, store the id of the tab that 221 * If this tab was opened from another tab, store the id of the tab that
219 * caused it to be opened so that we can activate it when this tab gets 222 * caused it to be opened so that we can activate it when this tab gets
220 * closed. 223 * closed.
221 */ 224 */
222 private int mParentId = INVALID_TAB_ID; 225 private int mParentId = INVALID_TAB_ID;
223 226
224 /** 227 /**
225 * If this tab was opened from another tab in another Activity, this is the Intent that can be 228 * If this tab was opened from another tab in another Activity, this is the Intent that can be
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 // swapped web contents, schedule the enabling of fullscreen now. 588 // swapped web contents, schedule the enabling of fullscreen now.
586 scheduleEnableFullscreenLoadDelayIfNecessary(); 589 scheduleEnableFullscreenLoadDelayIfNecessary();
587 590
588 if (didFinishLoad) { 591 if (didFinishLoad) {
589 // Simulate the PAGE_LOAD_FINISHED notification that we did not get. 592 // Simulate the PAGE_LOAD_FINISHED notification that we did not get.
590 didFinishPageLoad(); 593 didFinishPageLoad();
591 } 594 }
592 } 595 }
593 }; 596 };
594 597
598 private class TabBlimpContentsObserver implements BlimpContentsObserver {
nyquist 2016/08/16 19:09:20 This doesn't seem to access Tab members. Could thi
shaktisahu 2016/08/16 23:46:13 Acknowledged.
599 private Tab mTab;
600
601 public TabBlimpContentsObserver(Tab tab) {
nyquist 2016/08/16 19:09:20 I think I'd vote for splitting this out early, if
shaktisahu 2016/08/16 23:46:13 Done.
602 mTab = tab;
603 }
604 @Override
605 public void onNavigationStateChanged() {
606 mTab.updateTitle();
607 RewindableIterator<TabObserver> observers = mTab.getTabObservers();
608 while (observers.hasNext()) {
609 observers.next().onUrlUpdated(mTab);
610 }
611 }
612 }
613
595 private TabDelegateFactory mDelegateFactory; 614 private TabDelegateFactory mDelegateFactory;
596 615
597 private TopControlsVisibilityDelegate mTopControlsVisibilityDelegate; 616 private TopControlsVisibilityDelegate mTopControlsVisibilityDelegate;
598 617
599 /** 618 /**
600 * Creates an instance of a {@link Tab}. 619 * Creates an instance of a {@link Tab}.
601 * 620 *
602 * This constructor may be called before the native library has been loaded, so any additions 621 * This constructor may be called before the native library has been loaded, so any additions
603 * must be vetted for library calls. 622 * must be vetted for library calls.
604 * 623 *
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 * @param observer The {@link TabObserver} to remove. 746 * @param observer The {@link TabObserver} to remove.
728 */ 747 */
729 public void removeObserver(TabObserver observer) { 748 public void removeObserver(TabObserver observer) {
730 mObservers.removeObserver(observer); 749 mObservers.removeObserver(observer);
731 } 750 }
732 751
733 /** 752 /**
734 * @return Whether or not this tab has a previous navigation entry. 753 * @return Whether or not this tab has a previous navigation entry.
735 */ 754 */
736 public boolean canGoBack() { 755 public boolean canGoBack() {
737 return getWebContents() != null && getWebContents().getNavigationControl ler().canGoBack(); 756 if (isBlimpTab()) {
757 return getBlimpContents() != null
758 && getBlimpContents().getNavigationController().canGoBack();
759 } else {
760 return getWebContents() != null
761 && getWebContents().getNavigationController().canGoBack();
762 }
738 } 763 }
739 764
740 /** 765 /**
741 * @return Whether or not this tab has a navigation entry after the current one. 766 * @return Whether or not this tab has a navigation entry after the current one.
742 */ 767 */
743 public boolean canGoForward() { 768 public boolean canGoForward() {
744 return getWebContents() != null && getWebContents().getNavigationControl ler() 769 if (isBlimpTab()) {
745 .canGoForward(); 770 return getBlimpContents() != null
771 && getBlimpContents().getNavigationController().canGoForward ();
772 } else {
773 return getWebContents() != null
774 && getWebContents().getNavigationController().canGoForward() ;
775 }
746 } 776 }
747 777
748 /** 778 /**
749 * Goes to the navigation entry before the current one. 779 * Goes to the navigation entry before the current one.
750 */ 780 */
751 public void goBack() { 781 public void goBack() {
752 if (getWebContents() != null) getWebContents().getNavigationController() .goBack(); 782 if (isBlimpTab()) {
783 if (getBlimpContents() != null) getBlimpContents().getNavigationCont roller().goBack();
784 } else {
785 if (getWebContents() != null) getWebContents().getNavigationControll er().goBack();
786 }
753 } 787 }
754 788
755 /** 789 /**
756 * Goes to the navigation entry after the current one. 790 * Goes to the navigation entry after the current one.
757 */ 791 */
758 public void goForward() { 792 public void goForward() {
759 if (getWebContents() != null) getWebContents().getNavigationController() .goForward(); 793 if (isBlimpTab()) {
794 if (getBlimpContents() != null) {
795 getBlimpContents().getNavigationController().goForward();
796 }
797 } else {
798 if (getWebContents() != null) getWebContents().getNavigationControll er().goForward();
799 }
760 } 800 }
761 801
762 /** 802 /**
763 * Loads the current navigation if there is a pending lazy load (after tab r estore). 803 * Loads the current navigation if there is a pending lazy load (after tab r estore).
764 */ 804 */
765 public void loadIfNecessary() { 805 public void loadIfNecessary() {
766 if (getWebContents() != null) getWebContents().getNavigationController() .loadIfNecessary(); 806 if (getWebContents() != null) getWebContents().getNavigationController() .loadIfNecessary();
767 } 807 }
768 808
769 /** 809 /**
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 1024
985 printingController.setPendingPrint(new TabPrinter(this), 1025 printingController.setPendingPrint(new TabPrinter(this),
986 new PrintManagerDelegateImpl(getActivity())); 1026 new PrintManagerDelegateImpl(getActivity()));
987 } 1027 }
988 1028
989 /** 1029 /**
990 * Reloads the current page content. 1030 * Reloads the current page content.
991 */ 1031 */
992 public void reload() { 1032 public void reload() {
993 // TODO(dtrainor): Should we try to rebuild the ContentView if it's froz en? 1033 // TODO(dtrainor): Should we try to rebuild the ContentView if it's froz en?
994 if (getWebContents() != null) getWebContents().getNavigationController() .reload(true); 1034 if (isBlimpTab()) {
1035 if (getBlimpContents() != null) {
1036 getBlimpContents().getNavigationController().reload();
1037 }
1038 } else {
1039 if (getWebContents() != null) getWebContents().getNavigationControll er().reload(true);
1040 }
995 } 1041 }
996 1042
997 /** 1043 /**
998 * Reloads the current page content. 1044 * Reloads the current page content.
999 * This version ignores the cache and reloads from the network. 1045 * This version ignores the cache and reloads from the network.
1000 */ 1046 */
1001 public void reloadIgnoringCache() { 1047 public void reloadIgnoringCache() {
1002 if (getWebContents() != null) { 1048 if (getWebContents() != null) {
1003 getWebContents().getNavigationController().reloadBypassingCache(true ); 1049 getWebContents().getNavigationController().reloadBypassingCache(true );
1004 } 1050 }
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 } 1171 }
1126 1172
1127 /** 1173 /**
1128 * @return The web contents associated with this tab. 1174 * @return The web contents associated with this tab.
1129 */ 1175 */
1130 public WebContents getWebContents() { 1176 public WebContents getWebContents() {
1131 return mContentViewCore != null ? mContentViewCore.getWebContents() : nu ll; 1177 return mContentViewCore != null ? mContentViewCore.getWebContents() : nu ll;
1132 } 1178 }
1133 1179
1134 /** 1180 /**
1181 * @return The blimp contents associated with this tab, if in blimp mode.
nyquist 2016/08/16 19:09:20 {@link BlimpContents}
shaktisahu 2016/08/16 23:46:13 Done.
1182 */
1183 public BlimpContents getBlimpContents() {
1184 return mBlimpContents;
1185 }
1186
1187 /**
1188 * @return Whether or not this tab is running in blimp mode.
1189 */
1190 public boolean isBlimpTab() {
1191 return true;
nyquist 2016/08/16 19:09:20 Is this really always true? Or should this only be
shaktisahu 2016/08/16 23:46:13 Left it true accidentally. :(
1192 }
1193
1194 /**
1135 * @return The profile associated with this tab. 1195 * @return The profile associated with this tab.
1136 */ 1196 */
1137 public Profile getProfile() { 1197 public Profile getProfile() {
1138 if (mNativeTabAndroid == 0) return null; 1198 if (mNativeTabAndroid == 0) return null;
1139 return nativeGetProfileAndroid(mNativeTabAndroid); 1199 return nativeGetProfileAndroid(mNativeTabAndroid);
1140 } 1200 }
1141 1201
1142 /** 1202 /**
1143 * For more information about the uniqueness of {@link #getId()} see comment s on {@link Tab}. 1203 * For more information about the uniqueness of {@link #getId()} see comment s on {@link Tab}.
1144 * @see Tab 1204 * @see Tab
1145 * @return The id representing this tab. 1205 * @return The id representing this tab.
1146 */ 1206 */
1147 @CalledByNative 1207 @CalledByNative
1148 public int getId() { 1208 public int getId() {
1149 return mId; 1209 return mId;
1150 } 1210 }
1151 1211
1152 /** 1212 /**
1153 * @return Whether or not this tab is incognito. 1213 * @return Whether or not this tab is incognito.
1154 */ 1214 */
1215 @CalledByNative
1155 public boolean isIncognito() { 1216 public boolean isIncognito() {
1156 return mIncognito; 1217 return mIncognito;
1157 } 1218 }
1158 1219
1159 /** 1220 /**
1160 * @return The {@link ContentViewCore} associated with the current page, or {@code null} if 1221 * @return The {@link ContentViewCore} associated with the current page, or {@code null} if
1161 * there is no current page or the current page is displayed using a native view. 1222 * there is no current page or the current page is displayed using a native view.
1162 */ 1223 */
1163 public ContentViewCore getContentViewCore() { 1224 public ContentViewCore getContentViewCore() {
1164 return mNativePage == null ? mContentViewCore : null; 1225 return mNativePage == null ? mContentViewCore : null;
(...skipping 16 matching lines...) Expand all
1181 } 1242 }
1182 1243
1183 /** 1244 /**
1184 * Set whether or not the {@link ContentViewCore} should be using a desktop user agent for the 1245 * Set whether or not the {@link ContentViewCore} should be using a desktop user agent for the
1185 * currently loaded page. 1246 * currently loaded page.
1186 * @param useDesktop If {@code true}, use a desktop user agent. Otherwi se use a mobile one. 1247 * @param useDesktop If {@code true}, use a desktop user agent. Otherwi se use a mobile one.
1187 * @param reloadOnChange Reload the page if the user agent has changed. 1248 * @param reloadOnChange Reload the page if the user agent has changed.
1188 */ 1249 */
1189 public void setUseDesktopUserAgent(boolean useDesktop, boolean reloadOnChang e) { 1250 public void setUseDesktopUserAgent(boolean useDesktop, boolean reloadOnChang e) {
1190 if (getWebContents() != null) { 1251 if (getWebContents() != null) {
1191 getWebContents().getNavigationController() 1252 getWebContents().getNavigationController().setUseDesktopUserAgent(
1192 .setUseDesktopUserAgent(useDesktop, reloadOnChange); 1253 useDesktop, reloadOnChange);
1193 } 1254 }
1194 } 1255 }
1195 1256
1196 /** 1257 /**
1197 * @return Whether or not the {@link ContentViewCore} is using a desktop use r agent. 1258 * @return Whether or not the {@link ContentViewCore} is using a desktop use r agent.
1198 */ 1259 */
1199 public boolean getUseDesktopUserAgent() { 1260 public boolean getUseDesktopUserAgent() {
1200 return getWebContents() != null && getWebContents().getNavigationControl ler() 1261 return getWebContents() != null
1201 .getUseDesktopUserAgent(); 1262 && getWebContents().getNavigationController().getUseDesktopUserA gent();
1202 } 1263 }
1203 1264
1204 /** 1265 /**
1205 * @return The current {@link ConnectionSecurityLevel} for the tab. 1266 * @return The current {@link ConnectionSecurityLevel} for the tab.
1206 */ 1267 */
1207 // TODO(tedchoc): Remove this and transition all clients to use ToolbarModel directly. 1268 // TODO(tedchoc): Remove this and transition all clients to use ToolbarModel directly.
1208 public int getSecurityLevel() { 1269 public int getSecurityLevel() {
1209 return SecurityStateModel.getSecurityLevelForWebContents(getWebContents( )); 1270 return SecurityStateModel.getSecurityLevelForWebContents(getWebContents( ));
1210 } 1271 }
1211 1272
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
1443 // TODO(dtrainor): Remove this and move to a pull model instead of p ushing the layer. 1504 // TODO(dtrainor): Remove this and move to a pull model instead of p ushing the layer.
1444 attachTabContentManager(tabContentManager); 1505 attachTabContentManager(tabContentManager);
1445 1506
1446 // If there is a frozen WebContents state or a pending lazy load, do n't create a new 1507 // If there is a frozen WebContents state or a pending lazy load, do n't create a new
1447 // WebContents. 1508 // WebContents.
1448 if (getFrozenContentsState() != null || getPendingLoadParams() != nu ll) { 1509 if (getFrozenContentsState() != null || getPendingLoadParams() != nu ll) {
1449 if (unfreeze) unfreezeContents(); 1510 if (unfreeze) unfreezeContents();
1450 return; 1511 return;
1451 } 1512 }
1452 1513
1514 if (isBlimpTab() && getBlimpContents() == null) {
nyquist 2016/08/16 21:42:24 Maybe ask BlimpClientContext.isBlimpEnabled()? Tha
1515 nativeInitBlimpContents(mNativeTabAndroid);
1516 mBlimpContents = nativeGetBlimpContents(mNativeTabAndroid);
1517 getBlimpContents().addObserver(new TabBlimpContentsObserver(this ));
1518 }
1519
1453 boolean creatingWebContents = webContents == null; 1520 boolean creatingWebContents = webContents == null;
1454 if (creatingWebContents) { 1521 if (creatingWebContents) {
1455 webContents = WebContentsFactory.createWebContents(isIncognito() , initiallyHidden); 1522 webContents = WebContentsFactory.createWebContents(isIncognito() , initiallyHidden);
1456 } 1523 }
1457 1524
1458 ContentViewCore contentViewCore = ContentViewCore.fromWebContents(we bContents); 1525 ContentViewCore contentViewCore = ContentViewCore.fromWebContents(we bContents);
1459 1526
1460 if (contentViewCore == null) { 1527 if (contentViewCore == null) {
1461 initContentViewCore(webContents); 1528 initContentViewCore(webContents);
1462 } else { 1529 } else {
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
2009 if (mTabUma != null) mTabUma.onDestroy(); 2076 if (mTabUma != null) mTabUma.onDestroy();
2010 2077
2011 for (TabObserver observer : mObservers) observer.onDestroyed(this); 2078 for (TabObserver observer : mObservers) observer.onDestroyed(this);
2012 mObservers.clear(); 2079 mObservers.clear();
2013 2080
2014 NativePage currentNativePage = mNativePage; 2081 NativePage currentNativePage = mNativePage;
2015 mNativePage = null; 2082 mNativePage = null;
2016 destroyNativePageInternal(currentNativePage); 2083 destroyNativePageInternal(currentNativePage);
2017 destroyContentViewCore(true); 2084 destroyContentViewCore(true);
2018 2085
2086 mBlimpContents = null;
2087
2019 // Destroys the native tab after destroying the ContentView but before d estroying the 2088 // Destroys the native tab after destroying the ContentView but before d estroying the
2020 // InfoBarContainer. The native tab should be destroyed before the infob ar container as 2089 // InfoBarContainer. The native tab should be destroyed before the infob ar container as
2021 // destroying the native tab cleanups up any remaining infobars. The inf obar container 2090 // destroying the native tab cleanups up any remaining infobars. The inf obar container
2022 // expects all infobars to be cleaned up before its own destruction. 2091 // expects all infobars to be cleaned up before its own destruction.
2023 assert mNativeTabAndroid != 0; 2092 assert mNativeTabAndroid != 0;
2024 nativeDestroy(mNativeTabAndroid); 2093 nativeDestroy(mNativeTabAndroid);
2025 assert mNativeTabAndroid == 0; 2094 assert mNativeTabAndroid == 0;
2026 2095
2027 if (mInfoBarContainer != null) { 2096 if (mInfoBarContainer != null) {
2028 mInfoBarContainer.destroy(); 2097 mInfoBarContainer.destroy();
(...skipping 14 matching lines...) Expand all
2043 return mIsInitialized; 2112 return mIsInitialized;
2044 } 2113 }
2045 2114
2046 /** 2115 /**
2047 * @return The URL associated with the tab. 2116 * @return The URL associated with the tab.
2048 */ 2117 */
2049 @CalledByNative 2118 @CalledByNative
2050 public String getUrl() { 2119 public String getUrl() {
2051 String url = getWebContents() != null ? getWebContents().getUrl() : ""; 2120 String url = getWebContents() != null ? getWebContents().getUrl() : "";
2052 2121
2122 if (isBlimpTab()) {
nyquist 2016/08/16 19:09:20 Should this be moved to the top?
nyquist 2016/08/16 21:42:25 Bah. Ignore.
2123 url = getBlimpContents() != null ? getBlimpContents().getNavigationC ontroller().getUrl()
2124 : "";
2125 }
2126
2053 // If we have a ContentView, or a NativePage, or the url is not empty, w e have a WebContents 2127 // If we have a ContentView, or a NativePage, or the url is not empty, w e have a WebContents
2054 // so cache the WebContent's url. If not use the cached version. 2128 // so cache the WebContent's url. If not use the cached version.
nyquist 2016/08/16 21:42:24 Maybe check for BlimpContents as well here?
shaktisahu 2016/08/16 23:46:13 Actually TextUtils.isEmpty(url) will do that for y
2055 if (getContentViewCore() != null || getNativePage() != null || !TextUtil s.isEmpty(url)) { 2129 if (getContentViewCore() != null || getNativePage() != null || !TextUtil s.isEmpty(url)) {
2056 mUrl = url; 2130 mUrl = url;
2057 } 2131 }
2058 2132
2059 return mUrl != null ? mUrl : ""; 2133 return mUrl != null ? mUrl : "";
2060 } 2134 }
2061 2135
2062 /** 2136 /**
2063 * @return The tab title. 2137 * @return The tab title.
2064 */ 2138 */
2065 @CalledByNative 2139 @CalledByNative
2066 public String getTitle() { 2140 public String getTitle() {
2067 if (mTitle == null) updateTitle(); 2141 if (mTitle == null) updateTitle();
2068 return mTitle; 2142 return mTitle;
2069 } 2143 }
2070 2144
2071 void updateTitle() { 2145 void updateTitle() {
2072 if (isFrozen()) return; 2146 if (isFrozen()) return;
2073 2147
2074 // When restoring the tabs, the title will no longer be populated, so re quest it from the 2148 // When restoring the tabs, the title will no longer be populated, so re quest it from the
2075 // ContentViewCore or NativePage (if present). 2149 // ContentViewCore or NativePage (if present).
2076 String title = ""; 2150 String title = "";
2077 if (mNativePage != null) { 2151 if (mNativePage != null) {
2078 title = mNativePage.getTitle(); 2152 title = mNativePage.getTitle();
2153 } else if (getBlimpContents() != null) {
2154 title = getBlimpContents().getNavigationController().getTitle();
2079 } else if (getWebContents() != null) { 2155 } else if (getWebContents() != null) {
2080 title = getWebContents().getTitle(); 2156 title = getWebContents().getTitle();
2081 } 2157 }
2082 updateTitle(title); 2158 updateTitle(title);
2083 } 2159 }
2084 2160
2085 /** 2161 /**
2086 * Cache the title for the current page. 2162 * Cache the title for the current page.
2087 * 2163 *
2088 * {@link ContentViewClient#onUpdateTitle} is unreliable, particularly for n avigating backwards 2164 * {@link ContentViewClient#onUpdateTitle} is unreliable, particularly for n avigating backwards
(...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after
3244 String packageName = ContextUtils.getApplicationContext().getPackageName (); 3320 String packageName = ContextUtils.getApplicationContext().getPackageName ();
3245 return getLaunchType() == TabLaunchType.FROM_EXTERNAL_APP 3321 return getLaunchType() == TabLaunchType.FROM_EXTERNAL_APP
3246 && !TextUtils.equals(getAppAssociatedWith(), packageName); 3322 && !TextUtils.equals(getAppAssociatedWith(), packageName);
3247 } 3323 }
3248 3324
3249 private native void nativeInit(); 3325 private native void nativeInit();
3250 private native void nativeDestroy(long nativeTabAndroid); 3326 private native void nativeDestroy(long nativeTabAndroid);
3251 private native void nativeInitWebContents(long nativeTabAndroid, boolean inc ognito, 3327 private native void nativeInitWebContents(long nativeTabAndroid, boolean inc ognito,
3252 WebContents webContents, TabWebContentsDelegateAndroid delegate, 3328 WebContents webContents, TabWebContentsDelegateAndroid delegate,
3253 ContextMenuPopulator contextMenuPopulator); 3329 ContextMenuPopulator contextMenuPopulator);
3330 private native void nativeInitBlimpContents(long nativeTabAndroid);
3331 private native BlimpContents nativeGetBlimpContents(long nativeTabAndroid);
3254 private native void nativeUpdateDelegates(long nativeTabAndroid, 3332 private native void nativeUpdateDelegates(long nativeTabAndroid,
3255 TabWebContentsDelegateAndroid delegate, ContextMenuPopulator context MenuPopulator); 3333 TabWebContentsDelegateAndroid delegate, ContextMenuPopulator context MenuPopulator);
3256 private native void nativeDestroyWebContents(long nativeTabAndroid, boolean deleteNative); 3334 private native void nativeDestroyWebContents(long nativeTabAndroid, boolean deleteNative);
3257 private native Profile nativeGetProfileAndroid(long nativeTabAndroid); 3335 private native Profile nativeGetProfileAndroid(long nativeTabAndroid);
3258 private native int nativeLoadUrl(long nativeTabAndroid, String url, String e xtraHeaders, 3336 private native int nativeLoadUrl(long nativeTabAndroid, String url, String e xtraHeaders,
3259 ResourceRequestBody postData, int transition, String referrerUrl, in t referrerPolicy, 3337 ResourceRequestBody postData, int transition, String referrerUrl, in t referrerPolicy,
3260 boolean isRendererInitiated, boolean shoulReplaceCurrentEntry, 3338 boolean isRendererInitiated, boolean shoulReplaceCurrentEntry,
3261 long intentReceivedTimestamp, boolean hasUserGesture); 3339 long intentReceivedTimestamp, boolean hasUserGesture);
3262 private native void nativeSetActiveNavigationEntryTitleForUrl(long nativeTab Android, String url, 3340 private native void nativeSetActiveNavigationEntryTitleForUrl(long nativeTab Android, String url,
3263 String title); 3341 String title);
(...skipping 10 matching lines...) Expand all
3274 private native void nativeSetInterceptNavigationDelegate(long nativeTabAndro id, 3352 private native void nativeSetInterceptNavigationDelegate(long nativeTabAndro id,
3275 InterceptNavigationDelegate delegate); 3353 InterceptNavigationDelegate delegate);
3276 private native void nativeAttachToTabContentManager(long nativeTabAndroid, 3354 private native void nativeAttachToTabContentManager(long nativeTabAndroid,
3277 TabContentManager tabContentManager); 3355 TabContentManager tabContentManager);
3278 private native void nativeAttachOverlayWebContents( 3356 private native void nativeAttachOverlayWebContents(
3279 long nativeTabAndroid, WebContents webContents, boolean visible); 3357 long nativeTabAndroid, WebContents webContents, boolean visible);
3280 private native void nativeDetachOverlayWebContents( 3358 private native void nativeDetachOverlayWebContents(
3281 long nativeTabAndroid, WebContents webContents); 3359 long nativeTabAndroid, WebContents webContents);
3282 private native boolean nativeHasPrerenderedUrl(long nativeTabAndroid, String url); 3360 private native boolean nativeHasPrerenderedUrl(long nativeTabAndroid, String url);
3283 } 3361 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698