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

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

Issue 1976163004: [Offline Pages] Adds Rappor metrics measuring what domains are saved & viewed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@no-store
Patch Set: Created 4 years, 7 months 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_tab_helper.cc
diff --git a/chrome/browser/android/offline_pages/offline_page_tab_helper.cc b/chrome/browser/android/offline_pages/offline_page_tab_helper.cc
index 3d064bdb51451a42f92d9653bf238c7aa8f20978..6f43b9f55c2dc9dfd29842672c62fa0f8f68c5eb 100644
--- a/chrome/browser/android/offline_pages/offline_page_tab_helper.cc
+++ b/chrome/browser/android/offline_pages/offline_page_tab_helper.cc
@@ -9,6 +9,8 @@
#include "base/metrics/histogram.h"
#include "base/threading/thread_task_runner_handle.h"
#include "chrome/browser/android/offline_pages/offline_page_utils.h"
+#include "chrome/browser/browser_process.h"
+#include "components/rappor/rappor_utils.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_entry.h"
@@ -107,16 +109,22 @@ void OfflinePageTabHelper::DidFinishNavigation(
return;
}
+ GURL online_url = navigation_handle->GetURL();
+
// When the navigation starts, we redirect immediately from online page to
// offline version on the case that there is no network connection. If there
// is still network connection but with no or poor network connectivity, the
// navigation will eventually fail and we want to redirect to offline copy
// in this case.
GURL offline_url = offline_pages::OfflinePageUtils::GetOfflineURLForOnlineURL(
- web_contents()->GetBrowserContext(), navigation_handle->GetURL());
+ web_contents()->GetBrowserContext(), online_url);
if (!offline_url.is_valid())
return;
+ rappor::SampleDomainAndRegistryFromGURL(
+ g_browser_process->rappor_service(),
+ "OfflinePages.OfflineVersionWasViewedWhileOffline", online_url);
+
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::Bind(&OfflinePageTabHelper::Redirect,

Powered by Google App Engine
This is Rietveld 408576698