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

Unified Diff: chrome/browser/android/offline_pages/offline_page_request_job.cc

Issue 2507293006: Report redirect UMA in offline interceptor (Closed)
Patch Set: Address feedback Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/android/offline_pages/offline_page_request_job.cc
diff --git a/chrome/browser/android/offline_pages/offline_page_request_job.cc b/chrome/browser/android/offline_pages/offline_page_request_job.cc
index f338bdb91038797775de6c33ed13955152fc1c1f..fdc99500f4eb37f59bd1f1a2b43cc520a5fd3e1a 100644
--- a/chrome/browser/android/offline_pages/offline_page_request_job.cc
+++ b/chrome/browser/android/offline_pages/offline_page_request_job.cc
@@ -58,10 +58,21 @@ enum class NetworkState {
// This enum is used to tell all possible outcomes of handling network requests
// that might serve offline contents.
enum class RequestResult {
+ // Offline page was shown for current URL.
OFFLINE_PAGE_SERVED,
+ // Redirected from original URL to final URL in preparation to show the
+ // offline page under final URL. OFFLINE_PAGE_SERVED is most likely to be
+ // reported next if no other error is encountered.
+ REDIRECTED,
+ // Tab was gone.
NO_TAB_ID,
+ // Web contents was gone.
NO_WEB_CONTENTS,
+ // The offline page found was not fresh enough, i.e. not created in the past
+ // day. This only applies in prohibitively slow network.
PAGE_NOT_FRESH,
+ // Offline page was not found, by searching with either final URL or original
+ // URL.
OFFLINE_PAGE_NOT_FOUND
};
@@ -173,6 +184,25 @@ RequestResultToAggregatedRequestResult(
}
}
+ if (request_result == RequestResult::REDIRECTED) {
+ switch (network_state) {
+ case NetworkState::DISCONNECTED_NETWORK:
+ return OfflinePageRequestJob::AggregatedRequestResult::
+ REDIRECTED_ON_DISCONNECTED_NETWORK;
+ case NetworkState::PROHIBITIVELY_SLOW_NETWORK:
+ return OfflinePageRequestJob::AggregatedRequestResult::
+ REDIRECTED_ON_PROHIBITIVELY_SLOW_NETWORK;
+ case NetworkState::FLAKY_NETWORK:
+ return OfflinePageRequestJob::AggregatedRequestResult::
+ REDIRECTED_ON_FLAKY_NETWORK;
+ case NetworkState::FORCE_OFFLINE_ON_CONNECTED_NETWORK:
+ return OfflinePageRequestJob::AggregatedRequestResult::
+ REDIRECTED_ON_CONNECTED_NETWORK;
+ default:
+ NOTREACHED();
+ }
+ }
+
DCHECK_EQ(RequestResult::OFFLINE_PAGE_SERVED, request_result);
DCHECK_NE(NetworkState::CONNECTED_NETWORK, network_state);
switch (network_state) {
@@ -324,6 +354,7 @@ void SucceededToFindOfflinePage(
// If the match is for original URL, trigger the redirect.
if (offline_page && url == offline_page->original_url) {
+ ReportRequestResult(RequestResult::REDIRECTED, network_state);
NotifyOfflineRedirectOnUI(job, offline_page->url);
return;
}

Powered by Google App Engine
This is Rietveld 408576698