| OLD | NEW |
| 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/instant/instant_controller.h" | 5 #include "chrome/browser/instant/instant_controller.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/i18n/case_conversion.h" | 8 #include "base/i18n/case_conversion.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 const std::vector<AutocompleteProvider*>& providers) { | 269 const std::vector<AutocompleteProvider*>& providers) { |
| 270 if (mode_ != EXTENDED || !GetPreviewContents()) | 270 if (mode_ != EXTENDED || !GetPreviewContents()) |
| 271 return; | 271 return; |
| 272 | 272 |
| 273 std::vector<InstantAutocompleteResult> results; | 273 std::vector<InstantAutocompleteResult> results; |
| 274 for (ACProviders::const_iterator provider = providers.begin(); | 274 for (ACProviders::const_iterator provider = providers.begin(); |
| 275 provider != providers.end(); ++provider) { | 275 provider != providers.end(); ++provider) { |
| 276 for (ACMatches::const_iterator match = (*provider)->matches().begin(); | 276 for (ACMatches::const_iterator match = (*provider)->matches().begin(); |
| 277 match != (*provider)->matches().end(); ++match) { | 277 match != (*provider)->matches().end(); ++match) { |
| 278 InstantAutocompleteResult result; | 278 InstantAutocompleteResult result; |
| 279 result.provider = UTF8ToUTF16((*provider)->name()); | 279 result.provider = UTF8ToUTF16((*provider)->GetName()); |
| 280 result.is_search = AutocompleteMatch::IsSearchType(match->type); | 280 result.is_search = AutocompleteMatch::IsSearchType(match->type); |
| 281 result.contents = match->description; | 281 result.contents = match->description; |
| 282 result.destination_url = match->destination_url; | 282 result.destination_url = match->destination_url; |
| 283 result.relevance = match->relevance; | 283 result.relevance = match->relevance; |
| 284 results.push_back(result); | 284 results.push_back(result); |
| 285 } | 285 } |
| 286 } | 286 } |
| 287 | 287 |
| 288 loader_->SendAutocompleteResults(results); | 288 loader_->SendAutocompleteResults(results); |
| 289 } | 289 } |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 iter->second > kMaxInstantSupportFailures) | 717 iter->second > kMaxInstantSupportFailures) |
| 718 return false; | 718 return false; |
| 719 | 719 |
| 720 return true; | 720 return true; |
| 721 } | 721 } |
| 722 | 722 |
| 723 bool InstantController::IsOutOfDate() const { | 723 bool InstantController::IsOutOfDate() const { |
| 724 return !last_active_tab_ || | 724 return !last_active_tab_ || |
| 725 last_active_tab_ != delegate_->GetActiveTabContents(); | 725 last_active_tab_ != delegate_->GetActiveTabContents(); |
| 726 } | 726 } |
| OLD | NEW |