| 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 GURL(result_by_provider.results[j]->destination_url)); | 155 GURL(result_by_provider.results[j]->destination_url)); |
| 156 } | 156 } |
| 157 } | 157 } |
| 158 } | 158 } |
| 159 | 159 |
| 160 client()->HandleNewAutocompleteResult(result.Pass()); | 160 client()->HandleNewAutocompleteResult(result.Pass()); |
| 161 } | 161 } |
| 162 | 162 |
| 163 bool OmniboxUIHandler::LookupIsTypedHost(const base::string16& host, | 163 bool OmniboxUIHandler::LookupIsTypedHost(const base::string16& host, |
| 164 bool* is_typed_host) const { | 164 bool* is_typed_host) const { |
| 165 HistoryService* const history_service = | 165 HistoryService* const history_service = HistoryServiceFactory::GetForProfile( |
| 166 HistoryServiceFactory::GetForProfile(profile_, | 166 profile_, ServiceAccessType::EXPLICIT_ACCESS); |
| 167 Profile::EXPLICIT_ACCESS); | |
| 168 if (!history_service) | 167 if (!history_service) |
| 169 return false; | 168 return false; |
| 170 history::URLDatabase* url_db = history_service->InMemoryDatabase(); | 169 history::URLDatabase* url_db = history_service->InMemoryDatabase(); |
| 171 if (!url_db) | 170 if (!url_db) |
| 172 return false; | 171 return false; |
| 173 *is_typed_host = url_db->IsTypedHost(base::UTF16ToUTF8(host)); | 172 *is_typed_host = url_db->IsTypedHost(base::UTF16ToUTF8(host)); |
| 174 return true; | 173 return true; |
| 175 } | 174 } |
| 176 | 175 |
| 177 void OmniboxUIHandler::StartOmniboxQuery(const mojo::String& input_string, | 176 void OmniboxUIHandler::StartOmniboxQuery(const mojo::String& input_string, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 194 ChromeAutocompleteSchemeClassifier(profile_)); | 193 ChromeAutocompleteSchemeClassifier(profile_)); |
| 195 controller_->Start(input_); | 194 controller_->Start(input_); |
| 196 } | 195 } |
| 197 | 196 |
| 198 void OmniboxUIHandler::ResetController() { | 197 void OmniboxUIHandler::ResetController() { |
| 199 controller_.reset(new AutocompleteController(profile_, | 198 controller_.reset(new AutocompleteController(profile_, |
| 200 TemplateURLServiceFactory::GetForProfile(profile_), | 199 TemplateURLServiceFactory::GetForProfile(profile_), |
| 201 this, | 200 this, |
| 202 AutocompleteClassifier::kDefaultOmniboxProviders)); | 201 AutocompleteClassifier::kDefaultOmniboxProviders)); |
| 203 } | 202 } |
| OLD | NEW |