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_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/histogram.h" | 9 #include "base/histogram.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 void HistoryURLProvider::ExecuteWithDB(history::HistoryBackend* backend, | 110 void HistoryURLProvider::ExecuteWithDB(history::HistoryBackend* backend, |
111 history::URLDatabase* db, | 111 history::URLDatabase* db, |
112 HistoryURLProviderParams* params) { | 112 HistoryURLProviderParams* params) { |
113 // We may get called with a NULL database if it couldn't be properly | 113 // We may get called with a NULL database if it couldn't be properly |
114 // initialized. In this case we just say the query is complete. | 114 // initialized. In this case we just say the query is complete. |
115 if (db && !params->cancel) { | 115 if (db && !params->cancel) { |
116 TimeTicks beginning_time = TimeTicks::Now(); | 116 TimeTicks beginning_time = TimeTicks::Now(); |
117 | 117 |
118 DoAutocomplete(backend, db, params); | 118 DoAutocomplete(backend, db, params); |
119 | 119 |
120 HISTOGRAM_TIMES(L"Autocomplete.HistoryAsyncQueryTime", | 120 HISTOGRAM_TIMES("Autocomplete.HistoryAsyncQueryTime", |
121 TimeTicks::Now() - beginning_time); | 121 TimeTicks::Now() - beginning_time); |
122 } | 122 } |
123 | 123 |
124 // Return the results (if any) to the main thread. | 124 // Return the results (if any) to the main thread. |
125 params->message_loop->PostTask(FROM_HERE, NewRunnableMethod( | 125 params->message_loop->PostTask(FROM_HERE, NewRunnableMethod( |
126 this, &HistoryURLProvider::QueryComplete, params)); | 126 this, &HistoryURLProvider::QueryComplete, params)); |
127 } | 127 } |
128 | 128 |
129 // Used by both autocomplete passes, and therefore called on multiple different | 129 // Used by both autocomplete passes, and therefore called on multiple different |
130 // threads (though not simultaneously). | 130 // threads (though not simultaneously). |
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 history_match.input_location - offset, params->input.text().length(), | 820 history_match.input_location - offset, params->input.text().length(), |
821 match.contents.length(), ACMatchClassification::URL, | 821 match.contents.length(), ACMatchClassification::URL, |
822 &match.contents_class); | 822 &match.contents_class); |
823 match.description = info.title(); | 823 match.description = info.title(); |
824 AutocompleteMatch::ClassifyMatchInString(params->input.text(), info.title(), | 824 AutocompleteMatch::ClassifyMatchInString(params->input.text(), info.title(), |
825 ACMatchClassification::NONE, | 825 ACMatchClassification::NONE, |
826 &match.description_class); | 826 &match.description_class); |
827 | 827 |
828 return match; | 828 return match; |
829 } | 829 } |
830 | |
OLD | NEW |