Chromium Code Reviews| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 93 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, | 93 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, |
| 94 content::NotificationService::AllSources()); | 94 content::NotificationService::AllSources()); |
| 95 } | 95 } |
| 96 } | 96 } |
| 97 | 97 |
| 98 AutocompleteActionPredictor::~AutocompleteActionPredictor() { | 98 AutocompleteActionPredictor::~AutocompleteActionPredictor() { |
| 99 if (main_profile_predictor_) | 99 if (main_profile_predictor_) |
| 100 main_profile_predictor_->incognito_predictor_ = NULL; | 100 main_profile_predictor_->incognito_predictor_ = NULL; |
| 101 else if (incognito_predictor_) | 101 else if (incognito_predictor_) |
| 102 incognito_predictor_->main_profile_predictor_ = NULL; | 102 incognito_predictor_->main_profile_predictor_ = NULL; |
| 103 if (prerender_handle_.get()) | 103 prerender_handle_.reset(); |
|
mmenke
2012/12/13 18:27:16
Since it automatically is cancelled on destruction
gavinp
2012/12/13 20:45:34
I had to remove that auto delete on destruction be
| |
| 104 prerender_handle_->OnCancel(); | |
| 105 } | 104 } |
| 106 | 105 |
| 107 void AutocompleteActionPredictor::RegisterTransitionalMatches( | 106 void AutocompleteActionPredictor::RegisterTransitionalMatches( |
| 108 const string16& user_text, | 107 const string16& user_text, |
| 109 const AutocompleteResult& result) { | 108 const AutocompleteResult& result) { |
| 110 if (user_text.length() < kMinimumUserTextLength) | 109 if (user_text.length() < kMinimumUserTextLength) |
| 111 return; | 110 return; |
| 112 const string16 lower_user_text(base::i18n::ToLower(user_text)); | 111 const string16 lower_user_text(base::i18n::ToLower(user_text)); |
| 113 | 112 |
| 114 // Merge this in to an existing match if we already saw |user_text| | 113 // Merge this in to an existing match if we already saw |user_text| |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 575 return number_of_hits / (number_of_hits + value.number_of_misses); | 574 return number_of_hits / (number_of_hits + value.number_of_misses); |
| 576 } | 575 } |
| 577 | 576 |
| 578 AutocompleteActionPredictor::TransitionalMatch::TransitionalMatch() { | 577 AutocompleteActionPredictor::TransitionalMatch::TransitionalMatch() { |
| 579 } | 578 } |
| 580 | 579 |
| 581 AutocompleteActionPredictor::TransitionalMatch::~TransitionalMatch() { | 580 AutocompleteActionPredictor::TransitionalMatch::~TransitionalMatch() { |
| 582 } | 581 } |
| 583 | 582 |
| 584 } // namespace predictors | 583 } // namespace predictors |
| OLD | NEW |