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

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

Issue 2507293006: Report redirect UMA in offline interceptor (Closed)
Patch Set: 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..0c66e28a9585e4511ecc6e347c6187a59a49a5a7 100644
--- a/chrome/browser/android/offline_pages/offline_page_request_job.cc
+++ b/chrome/browser/android/offline_pages/offline_page_request_job.cc
@@ -59,6 +59,7 @@ enum class NetworkState {
// that might serve offline contents.
enum class RequestResult {
OFFLINE_PAGE_SERVED,
+ REDIRECTED,
fgorski 2016/11/18 23:52:22 add a comment someplace whether this indicates suc
jianli 2016/11/19 00:54:05 Done.
NO_TAB_ID,
NO_WEB_CONTENTS,
PAGE_NOT_FRESH,
@@ -173,6 +174,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 +344,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