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

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

Issue 1381003004: Better distinguish didFinishLoad and didStopLoading (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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.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 1377 matching lines...) Expand 10 before | Expand all | Expand 10 after
1388 observer.onOverlayContentViewCoreRemoved(this, content); 1388 observer.onOverlayContentViewCoreRemoved(this, content);
1389 } 1389 }
1390 1390
1391 assert mOverlayContentViewCores.contains(content); 1391 assert mOverlayContentViewCores.contains(content);
1392 mOverlayContentViewCores.remove(content); 1392 mOverlayContentViewCores.remove(content);
1393 1393
1394 nativeDetachOverlayContentViewCore(mNativeTabAndroid, content); 1394 nativeDetachOverlayContentViewCore(mNativeTabAndroid, content);
1395 } 1395 }
1396 1396
1397 /** 1397 /**
1398 * Called when a navigation begins and no navigation was in progress
1399 * @param toDifferentDocument Whether this navigation will transition betwee n
1400 * documents (i.e., not a fragment navigation or JS History API call).
1401 */
1402 protected void onLoadStarted(boolean toDifferentDocument) {
1403 if (toDifferentDocument) mIsLoading = true;
1404 for (TabObserver observer : mObservers) observer.onLoadStarted(this, toD ifferentDocument);
1405 }
1406
1407 /**
1408 * Called when a navigation completes and no other navigation is in progress .
1409 */
1410 protected void onLoadStopped() {
1411 // mIsLoading should only be false if this is a same-document navigation .
1412 boolean toDifferentDocument = mIsLoading;
1413 mIsLoading = false;
1414 for (TabObserver observer : mObservers) observer.onLoadStopped(this, toD ifferentDocument);
1415 }
1416
1417 /**
1398 * Called when a page has started loading. 1418 * Called when a page has started loading.
1399 * @param validatedUrl URL being loaded. 1419 * @param validatedUrl URL being loaded.
1400 * @param showingErrorPage Whether an error page is being shown. 1420 * @param showingErrorPage Whether an error page is being shown.
1401 */ 1421 */
1402 protected void didStartPageLoad(String validatedUrl, boolean showingErrorPag e) { 1422 protected void didStartPageLoad(String validatedUrl, boolean showingErrorPag e) {
1403 mIsFullscreenWaitingForLoad = !DomDistillerUrlUtils.isDistilledPage(vali datedUrl); 1423 mIsFullscreenWaitingForLoad = !DomDistillerUrlUtils.isDistilledPage(vali datedUrl);
1404 1424
1405 mIsShowingErrorPage = showingErrorPage; 1425 mIsShowingErrorPage = showingErrorPage;
1406 mIsLoading = true;
1407 1426
1408 updateTitle(); 1427 updateTitle();
1409 removeSadTabIfPresent(); 1428 removeSadTabIfPresent();
1410 1429
1411 clearHungRendererState(); 1430 clearHungRendererState();
1412 1431
1413 for (TabObserver observer : mObservers) observer.onPageLoadStarted(this, validatedUrl); 1432 for (TabObserver observer : mObservers) observer.onPageLoadStarted(this, validatedUrl);
1414 } 1433 }
1415 1434
1416 /** 1435 /**
1417 * Called when a page has finished loading. 1436 * Called when a page has finished loading.
1418 */ 1437 */
1419 protected void didFinishPageLoad() { 1438 protected void didFinishPageLoad() {
1420 mIsLoading = false;
1421 mIsBeingRestored = false; 1439 mIsBeingRestored = false;
1422 mIsTabStateDirty = true; 1440 mIsTabStateDirty = true;
1423 updateTitle(); 1441 updateTitle();
1424 updateFullscreenEnabledState(); 1442 updateFullscreenEnabledState();
1425 if (!isNativePage()) { 1443 if (!isNativePage()) {
1426 RecordHistogram.recordBooleanHistogram( 1444 RecordHistogram.recordBooleanHistogram(
1427 "Navigation.IsMobileOptimized", mContentViewCore.getIsMobile OptimizedHint()); 1445 "Navigation.IsMobileOptimized", mContentViewCore.getIsMobile OptimizedHint());
1428 } 1446 }
1429 1447
1430 if (mTabUma != null) mTabUma.onLoadFinished(); 1448 if (mTabUma != null) mTabUma.onLoadFinished();
(...skipping 12 matching lines...) Expand all
1443 MSG_ID_ENABLE_FULLSCREEN_AFTER_LOAD, MAX_FULLSCREEN_LOAD_DEL AY_MS); 1461 MSG_ID_ENABLE_FULLSCREEN_AFTER_LOAD, MAX_FULLSCREEN_LOAD_DEL AY_MS);
1444 } 1462 }
1445 } 1463 }
1446 1464
1447 /** 1465 /**
1448 * Called when a page has failed loading. 1466 * Called when a page has failed loading.
1449 * @param errorCode The error code causing the page to fail loading. 1467 * @param errorCode The error code causing the page to fail loading.
1450 */ 1468 */
1451 protected void didFailPageLoad(int errorCode) { 1469 protected void didFailPageLoad(int errorCode) {
1452 cancelEnableFullscreenLoadDelay(); 1470 cancelEnableFullscreenLoadDelay();
1453 mIsLoading = false;
1454 mIsBeingRestored = false; 1471 mIsBeingRestored = false;
1455 if (mTabUma != null) mTabUma.onLoadFailed(errorCode); 1472 if (mTabUma != null) mTabUma.onLoadFailed(errorCode);
1456 for (TabObserver observer : mObservers) observer.onPageLoadFailed(this, errorCode); 1473 for (TabObserver observer : mObservers) observer.onPageLoadFailed(this, errorCode);
1457 updateFullscreenEnabledState(); 1474 updateFullscreenEnabledState();
1458 } 1475 }
1459 1476
1460 private void cancelEnableFullscreenLoadDelay() { 1477 private void cancelEnableFullscreenLoadDelay() {
1461 mHandler.removeMessages(MSG_ID_ENABLE_FULLSCREEN_AFTER_LOAD); 1478 mHandler.removeMessages(MSG_ID_ENABLE_FULLSCREEN_AFTER_LOAD);
1462 mIsFullscreenWaitingForLoad = false; 1479 mIsFullscreenWaitingForLoad = false;
1463 } 1480 }
(...skipping 1390 matching lines...) Expand 10 before | Expand all | Expand 10 after
2854 private native void nativeSetInterceptNavigationDelegate(long nativeTabAndro id, 2871 private native void nativeSetInterceptNavigationDelegate(long nativeTabAndro id,
2855 InterceptNavigationDelegate delegate); 2872 InterceptNavigationDelegate delegate);
2856 private native void nativeAttachToTabContentManager(long nativeTabAndroid, 2873 private native void nativeAttachToTabContentManager(long nativeTabAndroid,
2857 TabContentManager tabContentManager); 2874 TabContentManager tabContentManager);
2858 private native void nativeAttachOverlayContentViewCore(long nativeTabAndroid , 2875 private native void nativeAttachOverlayContentViewCore(long nativeTabAndroid ,
2859 ContentViewCore content, boolean visible); 2876 ContentViewCore content, boolean visible);
2860 private native void nativeDetachOverlayContentViewCore(long nativeTabAndroid , 2877 private native void nativeDetachOverlayContentViewCore(long nativeTabAndroid ,
2861 ContentViewCore content); 2878 ContentViewCore content);
2862 private native boolean nativeHasPrerenderedUrl(long nativeTabAndroid, String url); 2879 private native boolean nativeHasPrerenderedUrl(long nativeTabAndroid, String url);
2863 } 2880 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698