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 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1142 private void updateLoadProgress(int progress) { | 1142 private void updateLoadProgress(int progress) { |
1143 // If it's a native page, progress bar is already hidden or being hidden
, so don't update | 1143 // If it's a native page, progress bar is already hidden or being hidden
, so don't update |
1144 // the value. | 1144 // the value. |
1145 // TODO(kkimlabs): Investigate back/forward navigation with native page
& web content and | 1145 // TODO(kkimlabs): Investigate back/forward navigation with native page
& web content and |
1146 // figure out the correct progress bar presentation. | 1146 // figure out the correct progress bar presentation. |
1147 Tab tab = mToolbarModel.getTab(); | 1147 Tab tab = mToolbarModel.getTab(); |
1148 if (NativePageFactory.isNativePageUrl(tab.getUrl(), tab.isIncognito()))
return; | 1148 if (NativePageFactory.isNativePageUrl(tab.getUrl(), tab.isIncognito()))
return; |
1149 | 1149 |
1150 progress = Math.max(progress, MINIMUM_LOAD_PROGRESS); | 1150 progress = Math.max(progress, MINIMUM_LOAD_PROGRESS); |
1151 mToolbar.setLoadProgress(progress / 100f); | 1151 mToolbar.setLoadProgress(progress / 100f); |
| 1152 if (progress == 100) finishLoadProgress(true); |
1152 } | 1153 } |
1153 | 1154 |
1154 private void finishLoadProgress(boolean delayed) { | 1155 private void finishLoadProgress(boolean delayed) { |
1155 mLoadProgressSimulator.cancel(); | 1156 mLoadProgressSimulator.cancel(); |
1156 mToolbar.finishLoadProgress(delayed); | 1157 mToolbar.finishLoadProgress(delayed); |
1157 } | 1158 } |
1158 | 1159 |
1159 /** | 1160 /** |
1160 * Only start showing the progress bar if it is not already started. | 1161 * Only start showing the progress bar if it is not already started. |
1161 */ | 1162 */ |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1218 } | 1219 } |
1219 | 1220 |
1220 /** | 1221 /** |
1221 * Cancels simulating load progress. | 1222 * Cancels simulating load progress. |
1222 */ | 1223 */ |
1223 public void cancel() { | 1224 public void cancel() { |
1224 mHandler.removeMessages(MSG_ID_UPDATE_PROGRESS); | 1225 mHandler.removeMessages(MSG_ID_UPDATE_PROGRESS); |
1225 } | 1226 } |
1226 } | 1227 } |
1227 } | 1228 } |
OLD | NEW |