| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_controller.h" | 5 #include "chrome/browser/ui/omnibox/omnibox_controller.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "chrome/browser/autocomplete/autocomplete_classifier.h" | 8 #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
| 9 #include "chrome/browser/autocomplete/autocomplete_match.h" | 9 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| 10 #include "chrome/browser/autocomplete/search_provider.h" | 10 #include "chrome/browser/autocomplete/search_provider.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 bool prefer_keyword, | 46 bool prefer_keyword, |
| 47 bool allow_exact_keyword_match, | 47 bool allow_exact_keyword_match, |
| 48 int omnibox_start_margin) const { | 48 int omnibox_start_margin) const { |
| 49 ClearPopupKeywordMode(); | 49 ClearPopupKeywordMode(); |
| 50 popup_->SetHoveredLine(OmniboxPopupModel::kNoMatch); | 50 popup_->SetHoveredLine(OmniboxPopupModel::kNoMatch); |
| 51 | 51 |
| 52 #if defined(HTML_INSTANT_EXTENDED_POPUP) | 52 #if defined(HTML_INSTANT_EXTENDED_POPUP) |
| 53 InstantController* instant_controller = GetInstantController(); | 53 InstantController* instant_controller = GetInstantController(); |
| 54 if (instant_controller) { | 54 if (instant_controller) { |
| 55 instant_controller->OnAutocompleteStart(); | 55 instant_controller->OnAutocompleteStart(); |
| 56 // If the embedded page for InstantExtended is fetching its own suggestions, | |
| 57 // suppress search suggestions from SearchProvider. We still need | |
| 58 // SearchProvider to run for FinalizeInstantQuery. | |
| 59 // TODO(dcblack): Once we are done refactoring the omnibox so we don't need | |
| 60 // to use FinalizeInstantQuery anymore, we can take out this check and | |
| 61 // remove this provider from kInstantExtendedOmniboxProviders. | |
| 62 if (instant_controller->WillFetchCompletions()) | |
| 63 autocomplete_controller_->search_provider()->SuppressSearchSuggestions(); | |
| 64 } | 56 } |
| 65 #endif | 57 #endif |
| 66 if (chrome::IsInstantExtendedAPIEnabled()) { | 58 if (chrome::IsInstantExtendedAPIEnabled()) { |
| 67 autocomplete_controller_->search_provider()-> | 59 autocomplete_controller_->search_provider()-> |
| 68 SetOmniboxStartMargin(omnibox_start_margin); | 60 SetOmniboxStartMargin(omnibox_start_margin); |
| 69 } | 61 } |
| 70 | 62 |
| 71 // We don't explicitly clear OmniboxPopupModel::manually_selected_match, as | 63 // We don't explicitly clear OmniboxPopupModel::manually_selected_match, as |
| 72 // Start ends up invoking OmniboxPopupModel::OnResultChanged which clears it. | 64 // Start ends up invoking OmniboxPopupModel::OnResultChanged which clears it. |
| 73 autocomplete_controller_->Start(AutocompleteInput( | 65 autocomplete_controller_->Start(AutocompleteInput( |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 // We send the caret position to Instant (so it can determine #1 itself), and | 198 // We send the caret position to Instant (so it can determine #1 itself), and |
| 207 // we use a separated widget for displaying the Instant suggest (so it doesn't | 199 // we use a separated widget for displaying the Instant suggest (so it doesn't |
| 208 // interfere with #2). So, we don't need to care about the value of | 200 // interfere with #2). So, we don't need to care about the value of |
| 209 // input.prevent_inline_autocomplete() here. | 201 // input.prevent_inline_autocomplete() here. |
| 210 return just_deleted_text || popup_->selected_line() != 0; | 202 return just_deleted_text || popup_->selected_line() != 0; |
| 211 } | 203 } |
| 212 | 204 |
| 213 InstantController* OmniboxController::GetInstantController() const { | 205 InstantController* OmniboxController::GetInstantController() const { |
| 214 return omnibox_edit_model_->GetInstantController(); | 206 return omnibox_edit_model_->GetInstantController(); |
| 215 } | 207 } |
| OLD | NEW |