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/ui/omnibox/omnibox_edit_model.h" | 5 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 423 | 423 |
| 424 void OmniboxEditModel::StartAutocomplete( | 424 void OmniboxEditModel::StartAutocomplete( |
| 425 bool has_selected_text, | 425 bool has_selected_text, |
| 426 bool prevent_inline_autocomplete) const { | 426 bool prevent_inline_autocomplete) const { |
| 427 ClearPopupKeywordMode(); | 427 ClearPopupKeywordMode(); |
| 428 | 428 |
| 429 bool keyword_is_selected = KeywordIsSelected(); | 429 bool keyword_is_selected = KeywordIsSelected(); |
| 430 popup_->SetHoveredLine(OmniboxPopupModel::kNoMatch); | 430 popup_->SetHoveredLine(OmniboxPopupModel::kNoMatch); |
| 431 // We don't explicitly clear OmniboxPopupModel::manually_selected_match, as | 431 // We don't explicitly clear OmniboxPopupModel::manually_selected_match, as |
| 432 // Start ends up invoking OmniboxPopupModel::OnResultChanged which clears it. | 432 // Start ends up invoking OmniboxPopupModel::OnResultChanged which clears it. |
| 433 SearchProvider* search_provider = autocomplete_controller_->search_provider(); | |
| 434 if (search_provider) { | |
| 435 search_provider->set_instant_suggest_enabled(controller_->GetInstant() && | |
|
sky
2012/08/24 19:11:52
Don't you need to NULL check instant?
sreeram
2012/08/24 19:15:29
Correct. Isn't that what the "&&" is doing? GetIns
| |
| 436 controller_->GetInstant()->IsSuggestEnabled()); | |
| 437 } | |
| 433 autocomplete_controller_->Start( | 438 autocomplete_controller_->Start( |
| 434 user_text_, GetDesiredTLD(), | 439 user_text_, GetDesiredTLD(), |
| 435 prevent_inline_autocomplete || just_deleted_text_ || | 440 prevent_inline_autocomplete || just_deleted_text_ || |
| 436 (has_selected_text && inline_autocomplete_text_.empty()) || | 441 (has_selected_text && inline_autocomplete_text_.empty()) || |
| 437 (paste_state_ != NONE), keyword_is_selected, | 442 (paste_state_ != NONE), keyword_is_selected, |
| 438 keyword_is_selected || allow_exact_keyword_match_, | 443 keyword_is_selected || allow_exact_keyword_match_, |
| 439 AutocompleteInput::ALL_MATCHES); | 444 AutocompleteInput::ALL_MATCHES); |
| 440 } | 445 } |
| 441 | 446 |
| 442 void OmniboxEditModel::StopAutocomplete() { | 447 void OmniboxEditModel::StopAutocomplete() { |
| (...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1216 } | 1221 } |
| 1217 | 1222 |
| 1218 void OmniboxEditModel::ClassifyStringForPasteAndGo( | 1223 void OmniboxEditModel::ClassifyStringForPasteAndGo( |
| 1219 const string16& text, | 1224 const string16& text, |
| 1220 AutocompleteMatch* match, | 1225 AutocompleteMatch* match, |
| 1221 GURL* alternate_nav_url) const { | 1226 GURL* alternate_nav_url) const { |
| 1222 DCHECK(match); | 1227 DCHECK(match); |
| 1223 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify(text, | 1228 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify(text, |
| 1224 string16(), false, false, match, alternate_nav_url); | 1229 string16(), false, false, match, alternate_nav_url); |
| 1225 } | 1230 } |
| OLD | NEW |