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/webui/omnibox/omnibox_ui_handler.h" | 5 #include "chrome/browser/ui/webui/omnibox/omnibox_ui_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 result->from_previous = input.from_previous; | 87 result->from_previous = input.from_previous; |
88 | 88 |
89 result->additional_info = | 89 result->additional_info = |
90 mojo::Array<AutocompleteAdditionalInfoPtr>::From(input.additional_info); | 90 mojo::Array<AutocompleteAdditionalInfoPtr>::From(input.additional_info); |
91 return result.Pass(); | 91 return result.Pass(); |
92 } | 92 } |
93 }; | 93 }; |
94 | 94 |
95 template <> | 95 template <> |
96 class TypeConverter<AutocompleteResultsForProviderMojoPtr, | 96 class TypeConverter<AutocompleteResultsForProviderMojoPtr, |
97 AutocompleteProvider*> { | 97 scoped_refptr<AutocompleteProvider> > { |
98 public: | 98 public: |
99 static AutocompleteResultsForProviderMojoPtr ConvertFrom( | 99 static AutocompleteResultsForProviderMojoPtr ConvertFrom( |
100 const AutocompleteProvider* input) { | 100 const scoped_refptr<AutocompleteProvider>& input) { |
101 AutocompleteResultsForProviderMojoPtr result( | 101 AutocompleteResultsForProviderMojoPtr result( |
102 AutocompleteResultsForProviderMojo::New()); | 102 AutocompleteResultsForProviderMojo::New()); |
103 result->provider_name = input->GetName(); | 103 result->provider_name = input->GetName(); |
104 result->results = | 104 result->results = |
105 mojo::Array<AutocompleteMatchMojoPtr>::From(input->matches()); | 105 mojo::Array<AutocompleteMatchMojoPtr>::From(input->matches()); |
106 return result.Pass(); | 106 return result.Pass(); |
107 } | 107 } |
108 }; | 108 }; |
109 | 109 |
110 } // namespace mojo | 110 } // namespace mojo |
(...skipping 22 matching lines...) Expand all Loading... |
133 { | 133 { |
134 // Copy to an ACMatches to make conversion easier. Since this isn't | 134 // Copy to an ACMatches to make conversion easier. Since this isn't |
135 // performance critical we don't worry about the cost here. | 135 // performance critical we don't worry about the cost here. |
136 ACMatches matches(controller_->result().begin(), | 136 ACMatches matches(controller_->result().begin(), |
137 controller_->result().end()); | 137 controller_->result().end()); |
138 result->combined_results = | 138 result->combined_results = |
139 mojo::Array<AutocompleteMatchMojoPtr>::From(matches); | 139 mojo::Array<AutocompleteMatchMojoPtr>::From(matches); |
140 } | 140 } |
141 result->results_by_provider = | 141 result->results_by_provider = |
142 mojo::Array<AutocompleteResultsForProviderMojoPtr>::From( | 142 mojo::Array<AutocompleteResultsForProviderMojoPtr>::From( |
143 *controller_->providers()); | 143 controller_->providers()); |
144 client()->HandleNewAutocompleteResult(result.Pass()); | 144 client()->HandleNewAutocompleteResult(result.Pass()); |
145 } | 145 } |
146 | 146 |
147 bool OmniboxUIHandler::LookupIsTypedHost(const base::string16& host, | 147 bool OmniboxUIHandler::LookupIsTypedHost(const base::string16& host, |
148 bool* is_typed_host) const { | 148 bool* is_typed_host) const { |
149 HistoryService* const history_service = | 149 HistoryService* const history_service = |
150 HistoryServiceFactory::GetForProfile(profile_, | 150 HistoryServiceFactory::GetForProfile(profile_, |
151 Profile::EXPLICIT_ACCESS); | 151 Profile::EXPLICIT_ACCESS); |
152 if (!history_service) | 152 if (!history_service) |
153 return false; | 153 return false; |
(...skipping 25 matching lines...) Expand all Loading... |
179 ChromeAutocompleteSchemeClassifier(profile_)); | 179 ChromeAutocompleteSchemeClassifier(profile_)); |
180 controller_->Start(input_); | 180 controller_->Start(input_); |
181 } | 181 } |
182 | 182 |
183 void OmniboxUIHandler::ResetController() { | 183 void OmniboxUIHandler::ResetController() { |
184 controller_.reset(new AutocompleteController(profile_, | 184 controller_.reset(new AutocompleteController(profile_, |
185 TemplateURLServiceFactory::GetForProfile(profile_), | 185 TemplateURLServiceFactory::GetForProfile(profile_), |
186 this, | 186 this, |
187 AutocompleteClassifier::kDefaultOmniboxProviders)); | 187 AutocompleteClassifier::kDefaultOmniboxProviders)); |
188 } | 188 } |
OLD | NEW |