| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_contents_provider.h" | 5 #include "chrome/browser/autocomplete/history_contents_provider.h" |
| 6 | 6 |
| 7 #include "base/histogram.h" | 7 #include "base/histogram.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "chrome/browser/bookmarks/bookmark_model.h" | 9 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 10 #include "chrome/browser/history/query_parser.h" | 10 #include "chrome/browser/history/query_parser.h" |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 | 271 |
| 272 DCHECK(results_.size() == 0); // When we get here the results should be | 272 DCHECK(results_.size() == 0); // When we get here the results should be |
| 273 // empty. | 273 // empty. |
| 274 | 274 |
| 275 TimeTicks start_time = TimeTicks::Now(); | 275 TimeTicks start_time = TimeTicks::Now(); |
| 276 std::vector<bookmark_utils::TitleMatch> matches; | 276 std::vector<bookmark_utils::TitleMatch> matches; |
| 277 bookmark_utils::GetBookmarksMatchingText(bookmark_model, input.text(), | 277 bookmark_utils::GetBookmarksMatchingText(bookmark_model, input.text(), |
| 278 kMaxMatchCount, &matches); | 278 kMaxMatchCount, &matches); |
| 279 for (size_t i = 0; i < matches.size(); ++i) | 279 for (size_t i = 0; i < matches.size(); ++i) |
| 280 AddBookmarkTitleMatchToResults(matches[i]); | 280 AddBookmarkTitleMatchToResults(matches[i]); |
| 281 UMA_HISTOGRAM_TIMES(L"Omnibox.QueryBookmarksTime", | 281 UMA_HISTOGRAM_TIMES("Omnibox.QueryBookmarksTime", |
| 282 TimeTicks::Now() - start_time); | 282 TimeTicks::Now() - start_time); |
| 283 } | 283 } |
| 284 | 284 |
| 285 void HistoryContentsProvider::AddBookmarkTitleMatchToResults( | 285 void HistoryContentsProvider::AddBookmarkTitleMatchToResults( |
| 286 const bookmark_utils::TitleMatch& match) { | 286 const bookmark_utils::TitleMatch& match) { |
| 287 history::URLResult url_result(match.node->GetURL(), match.match_positions); | 287 history::URLResult url_result(match.node->GetURL(), match.match_positions); |
| 288 url_result.set_title(match.node->GetTitle()); | 288 url_result.set_title(match.node->GetTitle()); |
| 289 results_.AppendURLBySwapping(&url_result); | 289 results_.AppendURLBySwapping(&url_result); |
| 290 } | 290 } |
| OLD | NEW |