OLD | NEW |
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 "components/navigation_metrics/navigation_metrics.h" | 10 #include "components/navigation_metrics/navigation_metrics.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 navigation_metrics::RecordMainFrameNavigation( | 81 navigation_metrics::RecordMainFrameNavigation( |
82 last_committed_entry->GetVirtualURL(), | 82 last_committed_entry->GetVirtualURL(), |
83 navigation_handle->IsSameDocument(), context->IsOffTheRecord()); | 83 navigation_handle->IsSameDocument(), context->IsOffTheRecord()); |
84 | 84 |
85 // Record the domain and registry of the URL that resulted in a navigation to | 85 // Record the domain and registry of the URL that resulted in a navigation to |
86 // a |data:| URL, either by redirects or user clicking a link. | 86 // a |data:| URL, either by redirects or user clicking a link. |
87 if (last_committed_entry->GetVirtualURL().SchemeIs(url::kDataScheme) && | 87 if (last_committed_entry->GetVirtualURL().SchemeIs(url::kDataScheme) && |
88 !ui::PageTransitionCoreTypeIs(navigation_handle->GetPageTransition(), | 88 !ui::PageTransitionCoreTypeIs(navigation_handle->GetPageTransition(), |
89 ui::PAGE_TRANSITION_TYPED)) { | 89 ui::PAGE_TRANSITION_TYPED)) { |
90 if (!navigation_handle->GetPreviousURL().is_empty()) { | 90 if (!navigation_handle->GetPreviousURL().is_empty()) { |
| 91 // TODO(meacer): Remove once data URL navigations are blocked. |
91 rappor::SampleDomainAndRegistryFromGURL( | 92 rappor::SampleDomainAndRegistryFromGURL( |
92 rappor_service_, "Navigation.Scheme.Data", | 93 rappor_service_, "Navigation.Scheme.Data", |
93 navigation_handle->GetPreviousURL()); | 94 navigation_handle->GetPreviousURL()); |
94 } | 95 } |
95 | 96 |
96 // Also record the mime type of the data: URL. | 97 // Also record the mime type of the data: URL. |
97 std::string mime_type; | 98 std::string mime_type; |
98 std::string charset; | 99 std::string charset; |
| 100 // TODO(meacer): Remove once data URL navigations are blocked. |
99 if (net::DataURL::Parse(last_committed_entry->GetVirtualURL(), &mime_type, | 101 if (net::DataURL::Parse(last_committed_entry->GetVirtualURL(), &mime_type, |
100 &charset, nullptr)) { | 102 &charset, nullptr)) { |
101 RecordDataURLMimeType(mime_type); | 103 RecordDataURLMimeType(mime_type); |
102 } | 104 } |
103 } | 105 } |
104 } | 106 } |
OLD | NEW |