| OLD | NEW |
| 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/callback.h" | 10 #include "base/callback.h" |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 ClearResults(); | 344 ClearResults(); |
| 345 } | 345 } |
| 346 | 346 |
| 347 void SearchProvider::AddProviderInfo(ProvidersInfo* provider_info) const { | 347 void SearchProvider::AddProviderInfo(ProvidersInfo* provider_info) const { |
| 348 provider_info->push_back(metrics::OmniboxEventProto_ProviderInfo()); | 348 provider_info->push_back(metrics::OmniboxEventProto_ProviderInfo()); |
| 349 metrics::OmniboxEventProto_ProviderInfo& new_entry = provider_info->back(); | 349 metrics::OmniboxEventProto_ProviderInfo& new_entry = provider_info->back(); |
| 350 new_entry.set_provider(AsOmniboxEventProviderType()); | 350 new_entry.set_provider(AsOmniboxEventProviderType()); |
| 351 new_entry.set_provider_done(done_); | 351 new_entry.set_provider_done(done_); |
| 352 uint32 field_trial_hash = 0; | 352 uint32 field_trial_hash = 0; |
| 353 if (AutocompleteFieldTrial::GetActiveSuggestFieldTrialHash( | 353 if (AutocompleteFieldTrial::GetActiveSuggestFieldTrialHash( |
| 354 &field_trial_hash)) { | 354 &field_trial_hash)) { |
| 355 if (field_trial_triggered_) | 355 if (field_trial_triggered_) |
| 356 new_entry.mutable_field_trial_triggered()->Add(field_trial_hash); | 356 new_entry.mutable_field_trial_triggered()->Add(field_trial_hash); |
| 357 if (field_trial_triggered_in_session_) | 357 if (field_trial_triggered_in_session_) { |
| 358 new_entry.mutable_field_trial_triggered_in_session()->Add( | 358 new_entry.mutable_field_trial_triggered_in_session()->Add( |
| 359 field_trial_hash); | 359 field_trial_hash); |
| 360 } |
| 360 } | 361 } |
| 361 } | 362 } |
| 362 | 363 |
| 363 void SearchProvider::ResetSession() { | 364 void SearchProvider::ResetSession() { |
| 364 field_trial_triggered_in_session_ = false; | 365 field_trial_triggered_in_session_ = false; |
| 365 } | 366 } |
| 366 | 367 |
| 367 void SearchProvider::OnURLFetchComplete(const net::URLFetcher* source) { | 368 void SearchProvider::OnURLFetchComplete(const net::URLFetcher* source) { |
| 368 DCHECK(!done_); | 369 DCHECK(!done_); |
| 369 suggest_results_pending_--; | 370 suggest_results_pending_--; |
| (...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1258 } | 1259 } |
| 1259 | 1260 |
| 1260 void SearchProvider::UpdateDone() { | 1261 void SearchProvider::UpdateDone() { |
| 1261 // We're done when the timer isn't running, there are no suggest queries | 1262 // We're done when the timer isn't running, there are no suggest queries |
| 1262 // pending, and we're not waiting on instant. | 1263 // pending, and we're not waiting on instant. |
| 1263 done_ = (!timer_.IsRunning() && (suggest_results_pending_ == 0) && | 1264 done_ = (!timer_.IsRunning() && (suggest_results_pending_ == 0) && |
| 1264 (instant_finalized_ || | 1265 (instant_finalized_ || |
| 1265 (!chrome::BrowserInstantController::IsInstantEnabled(profile_) && | 1266 (!chrome::BrowserInstantController::IsInstantEnabled(profile_) && |
| 1266 !chrome::search::IsInstantExtendedAPIEnabled(profile_)))); | 1267 !chrome::search::IsInstantExtendedAPIEnabled(profile_)))); |
| 1267 } | 1268 } |
| OLD | NEW |