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.app.Activity; | 7 import android.app.Activity; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.content.Intent; | 9 import android.content.Intent; |
10 import android.content.res.Resources; | 10 import android.content.res.Resources; |
(...skipping 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1387 observer.onOverlayContentViewCoreRemoved(this, content); | 1387 observer.onOverlayContentViewCoreRemoved(this, content); |
1388 } | 1388 } |
1389 | 1389 |
1390 assert mOverlayContentViewCores.contains(content); | 1390 assert mOverlayContentViewCores.contains(content); |
1391 mOverlayContentViewCores.remove(content); | 1391 mOverlayContentViewCores.remove(content); |
1392 | 1392 |
1393 nativeDetachOverlayContentViewCore(mNativeTabAndroid, content); | 1393 nativeDetachOverlayContentViewCore(mNativeTabAndroid, content); |
1394 } | 1394 } |
1395 | 1395 |
1396 /** | 1396 /** |
1397 * Called when a navigation begins and no navigation was in progress | |
1398 * @param toDifferentDocument Whether this navigation will transition betwee n | |
1399 * documents (i.e., not a fragment navigation or JS History API call). | |
1400 */ | |
1401 protected void onLoadStarted(boolean toDifferentDocument) { | |
1402 mIsLoading = true; | |
Ted C
2015/10/28 23:41:02
To keep the logic the same as before, I think you
Nate Chapin
2015/10/30 20:41:34
Guarded here. I don't think onLoadStopped needs th
| |
1403 for (TabObserver observer : mObservers) observer.onLoadStarted(this, toD ifferentDocument); | |
1404 } | |
1405 | |
1406 /** | |
1407 * Called when a navigation completes and no other navigation is in progress . | |
1408 */ | |
1409 protected void onLoadStopped() { | |
1410 mIsLoading = false; | |
1411 for (TabObserver observer : mObservers) observer.onLoadStopped(this); | |
1412 } | |
1413 | |
1414 /** | |
1397 * Called when a page has started loading. | 1415 * Called when a page has started loading. |
1398 * @param validatedUrl URL being loaded. | 1416 * @param validatedUrl URL being loaded. |
1399 * @param showingErrorPage Whether an error page is being shown. | 1417 * @param showingErrorPage Whether an error page is being shown. |
1400 */ | 1418 */ |
1401 protected void didStartPageLoad(String validatedUrl, boolean showingErrorPag e) { | 1419 protected void didStartPageLoad(String validatedUrl, boolean showingErrorPag e) { |
1402 mIsFullscreenWaitingForLoad = !DomDistillerUrlUtils.isDistilledPage(vali datedUrl); | 1420 mIsFullscreenWaitingForLoad = !DomDistillerUrlUtils.isDistilledPage(vali datedUrl); |
1403 | 1421 |
1404 mIsShowingErrorPage = showingErrorPage; | 1422 mIsShowingErrorPage = showingErrorPage; |
1405 mIsLoading = true; | |
1406 | 1423 |
1407 updateTitle(); | 1424 updateTitle(); |
1408 removeSadTabIfPresent(); | 1425 removeSadTabIfPresent(); |
1409 | 1426 |
1410 clearHungRendererState(); | 1427 clearHungRendererState(); |
1411 | 1428 |
1412 for (TabObserver observer : mObservers) observer.onPageLoadStarted(this, validatedUrl); | 1429 for (TabObserver observer : mObservers) observer.onPageLoadStarted(this, validatedUrl); |
1413 } | 1430 } |
1414 | 1431 |
1415 /** | 1432 /** |
1416 * Called when a page has finished loading. | 1433 * Called when a page has finished loading. |
1417 */ | 1434 */ |
1418 protected void didFinishPageLoad() { | 1435 protected void didFinishPageLoad() { |
1419 mIsLoading = false; | |
1420 mIsBeingRestored = false; | 1436 mIsBeingRestored = false; |
1421 mIsTabStateDirty = true; | 1437 mIsTabStateDirty = true; |
1422 updateTitle(); | 1438 updateTitle(); |
1423 updateFullscreenEnabledState(); | 1439 updateFullscreenEnabledState(); |
1424 if (!isNativePage()) { | 1440 if (!isNativePage()) { |
1425 RecordHistogram.recordBooleanHistogram( | 1441 RecordHistogram.recordBooleanHistogram( |
1426 "Navigation.IsMobileOptimized", mContentViewCore.getIsMobile OptimizedHint()); | 1442 "Navigation.IsMobileOptimized", mContentViewCore.getIsMobile OptimizedHint()); |
1427 } | 1443 } |
1428 | 1444 |
1429 if (mTabUma != null) mTabUma.onLoadFinished(); | 1445 if (mTabUma != null) mTabUma.onLoadFinished(); |
(...skipping 12 matching lines...) Expand all Loading... | |
1442 MSG_ID_ENABLE_FULLSCREEN_AFTER_LOAD, MAX_FULLSCREEN_LOAD_DEL AY_MS); | 1458 MSG_ID_ENABLE_FULLSCREEN_AFTER_LOAD, MAX_FULLSCREEN_LOAD_DEL AY_MS); |
1443 } | 1459 } |
1444 } | 1460 } |
1445 | 1461 |
1446 /** | 1462 /** |
1447 * Called when a page has failed loading. | 1463 * Called when a page has failed loading. |
1448 * @param errorCode The error code causing the page to fail loading. | 1464 * @param errorCode The error code causing the page to fail loading. |
1449 */ | 1465 */ |
1450 protected void didFailPageLoad(int errorCode) { | 1466 protected void didFailPageLoad(int errorCode) { |
1451 cancelEnableFullscreenLoadDelay(); | 1467 cancelEnableFullscreenLoadDelay(); |
1452 mIsLoading = false; | |
1453 mIsBeingRestored = false; | 1468 mIsBeingRestored = false; |
1454 if (mTabUma != null) mTabUma.onLoadFailed(errorCode); | 1469 if (mTabUma != null) mTabUma.onLoadFailed(errorCode); |
1455 for (TabObserver observer : mObservers) observer.onPageLoadFailed(this, errorCode); | 1470 for (TabObserver observer : mObservers) observer.onPageLoadFailed(this, errorCode); |
1456 updateFullscreenEnabledState(); | 1471 updateFullscreenEnabledState(); |
1457 } | 1472 } |
1458 | 1473 |
1459 private void cancelEnableFullscreenLoadDelay() { | 1474 private void cancelEnableFullscreenLoadDelay() { |
1460 mHandler.removeMessages(MSG_ID_ENABLE_FULLSCREEN_AFTER_LOAD); | 1475 mHandler.removeMessages(MSG_ID_ENABLE_FULLSCREEN_AFTER_LOAD); |
1461 mIsFullscreenWaitingForLoad = false; | 1476 mIsFullscreenWaitingForLoad = false; |
1462 } | 1477 } |
(...skipping 1398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2861 private native void nativeSetInterceptNavigationDelegate(long nativeTabAndro id, | 2876 private native void nativeSetInterceptNavigationDelegate(long nativeTabAndro id, |
2862 InterceptNavigationDelegate delegate); | 2877 InterceptNavigationDelegate delegate); |
2863 private native void nativeAttachToTabContentManager(long nativeTabAndroid, | 2878 private native void nativeAttachToTabContentManager(long nativeTabAndroid, |
2864 TabContentManager tabContentManager); | 2879 TabContentManager tabContentManager); |
2865 private native void nativeAttachOverlayContentViewCore(long nativeTabAndroid , | 2880 private native void nativeAttachOverlayContentViewCore(long nativeTabAndroid , |
2866 ContentViewCore content, boolean visible); | 2881 ContentViewCore content, boolean visible); |
2867 private native void nativeDetachOverlayContentViewCore(long nativeTabAndroid , | 2882 private native void nativeDetachOverlayContentViewCore(long nativeTabAndroid , |
2868 ContentViewCore content); | 2883 ContentViewCore content); |
2869 private native boolean nativeHasPrerenderedUrl(long nativeTabAndroid, String url); | 2884 private native boolean nativeHasPrerenderedUrl(long nativeTabAndroid, String url); |
2870 } | 2885 } |
OLD | NEW |