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

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: Remove now-extraneous `git cl format`-ism. 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..c450eeebd4e2acec1f39cf1db1b8455e71cfef12 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"
+#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,18 @@ 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();
+ Profile* profile = Profile::FromBrowserContext(context);
+ OriginsSeenService* service =
+ OriginsSeenServiceFactory::GetForProfile(profile);
Avi (use Gerrit) 2016/04/14 02:43:26 You shouldn't need to pass in a Profile here, just
palmer 2016/04/14 18:47:33 Done.
+ 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) &&
« no previous file with comments | « no previous file | chrome/browser/tab_contents/origins_seen_service.h » ('j') | chrome/browser/tab_contents/origins_seen_service.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698