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

Unified Diff: chrome/browser/tab_contents/navigation_metrics_recorder.cc

Issue 1844753002: Histogram the scheme of an origin on the 1st navigation to it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplifications thanks to avi. Created 4 years, 8 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/tab_contents/navigation_metrics_recorder.cc
diff --git a/chrome/browser/tab_contents/navigation_metrics_recorder.cc b/chrome/browser/tab_contents/navigation_metrics_recorder.cc
index 8ee3fdd80a8aeb4aae3ec7fd496eb3e746a524c9..d0920b54a91cf19720f87c3b3c5db606f30cbb95 100644
--- a/chrome/browser/tab_contents/navigation_metrics_recorder.cc
+++ b/chrome/browser/tab_contents/navigation_metrics_recorder.cc
@@ -7,8 +7,12 @@
#include "base/metrics/histogram_macros.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/profiles/profile.h"
Avi (use Gerrit) 2016/04/14 19:08:02 Do you still need this, as you don't use profiles
palmer 2016/04/14 20:13:41 Done.
+#include "chrome/browser/tab_contents/origins_seen_service.h"
+#include "chrome/browser/tab_contents/origins_seen_service_factory.h"
#include "components/navigation_metrics/navigation_metrics.h"
#include "components/rappor/rappor_utils.h"
+#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/navigation_details.h"
#include "content/public/browser/navigation_entry.h"
@@ -17,6 +21,7 @@
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/common/frame_navigate_params.h"
#include "url/gurl.h"
+#include "url/origin.h"
#if defined(OS_WIN)
#include "base/win/windows_version.h"
@@ -36,8 +41,17 @@ void NavigationMetricsRecorder::DidNavigateMainFrame(
const content::LoadCommittedDetails& details,
const content::FrameNavigateParams& params) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- navigation_metrics::RecordMainFrameNavigation(details.entry->GetVirtualURL(),
- details.is_in_page);
+
+ content::BrowserContext* context = web_contents()->GetBrowserContext();
+ OriginsSeenService* service =
+ OriginsSeenServiceFactory::GetForBrowserContext(context);
+ const url::Origin origin(details.entry->GetVirtualURL());
+ bool have_already_seen_origin = service->HaveAlreadySeenOrigin(origin);
+
+ navigation_metrics::RecordMainFrameNavigation(
+ details.entry->GetVirtualURL(), details.is_in_page,
+ context->IsOffTheRecord(), have_already_seen_origin);
+
// Record the domain and registry of the URL that resulted in a navigation to
// a |data:| URL, either by redirects or user clicking a link.
if (details.entry->GetVirtualURL().SchemeIs(url::kDataScheme) &&

Powered by Google App Engine
This is Rietveld 408576698