| 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/predictors/autocomplete_action_predictor.h" | 5 #include "chrome/browser/predictors/autocomplete_action_predictor.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 const base::string16 lower_user_text(base::i18n::ToLower(log.text)); | 337 const base::string16 lower_user_text(base::i18n::ToLower(log.text)); |
| 338 | 338 |
| 339 // Traverse transitional matches for those that have a user_text that is a | 339 // Traverse transitional matches for those that have a user_text that is a |
| 340 // prefix of |lower_user_text|. | 340 // prefix of |lower_user_text|. |
| 341 std::vector<AutocompleteActionPredictorTable::Row> rows_to_add; | 341 std::vector<AutocompleteActionPredictorTable::Row> rows_to_add; |
| 342 std::vector<AutocompleteActionPredictorTable::Row> rows_to_update; | 342 std::vector<AutocompleteActionPredictorTable::Row> rows_to_update; |
| 343 | 343 |
| 344 for (std::vector<TransitionalMatch>::const_iterator it = | 344 for (std::vector<TransitionalMatch>::const_iterator it = |
| 345 transitional_matches_.begin(); it != transitional_matches_.end(); | 345 transitional_matches_.begin(); it != transitional_matches_.end(); |
| 346 ++it) { | 346 ++it) { |
| 347 if (!base::StartsWith(lower_user_text, it->user_text, true)) | 347 if (!base::StartsWith(lower_user_text, it->user_text, |
| 348 base::CompareCase::SENSITIVE)) |
| 348 continue; | 349 continue; |
| 349 | 350 |
| 350 // Add entries to the database for those matches. | 351 // Add entries to the database for those matches. |
| 351 for (std::vector<GURL>::const_iterator url_it = it->urls.begin(); | 352 for (std::vector<GURL>::const_iterator url_it = it->urls.begin(); |
| 352 url_it != it->urls.end(); ++url_it) { | 353 url_it != it->urls.end(); ++url_it) { |
| 353 DCHECK(it->user_text.length() >= kMinimumUserTextLength); | 354 DCHECK(it->user_text.length() >= kMinimumUserTextLength); |
| 354 const DBCacheKey key = { it->user_text, *url_it }; | 355 const DBCacheKey key = { it->user_text, *url_it }; |
| 355 const bool is_hit = (*url_it == opened_url); | 356 const bool is_hit = (*url_it == opened_url); |
| 356 | 357 |
| 357 AutocompleteActionPredictorTable::Row row; | 358 AutocompleteActionPredictorTable::Row row; |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 history_service_observer_.Remove(history_service); | 602 history_service_observer_.Remove(history_service); |
| 602 } | 603 } |
| 603 | 604 |
| 604 AutocompleteActionPredictor::TransitionalMatch::TransitionalMatch() { | 605 AutocompleteActionPredictor::TransitionalMatch::TransitionalMatch() { |
| 605 } | 606 } |
| 606 | 607 |
| 607 AutocompleteActionPredictor::TransitionalMatch::~TransitionalMatch() { | 608 AutocompleteActionPredictor::TransitionalMatch::~TransitionalMatch() { |
| 608 } | 609 } |
| 609 | 610 |
| 610 } // namespace predictors | 611 } // namespace predictors |
| OLD | NEW |