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