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

Side by Side Diff: chrome/browser/tab_contents/navigation_metrics_recorder.cc

Issue 2716493004: Renamed NavigationHandle::IsSamePage to NavigationHandle::IsSameDocument (Closed)
Patch Set: Rebased Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/tab_contents/navigation_metrics_recorder.h" 5 #include "chrome/browser/tab_contents/navigation_metrics_recorder.h"
6 6
7 #include "base/metrics/histogram_macros.h" 7 #include "base/metrics/histogram_macros.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/tab_contents/origins_seen_service_factory.h" 10 #include "chrome/browser/tab_contents/origins_seen_service_factory.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 78
79 content::BrowserContext* context = web_contents()->GetBrowserContext(); 79 content::BrowserContext* context = web_contents()->GetBrowserContext();
80 navigation_metrics::OriginsSeenService* service = 80 navigation_metrics::OriginsSeenService* service =
81 OriginsSeenServiceFactory::GetForBrowserContext(context); 81 OriginsSeenServiceFactory::GetForBrowserContext(context);
82 content::NavigationEntry* last_committed_entry = 82 content::NavigationEntry* last_committed_entry =
83 web_contents()->GetController().GetLastCommittedEntry(); 83 web_contents()->GetController().GetLastCommittedEntry();
84 const url::Origin origin(last_committed_entry->GetVirtualURL()); 84 const url::Origin origin(last_committed_entry->GetVirtualURL());
85 bool have_already_seen_origin = service->Insert(origin); 85 bool have_already_seen_origin = service->Insert(origin);
86 86
87 navigation_metrics::RecordMainFrameNavigation( 87 navigation_metrics::RecordMainFrameNavigation(
88 last_committed_entry->GetVirtualURL(), navigation_handle->IsSamePage(), 88 last_committed_entry->GetVirtualURL(),
89 context->IsOffTheRecord(), have_already_seen_origin); 89 navigation_handle->IsSameDocument(), context->IsOffTheRecord(),
90 have_already_seen_origin);
90 91
91 // Record the domain and registry of the URL that resulted in a navigation to 92 // Record the domain and registry of the URL that resulted in a navigation to
92 // a |data:| URL, either by redirects or user clicking a link. 93 // a |data:| URL, either by redirects or user clicking a link.
93 if (last_committed_entry->GetVirtualURL().SchemeIs(url::kDataScheme) && 94 if (last_committed_entry->GetVirtualURL().SchemeIs(url::kDataScheme) &&
94 !ui::PageTransitionCoreTypeIs(navigation_handle->GetPageTransition(), 95 !ui::PageTransitionCoreTypeIs(navigation_handle->GetPageTransition(),
95 ui::PAGE_TRANSITION_TYPED)) { 96 ui::PAGE_TRANSITION_TYPED)) {
96 if (!navigation_handle->GetPreviousURL().is_empty()) { 97 if (!navigation_handle->GetPreviousURL().is_empty()) {
97 rappor::SampleDomainAndRegistryFromGURL( 98 rappor::SampleDomainAndRegistryFromGURL(
98 rappor_service_, "Navigation.Scheme.Data", 99 rappor_service_, "Navigation.Scheme.Data",
99 navigation_handle->GetPreviousURL()); 100 navigation_handle->GetPreviousURL());
100 } 101 }
101 102
102 // Also record the mime type of the data: URL. 103 // Also record the mime type of the data: URL.
103 std::string mime_type; 104 std::string mime_type;
104 std::string charset; 105 std::string charset;
105 if (net::DataURL::Parse(last_committed_entry->GetVirtualURL(), &mime_type, 106 if (net::DataURL::Parse(last_committed_entry->GetVirtualURL(), &mime_type,
106 &charset, nullptr)) { 107 &charset, nullptr)) {
107 RecordDataURLMimeType(mime_type); 108 RecordDataURLMimeType(mime_type);
108 } 109 }
109 } 110 }
110 } 111 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698