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

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: M+S comments. 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
« no previous file with comments | « no previous file | chrome/browser/autocomplete/search_provider_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 401 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 OmniboxFieldTrial::GetActiveSuggestFieldTrialHashes(&field_trial_hashes);
424 for (size_t i = 0; i < field_trial_hashes.size(); ++i) {
424 if (field_trial_triggered_) 425 if (field_trial_triggered_)
425 new_entry.mutable_field_trial_triggered()->Add(field_trial_hash); 426 new_entry.mutable_field_trial_triggered()->Add(field_trial_hashes[i]);
426 if (field_trial_triggered_in_session_) { 427 if (field_trial_triggered_in_session_) {
427 new_entry.mutable_field_trial_triggered_in_session()->Add( 428 new_entry.mutable_field_trial_triggered_in_session()->Add(
428 field_trial_hash); 429 field_trial_hashes[i]);
429 } 430 }
430 } 431 }
431 } 432 }
432 433
433 void SearchProvider::ResetSession() { 434 void SearchProvider::ResetSession() {
434 field_trial_triggered_in_session_ = false; 435 field_trial_triggered_in_session_ = false;
435 } 436 }
436 437
437 void SearchProvider::OnURLFetchComplete(const net::URLFetcher* source) { 438 void SearchProvider::OnURLFetchComplete(const net::URLFetcher* source) {
438 DCHECK(!done_); 439 DCHECK(!done_);
(...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after
1514 it->set_relevance(max_query_relevance); 1515 it->set_relevance(max_query_relevance);
1515 } 1516 }
1516 } 1517 }
1517 1518
1518 void SearchProvider::UpdateDone() { 1519 void SearchProvider::UpdateDone() {
1519 // We're done when the timer isn't running, there are no suggest queries 1520 // We're done when the timer isn't running, there are no suggest queries
1520 // pending, and we're not waiting on Instant. 1521 // pending, and we're not waiting on Instant.
1521 done_ = (!timer_.IsRunning() && (suggest_results_pending_ == 0) && 1522 done_ = (!timer_.IsRunning() && (suggest_results_pending_ == 0) &&
1522 (instant_finalized_ || !chrome::IsInstantEnabled(profile_))); 1523 (instant_finalized_ || !chrome::IsInstantEnabled(profile_)));
1523 } 1524 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/autocomplete/search_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698