| 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.customtabs; | 5 package org.chromium.chrome.browser.customtabs; |
| 6 | 6 |
| 7 import android.app.Application; | 7 import android.app.Application; |
| 8 import android.graphics.Bitmap; | 8 import android.graphics.Bitmap; |
| 9 import android.graphics.Rect; | 9 import android.graphics.Rect; |
| 10 import android.os.SystemClock; | 10 import android.os.SystemClock; |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 50, TimeUnit.MINUTES.toMillis(10), TimeUnit.MILLISECONDS, 50
); | 137 50, TimeUnit.MINUTES.toMillis(10), TimeUnit.MILLISECONDS, 50
); |
| 138 RecordHistogram.recordCustomTimesHistogram( | 138 RecordHistogram.recordCustomTimesHistogram( |
| 139 histogramPrefix + ".IntentToFirstCommitNavigationTime2.Zoome
dIn", | 139 histogramPrefix + ".IntentToFirstCommitNavigationTime2.Zoome
dIn", |
| 140 timeToPageLoadStartedMs, 200, 1000, TimeUnit.MILLISECONDS, 1
00); | 140 timeToPageLoadStartedMs, 200, 1000, TimeUnit.MILLISECONDS, 1
00); |
| 141 // Same bounds and bucket count as PLT histograms. | 141 // Same bounds and bucket count as PLT histograms. |
| 142 RecordHistogram.recordCustomTimesHistogram(histogramPrefix + ".Inten
tToPageLoadedTime", | 142 RecordHistogram.recordCustomTimesHistogram(histogramPrefix + ".Inten
tToPageLoadedTime", |
| 143 timeToPageLoadFinishedMs, 10, TimeUnit.MINUTES.toMillis(10), | 143 timeToPageLoadFinishedMs, 10, TimeUnit.MINUTES.toMillis(10), |
| 144 TimeUnit.MILLISECONDS, 100); | 144 TimeUnit.MILLISECONDS, 100); |
| 145 } | 145 } |
| 146 resetPageLoadTracking(); | 146 resetPageLoadTracking(); |
| 147 tab.enableEmbeddedMediaExperience(false); |
| 147 captureNavigationInfo(tab); | 148 captureNavigationInfo(tab); |
| 148 } | 149 } |
| 149 | 150 |
| 150 @Override | 151 @Override |
| 151 public void onDidAttachInterstitialPage(Tab tab) { | 152 public void onDidAttachInterstitialPage(Tab tab) { |
| 152 if (tab.getSecurityLevel() != ConnectionSecurityLevel.DANGEROUS) return; | 153 if (tab.getSecurityLevel() != ConnectionSecurityLevel.DANGEROUS) return; |
| 153 resetPageLoadTracking(); | 154 resetPageLoadTracking(); |
| 154 if (mCustomTabsConnection != null) { | 155 if (mCustomTabsConnection != null) { |
| 155 mCustomTabsConnection.notifyNavigationEvent( | 156 mCustomTabsConnection.notifyNavigationEvent( |
| 156 mSession, CustomTabsCallback.NAVIGATION_FAILED); | 157 mSession, CustomTabsCallback.NAVIGATION_FAILED); |
| 157 } | 158 } |
| 158 } | 159 } |
| 159 | 160 |
| 160 @Override | 161 @Override |
| 161 public void onPageLoadFailed(Tab tab, int errorCode) { | 162 public void onPageLoadFailed(Tab tab, int errorCode) { |
| 162 resetPageLoadTracking(); | 163 resetPageLoadTracking(); |
| 164 tab.enableEmbeddedMediaExperience(false); |
| 163 if (mCustomTabsConnection != null) { | 165 if (mCustomTabsConnection != null) { |
| 164 mCustomTabsConnection.notifyNavigationEvent( | 166 mCustomTabsConnection.notifyNavigationEvent( |
| 165 mSession, CustomTabsCallback.NAVIGATION_FAILED); | 167 mSession, CustomTabsCallback.NAVIGATION_FAILED); |
| 166 } | 168 } |
| 167 } | 169 } |
| 168 | 170 |
| 169 private void resetPageLoadTracking() { | 171 private void resetPageLoadTracking() { |
| 170 mCurrentState = STATE_RESET; | 172 mCurrentState = STATE_RESET; |
| 171 mIntentReceivedTimestamp = -1; | 173 mIntentReceivedTimestamp = -1; |
| 172 } | 174 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 190 public void run() { | 192 public void run() { |
| 191 if (!tab.isHidden() && mCurrentState != STATE_RESET) return; | 193 if (!tab.isHidden() && mCurrentState != STATE_RESET) return; |
| 192 if (tab.getWebContents() == null) return; | 194 if (tab.getWebContents() == null) return; |
| 193 tab.getWebContents().getContentBitmapAsync( | 195 tab.getWebContents().getContentBitmapAsync( |
| 194 Bitmap.Config.ARGB_8888, mScaleForNavigationInfo, new Re
ct(), callback); | 196 Bitmap.Config.ARGB_8888, mScaleForNavigationInfo, new Re
ct(), callback); |
| 195 mScreenshotTakenForCurrentNavigation = true; | 197 mScreenshotTakenForCurrentNavigation = true; |
| 196 } | 198 } |
| 197 }, 1000); | 199 }, 1000); |
| 198 } | 200 } |
| 199 } | 201 } |
| OLD | NEW |