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

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

Issue 13940005: Clean up the unused Suggest field trial and make GetActiveSuggestFieldTrialHash (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 13 matching lines...) Expand all
24 #include "chrome/browser/autocomplete/autocomplete_match.h" 24 #include "chrome/browser/autocomplete/autocomplete_match.h"
25 #include "chrome/browser/autocomplete/autocomplete_provider_listener.h" 25 #include "chrome/browser/autocomplete/autocomplete_provider_listener.h"
26 #include "chrome/browser/autocomplete/autocomplete_result.h" 26 #include "chrome/browser/autocomplete/autocomplete_result.h"
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_service.h" 29 #include "chrome/browser/history/history_service.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/metrics/variations/variations_http_header_provider.h" 32 #include "chrome/browser/metrics/variations/variations_http_header_provider.h"
33 #include "chrome/browser/net/url_fixer_upper.h" 33 #include "chrome/browser/net/url_fixer_upper.h"
34 #include "chrome/browser/omnibox/omnibox_field_trial.h" 34 #include "chrome/browser/omnibox/omnibox_field_trial.h"
SteveT 2013/04/11 13:46:27 Can you check if this is still used?
Bart N. 2013/04/11 19:35:07 Yes :) I still call OmniboxFieldTrial::GetActiveSu
35 #include "chrome/browser/profiles/profile.h" 35 #include "chrome/browser/profiles/profile.h"
36 #include "chrome/browser/search/search.h" 36 #include "chrome/browser/search/search.h"
37 #include "chrome/browser/search_engines/search_engine_type.h" 37 #include "chrome/browser/search_engines/search_engine_type.h"
38 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" 38 #include "chrome/browser/search_engines/template_url_prepopulate_data.h"
39 #include "chrome/browser/search_engines/template_url_service.h" 39 #include "chrome/browser/search_engines/template_url_service.h"
40 #include "chrome/browser/search_engines/template_url_service_factory.h" 40 #include "chrome/browser/search_engines/template_url_service_factory.h"
41 #include "chrome/common/pref_names.h" 41 #include "chrome/common/pref_names.h"
42 #include "chrome/common/url_constants.h" 42 #include "chrome/common/url_constants.h"
43 #include "googleurl/src/url_util.h" 43 #include "googleurl/src/url_util.h"
44 #include "grit/generated_resources.h" 44 #include "grit/generated_resources.h"
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 412
413 if (clear_cached_results) 413 if (clear_cached_results)
414 ClearResults(); 414 ClearResults();
415 } 415 }
416 416
417 void SearchProvider::AddProviderInfo(ProvidersInfo* provider_info) const { 417 void SearchProvider::AddProviderInfo(ProvidersInfo* provider_info) const {
418 provider_info->push_back(metrics::OmniboxEventProto_ProviderInfo()); 418 provider_info->push_back(metrics::OmniboxEventProto_ProviderInfo());
419 metrics::OmniboxEventProto_ProviderInfo& new_entry = provider_info->back(); 419 metrics::OmniboxEventProto_ProviderInfo& new_entry = provider_info->back();
420 new_entry.set_provider(AsOmniboxEventProviderType()); 420 new_entry.set_provider(AsOmniboxEventProviderType());
421 new_entry.set_provider_done(done_); 421 new_entry.set_provider_done(done_);
422 uint32 field_trial_hash = 0; 422 std::vector<uint32> field_trial_hashes;
423 if (OmniboxFieldTrial::GetActiveSuggestFieldTrialHash(&field_trial_hash)) { 423 if (OmniboxFieldTrial::GetActiveSuggestFieldTrialHashes(
424 if (field_trial_triggered_) 424 &field_trial_hashes)) {
425 new_entry.mutable_field_trial_triggered()->Add(field_trial_hash); 425 for (size_t i = 0; i < field_trial_hashes.size(); ++i) {
426 if (field_trial_triggered_in_session_) { 426 if (field_trial_triggered_)
427 new_entry.mutable_field_trial_triggered_in_session()->Add( 427 new_entry.mutable_field_trial_triggered()->Add(field_trial_hashes[i]);
428 field_trial_hash); 428 if (field_trial_triggered_in_session_) {
429 new_entry.mutable_field_trial_triggered_in_session()->Add(
430 field_trial_hashes[i]);
431 }
429 } 432 }
430 } 433 }
SteveT 2013/04/11 13:46:27 That's odd... do these two braces need to be clean
Bart N. 2013/04/11 19:35:07 They are needed for if/for statements.
431 } 434 }
432 435
433 void SearchProvider::ResetSession() { 436 void SearchProvider::ResetSession() {
434 field_trial_triggered_in_session_ = false; 437 field_trial_triggered_in_session_ = false;
435 } 438 }
436 439
437 void SearchProvider::OnURLFetchComplete(const net::URLFetcher* source) { 440 void SearchProvider::OnURLFetchComplete(const net::URLFetcher* source) {
438 DCHECK(!done_); 441 DCHECK(!done_);
439 suggest_results_pending_--; 442 suggest_results_pending_--;
440 LogOmniboxSuggestRequest(REPLY_RECEIVED); 443 LogOmniboxSuggestRequest(REPLY_RECEIVED);
(...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after
1514 it->set_relevance(max_query_relevance); 1517 it->set_relevance(max_query_relevance);
1515 } 1518 }
1516 } 1519 }
1517 1520
1518 void SearchProvider::UpdateDone() { 1521 void SearchProvider::UpdateDone() {
1519 // We're done when the timer isn't running, there are no suggest queries 1522 // We're done when the timer isn't running, there are no suggest queries
1520 // pending, and we're not waiting on Instant. 1523 // pending, and we're not waiting on Instant.
1521 done_ = (!timer_.IsRunning() && (suggest_results_pending_ == 0) && 1524 done_ = (!timer_.IsRunning() && (suggest_results_pending_ == 0) &&
1522 (instant_finalized_ || !chrome::IsInstantEnabled(profile_))); 1525 (instant_finalized_ || !chrome::IsInstantEnabled(profile_)));
1523 } 1526 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/autocomplete/search_provider_unittest.cc » ('j') | chrome/browser/omnibox/omnibox_field_trial.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698