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

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: Created 4 years, 9 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..9775797160186b1a31bf512ebe88d3a4715cd251 100644
--- a/chrome/browser/tab_contents/navigation_metrics_recorder.cc
+++ b/chrome/browser/tab_contents/navigation_metrics_recorder.cc
@@ -7,14 +7,17 @@
#include "base/metrics/histogram_macros.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/profiles/profile_io_data.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"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host.h"
#include "content/public/browser/render_widget_host_view.h"
+#include "content/public/browser/web_contents.h"
#include "content/public/common/frame_navigate_params.h"
#include "url/gurl.h"
@@ -36,8 +39,20 @@ 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);
+ bool is_otr = web_contents()->GetBrowserContext()->IsOffTheRecord();
felt 2016/04/01 00:01:59 IsOffTheRecord only returns true for Incognito, ri
palmer 2016/04/05 23:42:18 OTR is for Incognito and Guest Mode. Rather than t
+ bool should_record_main_frame_navigation = true;
+ if (is_otr) {
+ content::ResourceContext* context =
+ web_contents()->GetBrowserContext()->GetResourceContext();
+ ProfileIOData* io_data = ProfileIOData::FromResourceContext(context);
+ url::Origin origin(details.entry->GetVirtualURL());
+ if (io_data->HaveAlreadySeenOrigin(origin))
+ should_record_main_frame_navigation = false;
+ }
+ if (should_record_main_frame_navigation) {
+ navigation_metrics::RecordMainFrameNavigation(
+ details.entry->GetVirtualURL(), details.is_in_page, is_otr);
+ }
// 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