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

Side by Side Diff: chrome/browser/autocomplete/search_provider.cc

Issue 10832338: Check for Google with GetEngineType in SearchProvider. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/autocomplete/search_provider.h" 5 #include "chrome/browser/autocomplete/search_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 16 matching lines...) Expand all
27 #include "chrome/browser/autocomplete/keyword_provider.h" 27 #include "chrome/browser/autocomplete/keyword_provider.h"
28 #include "chrome/browser/autocomplete/url_prefix.h" 28 #include "chrome/browser/autocomplete/url_prefix.h"
29 #include "chrome/browser/history/history.h" 29 #include "chrome/browser/history/history.h"
30 #include "chrome/browser/history/history_service_factory.h" 30 #include "chrome/browser/history/history_service_factory.h"
31 #include "chrome/browser/history/in_memory_database.h" 31 #include "chrome/browser/history/in_memory_database.h"
32 #include "chrome/browser/instant/instant_controller.h" 32 #include "chrome/browser/instant/instant_controller.h"
33 #include "chrome/browser/net/url_fixer_upper.h" 33 #include "chrome/browser/net/url_fixer_upper.h"
34 #include "chrome/browser/prefs/pref_service.h" 34 #include "chrome/browser/prefs/pref_service.h"
35 #include "chrome/browser/profiles/profile.h" 35 #include "chrome/browser/profiles/profile.h"
36 #include "chrome/browser/search_engines/search_engine_type.h" 36 #include "chrome/browser/search_engines/search_engine_type.h"
37 #include "chrome/browser/search_engines/template_url_prepopulate_data.h"
37 #include "chrome/browser/search_engines/template_url_service.h" 38 #include "chrome/browser/search_engines/template_url_service.h"
38 #include "chrome/browser/search_engines/template_url_service_factory.h" 39 #include "chrome/browser/search_engines/template_url_service_factory.h"
39 #include "chrome/common/pref_names.h" 40 #include "chrome/common/pref_names.h"
40 #include "chrome/common/url_constants.h" 41 #include "chrome/common/url_constants.h"
41 #include "googleurl/src/url_util.h" 42 #include "googleurl/src/url_util.h"
42 #include "grit/generated_resources.h" 43 #include "grit/generated_resources.h"
43 #include "net/base/escape.h" 44 #include "net/base/escape.h"
44 #include "net/base/load_flags.h" 45 #include "net/base/load_flags.h"
45 #include "net/base/net_util.h" 46 #include "net/base/net_util.h"
46 #include "net/http/http_response_headers.h" 47 #include "net/http/http_response_headers.h"
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 355
355 const bool is_keyword = (source == keyword_fetcher_.get()); 356 const bool is_keyword = (source == keyword_fetcher_.get());
356 const bool request_succeeded = 357 const bool request_succeeded =
357 source->GetStatus().is_success() && source->GetResponseCode() == 200; 358 source->GetStatus().is_success() && source->GetResponseCode() == 200;
358 359
359 // Record response time for suggest requests sent to Google. We care 360 // Record response time for suggest requests sent to Google. We care
360 // only about the common case: the Google default provider used in 361 // only about the common case: the Google default provider used in
361 // non-keyword mode. 362 // non-keyword mode.
362 const TemplateURL* default_url = providers_.GetDefaultProviderURL(); 363 const TemplateURL* default_url = providers_.GetDefaultProviderURL();
363 if (!is_keyword && default_url && 364 if (!is_keyword && default_url &&
364 (default_url->prepopulate_id() == SEARCH_ENGINE_GOOGLE)) { 365 (TemplateURLPrepopulateData::GetEngineType(default_url->url()) ==
366 SEARCH_ENGINE_GOOGLE)) {
365 const TimeDelta elapsed_time = 367 const TimeDelta elapsed_time =
366 base::TimeTicks::Now() - time_suggest_request_sent_; 368 base::TimeTicks::Now() - time_suggest_request_sent_;
367 if (request_succeeded) { 369 if (request_succeeded) {
368 UMA_HISTOGRAM_TIMES("Omnibox.SuggestRequest.Success.GoogleResponseTime", 370 UMA_HISTOGRAM_TIMES("Omnibox.SuggestRequest.Success.GoogleResponseTime",
369 elapsed_time); 371 elapsed_time);
370 } else { 372 } else {
371 UMA_HISTOGRAM_TIMES("Omnibox.SuggestRequest.Failure.GoogleResponseTime", 373 UMA_HISTOGRAM_TIMES("Omnibox.SuggestRequest.Failure.GoogleResponseTime",
372 elapsed_time); 374 elapsed_time);
373 } 375 }
374 } 376 }
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after
1212 ACMatchClassification::NONE, &match.description_class); 1214 ACMatchClassification::NONE, &match.description_class);
1213 return match; 1215 return match;
1214 } 1216 }
1215 1217
1216 void SearchProvider::UpdateDone() { 1218 void SearchProvider::UpdateDone() {
1217 // We're done when there are no more suggest queries pending (this is set to 1 1219 // We're done when there are no more suggest queries pending (this is set to 1
1218 // when the timer is started) and we're not waiting on instant. 1220 // when the timer is started) and we're not waiting on instant.
1219 done_ = ((suggest_results_pending_ == 0) && 1221 done_ = ((suggest_results_pending_ == 0) &&
1220 (instant_finalized_ || !InstantController::IsEnabled(profile_))); 1222 (instant_finalized_ || !InstantController::IsEnabled(profile_)));
1221 } 1223 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698