| 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/loader/chrome_resource_dispatcher_host_delegate.h" | 5 #include "chrome/browser/loader/chrome_resource_dispatcher_host_delegate.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 // A http/s scheme implies that the new tab page is remote. The local NTP is | 304 // A http/s scheme implies that the new tab page is remote. The local NTP is |
| 305 // served from chrome-search://. To segment out remote NTPs, use the | 305 // served from chrome-search://. To segment out remote NTPs, use the |
| 306 // TemplateURLService to find the default search engine. Note that if the | 306 // TemplateURLService to find the default search engine. Note that if the |
| 307 // default search engine does not have a remote NTP, then the local NTP will | 307 // default search engine does not have a remote NTP, then the local NTP will |
| 308 // be shown. As of April 2016, only Bing and Google have remote NTPs. | 308 // be shown. As of April 2016, only Bing and Google have remote NTPs. |
| 309 if (url.SchemeIsHTTPOrHTTPS()) { | 309 if (url.SchemeIsHTTPOrHTTPS()) { |
| 310 TemplateURLService* template_url_service = | 310 TemplateURLService* template_url_service = |
| 311 TemplateURLServiceFactory::GetForProfile(profile); | 311 TemplateURLServiceFactory::GetForProfile(profile); |
| 312 if (!template_url_service) | 312 if (!template_url_service) |
| 313 return; | 313 return; |
| 314 TemplateURL* default_provider = | 314 const TemplateURL* default_provider = |
| 315 template_url_service->GetDefaultSearchProvider(); | 315 template_url_service->GetDefaultSearchProvider(); |
| 316 if (!default_provider) | 316 if (!default_provider) |
| 317 return; | 317 return; |
| 318 if (default_provider->GetEngineType( | 318 if (default_provider->GetEngineType( |
| 319 template_url_service->search_terms_data()) == | 319 template_url_service->search_terms_data()) == |
| 320 SearchEngineType::SEARCH_ENGINE_GOOGLE) { | 320 SearchEngineType::SEARCH_ENGINE_GOOGLE) { |
| 321 if (net_error == net::OK) { | 321 if (net_error == net::OK) { |
| 322 UMA_HISTOGRAM_LONG_TIMES("Net.NTP.Google.RequestTime2.Success", | 322 UMA_HISTOGRAM_LONG_TIMES("Net.NTP.Google.RequestTime2.Success", |
| 323 request_loading_time); | 323 request_loading_time); |
| 324 } else if (net_error == net::ERR_ABORTED) { | 324 } else if (net_error == net::ERR_ABORTED) { |
| (...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 912 base::Bind(&ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, | 912 base::Bind(&ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, |
| 913 base::Unretained(this), url, request_loading_time)); | 913 base::Unretained(this), url, request_loading_time)); |
| 914 return; | 914 return; |
| 915 } | 915 } |
| 916 | 916 |
| 917 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? | 917 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? |
| 918 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); | 918 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); |
| 919 rappor::SampleDomainAndRegistryFromGURL( | 919 rappor::SampleDomainAndRegistryFromGURL( |
| 920 g_browser_process->rappor_service(), metric_name, url); | 920 g_browser_process->rappor_service(), metric_name, url); |
| 921 } | 921 } |
| OLD | NEW |