Update mojo surfaces bindings and mojo/cc/ glue
[chromium-blink-merge.git] / chrome / browser / tab_contents / navigation_metrics_recorder.cc
blobb9b034dd7e49b8e779b0e55fc3351a8a82bdffbc
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/tab_contents/navigation_metrics_recorder.h"
7 #include "base/metrics/histogram.h"
8 #include "components/navigation_metrics/navigation_metrics.h"
9 #include "content/public/browser/navigation_details.h"
10 #include "content/public/browser/navigation_entry.h"
11 #include "content/public/browser/render_view_host.h"
12 #include "content/public/browser/render_widget_host_view.h"
14 #if defined(OS_WIN)
15 #include "base/win/windows_version.h"
16 #include "chrome/browser/metro_utils/metro_chrome_win.h"
17 #endif
19 DEFINE_WEB_CONTENTS_USER_DATA_KEY(NavigationMetricsRecorder);
21 NavigationMetricsRecorder::NavigationMetricsRecorder(
22 content::WebContents* web_contents)
23 : content::WebContentsObserver(web_contents) {
26 NavigationMetricsRecorder::~NavigationMetricsRecorder() {
29 void NavigationMetricsRecorder::DidNavigateMainFrame(
30 const content::LoadCommittedDetails& details,
31 const content::FrameNavigateParams& params) {
32 navigation_metrics::RecordMainFrameNavigation(details.entry->GetVirtualURL());
35 void NavigationMetricsRecorder::DidStartLoading(
36 content::RenderViewHost* render_view_host) {
37 #if defined(OS_WIN) && defined(USE_ASH)
38 if (render_view_host && base::win::GetVersion() >= base::win::VERSION_WIN8) {
39 content::RenderWidgetHostView* rwhv = render_view_host->GetView();
40 if (rwhv) {
41 gfx::NativeView native_view = rwhv->GetNativeView();
42 if (native_view) {
43 chrome::HostDesktopType desktop =
44 chrome::GetHostDesktopTypeForNativeView(native_view);
45 UMA_HISTOGRAM_ENUMERATION("Win8.PageLoad",
46 chrome::GetWin8Environment(desktop),
47 chrome::WIN_8_ENVIRONMENT_MAX);
51 #endif