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/download/download_query.h" | 5 #include "chrome/browser/download/download_query.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/file_path.h" | 13 #include "base/file_path.h" |
14 #include "base/i18n/case_conversion.h" | 14 #include "base/i18n/case_conversion.h" |
15 #include "base/i18n/string_search.h" | 15 #include "base/i18n/string_search.h" |
16 #include "base/logging.h" | 16 #include "base/logging.h" |
17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
18 #include "base/stl_util.h" | 18 #include "base/stl_util.h" |
19 #include "base/string16.h" | 19 #include "base/string16.h" |
20 #include "base/string_split.h" | 20 #include "base/string_split.h" |
21 #include "base/time.h" | 21 #include "base/time.h" |
22 #include "base/utf_string_conversions.h" | 22 #include "base/utf_string_conversions.h" |
23 #include "base/values.h" | 23 #include "base/values.h" |
24 #include "content/public/browser/content_browser_client.h" | 24 #include "content/public/browser/content_browser_client.h" |
25 #include "content/public/browser/download_item.h" | 25 #include "content/public/browser/download_item.h" |
26 #include "googleurl/src/gurl.h" | 26 #include "googleurl/src/gurl.h" |
27 #include "net/base/net_util.h" | 27 #include "net/base/net_util.h" |
28 #include "unicode/regex.h" | 28 #include "third_party/icu/public/i18n/unicode/regex.h" |
29 | 29 |
30 using content::DownloadDangerType; | 30 using content::DownloadDangerType; |
31 using content::DownloadItem; | 31 using content::DownloadItem; |
32 | 32 |
33 namespace { | 33 namespace { |
34 | 34 |
35 // Templatized base::Value::GetAs*(). | 35 // Templatized base::Value::GetAs*(). |
36 template <typename T> bool GetAs(const base::Value& in, T* out); | 36 template <typename T> bool GetAs(const base::Value& in, T* out); |
37 template<> bool GetAs(const base::Value& in, bool* out) { | 37 template<> bool GetAs(const base::Value& in, bool* out) { |
38 return in.GetAsBoolean(out); | 38 return in.GetAsBoolean(out); |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 | 384 |
385 void DownloadQuery::FinishSearch(DownloadQuery::DownloadVector* results) const { | 385 void DownloadQuery::FinishSearch(DownloadQuery::DownloadVector* results) const { |
386 if (!sorters_.empty()) | 386 if (!sorters_.empty()) |
387 std::partial_sort(results->begin(), | 387 std::partial_sort(results->begin(), |
388 results->begin() + std::min(limit_, results->size()), | 388 results->begin() + std::min(limit_, results->size()), |
389 results->end(), | 389 results->end(), |
390 DownloadComparator(sorters_)); | 390 DownloadComparator(sorters_)); |
391 if (results->size() > limit_) | 391 if (results->size() > limit_) |
392 results->resize(limit_); | 392 results->resize(limit_); |
393 } | 393 } |
OLD | NEW |