OLD | NEW |
---|---|
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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
310 public void onWebContentsInstantSupportDisabled() { | 310 public void onWebContentsInstantSupportDisabled() { |
311 mLocationBar.setUrlToPageUrl(); | 311 mLocationBar.setUrlToPageUrl(); |
312 } | 312 } |
313 | 313 |
314 @Override | 314 @Override |
315 public void onDidNavigateMainFrame(Tab tab, String url, String baseU rl, | 315 public void onDidNavigateMainFrame(Tab tab, String url, String baseU rl, |
316 boolean isNavigationToDifferentPage, boolean isFragmentNavig ation, | 316 boolean isNavigationToDifferentPage, boolean isFragmentNavig ation, |
317 int statusCode) { | 317 int statusCode) { |
318 if (isNavigationToDifferentPage) { | 318 if (isNavigationToDifferentPage) { |
319 mToolbar.onNavigatedToDifferentPage(); | 319 mToolbar.onNavigatedToDifferentPage(); |
320 mToolbar.startLoadProgress(); | |
321 updateLoadProgress(tab.getProgress()); | |
mdjones
2016/06/20 20:58:40
If I'm not mistaken, this should always happen aft
Nate Chapin
2016/06/21 21:06:28
I think there may have been a bug fix between when
| |
320 } | 322 } |
321 } | 323 } |
322 | 324 |
323 @Override | 325 @Override |
324 public void onTitleUpdated(Tab tab) { | 326 public void onTitleUpdated(Tab tab) { |
325 mLocationBar.setTitleToPageTitle(); | 327 mLocationBar.setTitleToPageTitle(); |
326 } | 328 } |
327 | 329 |
328 @Override | 330 @Override |
329 public void onUrlUpdated(Tab tab) { | 331 public void onUrlUpdated(Tab tab) { |
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1142 private void updateLoadProgress(int progress) { | 1144 private void updateLoadProgress(int progress) { |
1143 // If it's a native page, progress bar is already hidden or being hidden , so don't update | 1145 // If it's a native page, progress bar is already hidden or being hidden , so don't update |
1144 // the value. | 1146 // the value. |
1145 // TODO(kkimlabs): Investigate back/forward navigation with native page & web content and | 1147 // TODO(kkimlabs): Investigate back/forward navigation with native page & web content and |
1146 // figure out the correct progress bar presentation. | 1148 // figure out the correct progress bar presentation. |
1147 Tab tab = mToolbarModel.getTab(); | 1149 Tab tab = mToolbarModel.getTab(); |
1148 if (NativePageFactory.isNativePageUrl(tab.getUrl(), tab.isIncognito())) return; | 1150 if (NativePageFactory.isNativePageUrl(tab.getUrl(), tab.isIncognito())) return; |
1149 | 1151 |
1150 progress = Math.max(progress, MINIMUM_LOAD_PROGRESS); | 1152 progress = Math.max(progress, MINIMUM_LOAD_PROGRESS); |
1151 mToolbar.setLoadProgress(progress / 100f); | 1153 mToolbar.setLoadProgress(progress / 100f); |
1154 if (progress == 100) finishLoadProgress(true); | |
mdjones
2016/06/20 20:58:41
Can updateLoadProgress hit 100 without triggering
Nate Chapin
2016/06/21 21:06:28
On trunk, no, 100 is only triggered as part of onL
| |
1152 } | 1155 } |
1153 | 1156 |
1154 private void finishLoadProgress(boolean delayed) { | 1157 private void finishLoadProgress(boolean delayed) { |
1155 mLoadProgressSimulator.cancel(); | 1158 mLoadProgressSimulator.cancel(); |
1156 mToolbar.finishLoadProgress(delayed); | 1159 mToolbar.finishLoadProgress(delayed); |
1157 } | 1160 } |
1158 | 1161 |
1159 /** | 1162 /** |
1160 * Only start showing the progress bar if it is not already started. | 1163 * Only start showing the progress bar if it is not already started. |
1161 */ | 1164 */ |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1218 } | 1221 } |
1219 | 1222 |
1220 /** | 1223 /** |
1221 * Cancels simulating load progress. | 1224 * Cancels simulating load progress. |
1222 */ | 1225 */ |
1223 public void cancel() { | 1226 public void cancel() { |
1224 mHandler.removeMessages(MSG_ID_UPDATE_PROGRESS); | 1227 mHandler.removeMessages(MSG_ID_UPDATE_PROGRESS); |
1225 } | 1228 } |
1226 } | 1229 } |
1227 } | 1230 } |
OLD | NEW |