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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarManager.java

Issue 1381003004: Better distinguish didFinishLoad and didStopLoading (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix android failure Created 5 years, 2 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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.toolbar; 5 package org.chromium.chrome.browser.toolbar;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.graphics.drawable.Drawable; 8 import android.graphics.drawable.Drawable;
9 import android.os.Handler; 9 import android.os.Handler;
10 import android.os.Looper; 10 import android.os.Looper;
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 public void onDidNavigateMainFrame(Tab tab, String url, String baseU rl, 303 public void onDidNavigateMainFrame(Tab tab, String url, String baseU rl,
304 boolean isNavigationToDifferentPage, boolean isFragmentNavig ation, 304 boolean isNavigationToDifferentPage, boolean isFragmentNavig ation,
305 int statusCode) { 305 int statusCode) {
306 if (isNavigationToDifferentPage) { 306 if (isNavigationToDifferentPage) {
307 mToolbar.onNavigatedToDifferentPage(); 307 mToolbar.onNavigatedToDifferentPage();
308 } 308 }
309 } 309 }
310 310
311 @Override 311 @Override
312 public void onPageLoadStarted(Tab tab, String url) { 312 public void onPageLoadStarted(Tab tab, String url) {
313 updateButtonStatus(); 313 updateButtonStatus();
Ted C 2015/10/27 23:07:20 Based on your comments on the change, I think all
Nate Chapin 2015/10/28 20:57:39 Done, toDifferentDocument propagated.
314 updateTabLoadingState(true);
315 mLoadProgressSimulator.cancel(); 314 mLoadProgressSimulator.cancel();
316 315
317 if (NativePageFactory.isNativePageUrl(url, tab.isIncognito())) { 316 if (NativePageFactory.isNativePageUrl(url, tab.isIncognito())) {
318 finishLoadProgress(false); 317 finishLoadProgress(false);
319 } else {
320 mToolbar.startLoadProgress();
321 setLoadProgress(0.0f);
322 } 318 }
323 } 319 }
324 320
325 @Override 321 @Override
326 public void onPageLoadFinished(Tab tab) {
327 Tab currentTab = mToolbarModel.getTab();
328 updateTabLoadingState(true);
329
330 // If we made some progress, fast-forward to complete, otherwise just dismiss any
331 // MINIMUM_LOAD_PROGRESS that had been set.
332 if (currentTab.getProgress() > MINIMUM_LOAD_PROGRESS) setLoadPro gress(1.0f);
333 finishLoadProgress(true);
334 }
335
336 @Override
337 public void onPageLoadFailed(Tab tab, int errorCode) {
338 updateTabLoadingState(true);
339 finishLoadProgress(false);
340 }
341
342 @Override
343 public void onTitleUpdated(Tab tab) { 322 public void onTitleUpdated(Tab tab) {
344 mLocationBar.setTitleToPageTitle(); 323 mLocationBar.setTitleToPageTitle();
345 } 324 }
346 325
347 @Override 326 @Override
348 public void onUrlUpdated(Tab tab) { 327 public void onUrlUpdated(Tab tab) {
349 // Update the SSL security state as a result of this notificatio n as it will 328 // Update the SSL security state as a result of this notificatio n as it will
350 // sometimes be the only update we receive. 329 // sometimes be the only update we receive.
351 updateTabLoadingState(true); 330 updateTabLoadingState(true);
352 331
353 // A URL update is a decent enough indicator that the toolbar wi dget is in 332 // A URL update is a decent enough indicator that the toolbar wi dget is in
354 // a stable state to capture its bitmap for use in fullscreen. 333 // a stable state to capture its bitmap for use in fullscreen.
355 mControlContainer.setReadyForBitmapCapture(true); 334 mControlContainer.setReadyForBitmapCapture(true);
356 } 335 }
357 336
358 @Override 337 @Override
359 public void onCrash(Tab tab, boolean sadTabShown) { 338 public void onCrash(Tab tab, boolean sadTabShown) {
360 updateTabLoadingState(false); 339 updateTabLoadingState(false);
361 updateButtonStatus(); 340 updateButtonStatus();
362 finishLoadProgress(false); 341 finishLoadProgress(false);
363 } 342 }
364 343
365 @Override 344 @Override
345 public void onLoadStarted(Tab tab) {
346 updateTabLoadingState(true);
347 mToolbar.startLoadProgress();
348 setLoadProgress(0.0f);
349 }
350
351 @Override
352 public void onLoadStopped(Tab tab) {
353 updateTabLoadingState(true);
354
355 // If we made some progress, fast-forward to complete, otherwise just dismiss any
356 // MINIMUM_LOAD_PROGRESS that had been set.
357 if (tab.getProgress() > MINIMUM_LOAD_PROGRESS && tab.getProgress () < 1.0f) {
358 setLoadProgress(1.0f);
359 }
360 finishLoadProgress(true);
361 }
362
363 @Override
366 public void onLoadProgressChanged(Tab tab, int progress) { 364 public void onLoadProgressChanged(Tab tab, int progress) {
367 // TODO(kkimlabs): Investigate using float progress all the way up to Blink. 365 // TODO(kkimlabs): Investigate using float progress all the way up to Blink.
368 setLoadProgress(progress / 100.0f); 366 setLoadProgress(progress / 100.0f);
369 } 367 }
370 368
371 @Override 369 @Override
372 public void onContentChanged(Tab tab) { 370 public void onContentChanged(Tab tab) {
373 mToolbar.onTabContentViewChanged(); 371 mToolbar.onTabContentViewChanged();
374 } 372 }
375 373
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
1083 } 1081 }
1084 1082
1085 /** 1083 /**
1086 * Cancels simulating load progress. 1084 * Cancels simulating load progress.
1087 */ 1085 */
1088 public void cancel() { 1086 public void cancel() {
1089 mHandler.removeMessages(MSG_ID_UPDATE_PROGRESS); 1087 mHandler.removeMessages(MSG_ID_UPDATE_PROGRESS);
1090 } 1088 }
1091 } 1089 }
1092 } 1090 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698