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

Side by Side Diff: chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc

Issue 2816383002: Remove non-const version of GetDefaultSearchProvider() and make all callers call the const version (Closed)
Patch Set: Fix unit test (the model was already loaded) Created 3 years, 8 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/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
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 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 &ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, 920 &ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad,
921 base::Unretained(this), url, request_loading_time)); 921 base::Unretained(this), url, request_loading_time));
922 return; 922 return;
923 } 923 }
924 924
925 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? 925 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ?
926 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); 926 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow");
927 rappor::SampleDomainAndRegistryFromGURL( 927 rappor::SampleDomainAndRegistryFromGURL(
928 g_browser_process->rappor_service(), metric_name, url); 928 g_browser_process->rappor_service(), metric_name, url);
929 } 929 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698