Chromium Code Reviews| 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..45b9b6ca6a41e4f3952b9546d2dc1e1eaf7841f6 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,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(); |
| + ProfileIOData* io_data = |
| + ProfileIOData::FromResourceContext(context->GetResourceContext()); |
|
mmenke
2016/04/08 20:42:29
BUG: We're dereferencing an IOThread object on th
palmer
2016/04/08 21:52:02
Hmm. The ways I can think of to solve this are:
*
mmenke
2016/04/08 22:56:29
I'll think about this a bit on Monday. Profile ma
|
| + const url::Origin origin(details.entry->GetVirtualURL()); |
| + bool have_already_seen_origin = io_data->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) && |