| 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/autocomplete/history_url_provider.h" | 5 #include "chrome/browser/autocomplete/history_url_provider.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 // Add the WYT match as a fallback in case we can't get the history service or | 519 // Add the WYT match as a fallback in case we can't get the history service or |
| 520 // URL DB; otherwise, we'll replace this match lower down. Don't do this for | 520 // URL DB; otherwise, we'll replace this match lower down. Don't do this for |
| 521 // queries, though -- while we can sometimes mark up a match for them, it's | 521 // queries, though -- while we can sometimes mark up a match for them, it's |
| 522 // not what the user wants, and just adds noise. | 522 // not what the user wants, and just adds noise. |
| 523 if (fixed_up_input.type() != metrics::OmniboxInputType::QUERY) | 523 if (fixed_up_input.type() != metrics::OmniboxInputType::QUERY) |
| 524 matches_.push_back(what_you_typed_match); | 524 matches_.push_back(what_you_typed_match); |
| 525 | 525 |
| 526 // We'll need the history service to run both passes, so try to obtain it. | 526 // We'll need the history service to run both passes, so try to obtain it. |
| 527 if (!profile_) | 527 if (!profile_) |
| 528 return; | 528 return; |
| 529 HistoryService* const history_service = | 529 HistoryService* const history_service = HistoryServiceFactory::GetForProfile( |
| 530 HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); | 530 profile_, ServiceAccessType::EXPLICIT_ACCESS); |
| 531 if (!history_service) | 531 if (!history_service) |
| 532 return; | 532 return; |
| 533 | 533 |
| 534 // Get the default search provider and search terms data now since we have to | 534 // Get the default search provider and search terms data now since we have to |
| 535 // retrieve these on the UI thread, and the second pass runs on the history | 535 // retrieve these on the UI thread, and the second pass runs on the history |
| 536 // thread. |template_url_service| can be NULL when testing. | 536 // thread. |template_url_service| can be NULL when testing. |
| 537 TemplateURLService* template_url_service = | 537 TemplateURLService* template_url_service = |
| 538 TemplateURLServiceFactory::GetForProfile(profile_); | 538 TemplateURLServiceFactory::GetForProfile(profile_); |
| 539 TemplateURL* default_search_provider = template_url_service ? | 539 TemplateURL* default_search_provider = template_url_service ? |
| 540 template_url_service->GetDefaultSearchProvider() : NULL; | 540 template_url_service->GetDefaultSearchProvider() : NULL; |
| (...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1155 AutocompleteMatch::ClassifyLocationInString(base::string16::npos, 0, | 1155 AutocompleteMatch::ClassifyLocationInString(base::string16::npos, 0, |
| 1156 match.contents.length(), ACMatchClassification::URL, | 1156 match.contents.length(), ACMatchClassification::URL, |
| 1157 &match.contents_class); | 1157 &match.contents_class); |
| 1158 } | 1158 } |
| 1159 match.description = info.title(); | 1159 match.description = info.title(); |
| 1160 match.description_class = | 1160 match.description_class = |
| 1161 ClassifyDescription(params.input.text(), match.description); | 1161 ClassifyDescription(params.input.text(), match.description); |
| 1162 RecordAdditionalInfoFromUrlRow(info, &match); | 1162 RecordAdditionalInfoFromUrlRow(info, &match); |
| 1163 return match; | 1163 return match; |
| 1164 } | 1164 } |
| OLD | NEW |