| 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" |
| 11 #include "chrome/browser/net/predictor.h" | 11 #include "chrome/browser/net/predictor.h" |
| 12 #include "chrome/browser/predictors/autocomplete_action_predictor.h" | 12 #include "chrome/browser/predictors/autocomplete_action_predictor.h" |
| 13 #include "chrome/browser/prerender/prerender_field_trial.h" | 13 #include "chrome/browser/prerender/prerender_field_trial.h" |
| 14 #include "chrome/browser/prerender/prerender_manager.h" | 14 #include "chrome/browser/prerender/prerender_manager.h" |
| 15 #include "chrome/browser/prerender/prerender_manager_factory.h" | 15 #include "chrome/browser/prerender/prerender_manager_factory.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/search/search.h" | 17 #include "chrome/browser/search/search.h" |
| 18 #include "chrome/browser/search_engines/template_url_service_factory.h" | |
| 19 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h" | 18 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h" |
| 20 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" | 19 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" |
| 21 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" | 20 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" |
| 22 #include "chrome/browser/ui/omnibox/omnibox_popup_view.h" | 21 #include "chrome/browser/ui/omnibox/omnibox_popup_view.h" |
| 23 #include "chrome/common/instant_types.h" | 22 #include "chrome/common/instant_types.h" |
| 24 #include "extensions/common/constants.h" | 23 #include "extensions/common/constants.h" |
| 25 #include "ui/gfx/rect.h" | 24 #include "ui/gfx/rect.h" |
| 26 | 25 |
| 27 namespace { | 26 namespace { |
| 28 | 27 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 return NULL; | 66 return NULL; |
| 68 } | 67 } |
| 69 | 68 |
| 70 } // namespace | 69 } // namespace |
| 71 | 70 |
| 72 OmniboxController::OmniboxController(OmniboxEditModel* omnibox_edit_model, | 71 OmniboxController::OmniboxController(OmniboxEditModel* omnibox_edit_model, |
| 73 Profile* profile) | 72 Profile* profile) |
| 74 : omnibox_edit_model_(omnibox_edit_model), | 73 : omnibox_edit_model_(omnibox_edit_model), |
| 75 profile_(profile), | 74 profile_(profile), |
| 76 popup_(NULL), | 75 popup_(NULL), |
| 77 autocomplete_controller_(new AutocompleteController(profile, | 76 autocomplete_controller_(new AutocompleteController(profile, this, |
| 78 TemplateURLServiceFactory::GetForProfile(profile), this, | |
| 79 AutocompleteClassifier::kDefaultOmniboxProviders)) { | 77 AutocompleteClassifier::kDefaultOmniboxProviders)) { |
| 80 } | 78 } |
| 81 | 79 |
| 82 OmniboxController::~OmniboxController() { | 80 OmniboxController::~OmniboxController() { |
| 83 } | 81 } |
| 84 | 82 |
| 85 void OmniboxController::StartAutocomplete( | 83 void OmniboxController::StartAutocomplete( |
| 86 const AutocompleteInput& input) const { | 84 const AutocompleteInput& input) const { |
| 87 ClearPopupKeywordMode(); | 85 ClearPopupKeywordMode(); |
| 88 popup_->SetHoveredLine(OmniboxPopupModel::kNoMatch); | 86 popup_->SetHoveredLine(OmniboxPopupModel::kNoMatch); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 if (profile_->GetNetworkPredictor()) { | 152 if (profile_->GetNetworkPredictor()) { |
| 155 profile_->GetNetworkPredictor()->AnticipateOmniboxUrl( | 153 profile_->GetNetworkPredictor()->AnticipateOmniboxUrl( |
| 156 match.destination_url, | 154 match.destination_url, |
| 157 predictors::AutocompleteActionPredictor::IsPreconnectable(match)); | 155 predictors::AutocompleteActionPredictor::IsPreconnectable(match)); |
| 158 } | 156 } |
| 159 // We could prefetch the alternate nav URL, if any, but because there | 157 // We could prefetch the alternate nav URL, if any, but because there |
| 160 // can be many of these as a user types an initial series of characters, | 158 // can be many of these as a user types an initial series of characters, |
| 161 // the OS DNS cache could suffer eviction problems for minimal gain. | 159 // the OS DNS cache could suffer eviction problems for minimal gain. |
| 162 } | 160 } |
| 163 } | 161 } |
| OLD | NEW |