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

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

Issue 2207583002: Correct location bar behavior on load fail (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: also finish load progress 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.content.res.Configuration; 8 import android.content.res.Configuration;
9 import android.graphics.drawable.Drawable; 9 import android.graphics.drawable.Drawable;
10 import android.os.Handler; 10 import android.os.Handler;
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 ntp.setUrlFocusAnimationsDisabled(true); 409 ntp.setUrlFocusAnimationsDisabled(true);
410 mToolbar.onTabOrModelChanged(); 410 mToolbar.onTabOrModelChanged();
411 } 411 }
412 } 412 }
413 413
414 @Override 414 @Override
415 public void onDidFailLoad(Tab tab, boolean isProvisionalLoad, boolea n isMainFrame, 415 public void onDidFailLoad(Tab tab, boolean isProvisionalLoad, boolea n isMainFrame,
416 int errorCode, String description, String failingUrl) { 416 int errorCode, String description, String failingUrl) {
417 NewTabPage ntp = mToolbarModel.getNewTabPageForCurrentTab(); 417 NewTabPage ntp = mToolbarModel.getNewTabPageForCurrentTab();
418 if (ntp == null) return; 418 if (ntp == null) return;
419 if (isProvisionalLoad && isMainFrame) { 419
420 // If the load failed due to a different navigation, there is no need to reset the
421 // the location bar animations.
422 boolean isFailingToNtp = tab.getWebContents() != null
Ted C 2016/08/02 20:55:18 Hmm...I'm a bit confused what this is checking for
423 && tab.getWebContents().getVisibleUrl().equals(UrlConsta nts.NTP_URL);
424
425 if (isProvisionalLoad && isMainFrame && isFailingToNtp) {
420 ntp.setUrlFocusAnimationsDisabled(false); 426 ntp.setUrlFocusAnimationsDisabled(false);
421 mToolbar.onTabOrModelChanged(); 427 mToolbar.onTabOrModelChanged();
428 if (mToolbar.getProgressBar() != null) mToolbar.getProgressB ar().finish(false);
422 } 429 }
423 } 430 }
424 431
425 @Override 432 @Override
426 public void onContextualActionBarVisibilityChanged(Tab tab, boolean visible) { 433 public void onContextualActionBarVisibilityChanged(Tab tab, boolean visible) {
427 if (visible) RecordUserAction.record("MobileActionBarShown"); 434 if (visible) RecordUserAction.record("MobileActionBarShown");
428 ActionBar actionBar = mActionBarDelegate.getSupportActionBar(); 435 ActionBar actionBar = mActionBarDelegate.getSupportActionBar();
429 if (!visible && actionBar != null) actionBar.hide(); 436 if (!visible && actionBar != null) actionBar.hide();
430 if (DeviceFormFactor.isTablet(activity)) { 437 if (DeviceFormFactor.isTablet(activity)) {
431 if (visible) { 438 if (visible) {
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after
1216 } 1223 }
1217 1224
1218 /** 1225 /**
1219 * Cancels simulating load progress. 1226 * Cancels simulating load progress.
1220 */ 1227 */
1221 public void cancel() { 1228 public void cancel() {
1222 mHandler.removeMessages(MSG_ID_UPDATE_PROGRESS); 1229 mHandler.removeMessages(MSG_ID_UPDATE_PROGRESS);
1223 } 1230 }
1224 } 1231 }
1225 } 1232 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698