OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
15 #include "chrome/browser/autocomplete/autocomplete_match.h" | 15 #include "chrome/browser/autocomplete/autocomplete_match.h" |
16 #include "chrome/browser/history/history.h" | 16 #include "chrome/browser/history/history.h" |
17 #include "chrome/browser/history/history_backend.h" | 17 #include "chrome/browser/history/history_backend.h" |
18 #include "chrome/browser/history/history_database.h" | 18 #include "chrome/browser/history/history_database.h" |
| 19 #include "chrome/browser/history/history_field_trial.h" |
19 #include "chrome/browser/history/history_types.h" | 20 #include "chrome/browser/history/history_types.h" |
20 #include "chrome/browser/net/url_fixer_upper.h" | 21 #include "chrome/browser/net/url_fixer_upper.h" |
21 #include "chrome/browser/prefs/pref_service.h" | 22 #include "chrome/browser/prefs/pref_service.h" |
22 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
23 #include "chrome/common/pref_names.h" | 24 #include "chrome/common/pref_names.h" |
24 #include "chrome/common/url_constants.h" | 25 #include "chrome/common/url_constants.h" |
25 #include "googleurl/src/gurl.h" | 26 #include "googleurl/src/gurl.h" |
26 #include "googleurl/src/url_parse.h" | 27 #include "googleurl/src/url_parse.h" |
27 #include "googleurl/src/url_util.h" | 28 #include "googleurl/src/url_util.h" |
28 #include "net/base/net_util.h" | 29 #include "net/base/net_util.h" |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 HistoryURLProviderParams* params) { | 345 HistoryURLProviderParams* params) { |
345 // We may get called with a NULL database if it couldn't be properly | 346 // We may get called with a NULL database if it couldn't be properly |
346 // initialized. | 347 // initialized. |
347 if (!db) { | 348 if (!db) { |
348 params->failed = true; | 349 params->failed = true; |
349 } else if (!params->cancel_flag.IsSet()) { | 350 } else if (!params->cancel_flag.IsSet()) { |
350 base::TimeTicks beginning_time = base::TimeTicks::Now(); | 351 base::TimeTicks beginning_time = base::TimeTicks::Now(); |
351 | 352 |
352 DoAutocomplete(backend, db, params); | 353 DoAutocomplete(backend, db, params); |
353 | 354 |
354 UMA_HISTOGRAM_TIMES("Autocomplete.HistoryAsyncQueryTime", | 355 UMA_HISTOGRAM_TIMES("Autocomplete.HistoryAsyncQueryTime" + |
| 356 history::HistoryFieldTrial::GetGroupSuffix(), |
355 base::TimeTicks::Now() - beginning_time); | 357 base::TimeTicks::Now() - beginning_time); |
356 } | 358 } |
357 | 359 |
358 // Return the results (if any) to the main thread. | 360 // Return the results (if any) to the main thread. |
359 params->message_loop->PostTask(FROM_HERE, base::Bind( | 361 params->message_loop->PostTask(FROM_HERE, base::Bind( |
360 &HistoryURLProvider::QueryComplete, this, params)); | 362 &HistoryURLProvider::QueryComplete, this, params)); |
361 } | 363 } |
362 | 364 |
363 // Used by both autocomplete passes, and therefore called on multiple different | 365 // Used by both autocomplete passes, and therefore called on multiple different |
364 // threads (though not simultaneously). | 366 // threads (though not simultaneously). |
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
933 &match.contents_class); | 935 &match.contents_class); |
934 } | 936 } |
935 match.description = info.title(); | 937 match.description = info.title(); |
936 AutocompleteMatch::ClassifyMatchInString(params->input.text(), | 938 AutocompleteMatch::ClassifyMatchInString(params->input.text(), |
937 info.title(), | 939 info.title(), |
938 ACMatchClassification::NONE, | 940 ACMatchClassification::NONE, |
939 &match.description_class); | 941 &match.description_class); |
940 | 942 |
941 return match; | 943 return match; |
942 } | 944 } |
OLD | NEW |