| 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 25 matching lines...) Expand all Loading... |
| 36 OmniboxController::~OmniboxController() { | 36 OmniboxController::~OmniboxController() { |
| 37 } | 37 } |
| 38 | 38 |
| 39 void OmniboxController::StartAutocomplete( | 39 void OmniboxController::StartAutocomplete( |
| 40 string16 user_text, | 40 string16 user_text, |
| 41 size_t cursor_position, | 41 size_t cursor_position, |
| 42 const GURL& current_url, | 42 const GURL& current_url, |
| 43 AutocompleteInput::PageClassification current_page_classification, | 43 AutocompleteInput::PageClassification current_page_classification, |
| 44 bool prevent_inline_autocomplete, | 44 bool prevent_inline_autocomplete, |
| 45 bool prefer_keyword, | 45 bool prefer_keyword, |
| 46 bool allow_exact_keyword_match, | 46 bool allow_exact_keyword_match) const { |
| 47 int omnibox_start_margin) const { | |
| 48 ClearPopupKeywordMode(); | 47 ClearPopupKeywordMode(); |
| 49 popup_->SetHoveredLine(OmniboxPopupModel::kNoMatch); | 48 popup_->SetHoveredLine(OmniboxPopupModel::kNoMatch); |
| 50 | 49 |
| 51 if (chrome::IsInstantExtendedAPIEnabled()) { | |
| 52 autocomplete_controller_->search_provider()-> | |
| 53 SetOmniboxStartMargin(omnibox_start_margin); | |
| 54 } | |
| 55 | |
| 56 // We don't explicitly clear OmniboxPopupModel::manually_selected_match, as | 50 // We don't explicitly clear OmniboxPopupModel::manually_selected_match, as |
| 57 // Start ends up invoking OmniboxPopupModel::OnResultChanged which clears it. | 51 // Start ends up invoking OmniboxPopupModel::OnResultChanged which clears it. |
| 58 autocomplete_controller_->Start(AutocompleteInput( | 52 autocomplete_controller_->Start(AutocompleteInput( |
| 59 user_text, cursor_position, string16(), current_url, | 53 user_text, cursor_position, string16(), current_url, |
| 60 current_page_classification, prevent_inline_autocomplete, | 54 current_page_classification, prevent_inline_autocomplete, |
| 61 prefer_keyword, allow_exact_keyword_match, | 55 prefer_keyword, allow_exact_keyword_match, |
| 62 AutocompleteInput::ALL_MATCHES)); | 56 AutocompleteInput::ALL_MATCHES)); |
| 63 } | 57 } |
| 64 | 58 |
| 65 void OmniboxController::OnResultChanged(bool default_match_changed) { | 59 void OmniboxController::OnResultChanged(bool default_match_changed) { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 if (profile_->GetNetworkPredictor()) { | 103 if (profile_->GetNetworkPredictor()) { |
| 110 profile_->GetNetworkPredictor()->AnticipateOmniboxUrl( | 104 profile_->GetNetworkPredictor()->AnticipateOmniboxUrl( |
| 111 match.destination_url, | 105 match.destination_url, |
| 112 predictors::AutocompleteActionPredictor::IsPreconnectable(match)); | 106 predictors::AutocompleteActionPredictor::IsPreconnectable(match)); |
| 113 } | 107 } |
| 114 // We could prefetch the alternate nav URL, if any, but because there | 108 // We could prefetch the alternate nav URL, if any, but because there |
| 115 // can be many of these as a user types an initial series of characters, | 109 // can be many of these as a user types an initial series of characters, |
| 116 // the OS DNS cache could suffer eviction problems for minimal gain. | 110 // the OS DNS cache could suffer eviction problems for minimal gain. |
| 117 } | 111 } |
| 118 } | 112 } |
| OLD | NEW |