| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "base/strings/string_split.h" | 24 #include "base/strings/string_split.h" |
| 25 #include "base/strings/stringprintf.h" | 25 #include "base/strings/stringprintf.h" |
| 26 #include "base/strings/utf_string_conversions.h" | 26 #include "base/strings/utf_string_conversions.h" |
| 27 #include "base/time/time.h" | 27 #include "base/time/time.h" |
| 28 #include "base/values.h" | 28 #include "base/values.h" |
| 29 #include "chrome/browser/profiles/profile.h" | 29 #include "chrome/browser/profiles/profile.h" |
| 30 #include "chrome/common/pref_names.h" | 30 #include "chrome/common/pref_names.h" |
| 31 #include "components/url_formatter/url_formatter.h" | 31 #include "components/url_formatter/url_formatter.h" |
| 32 #include "content/public/browser/content_browser_client.h" | 32 #include "content/public/browser/content_browser_client.h" |
| 33 #include "content/public/browser/download_item.h" | 33 #include "content/public/browser/download_item.h" |
| 34 #include "third_party/re2/re2/re2.h" | 34 #include "third_party/re2/src/re2/re2.h" |
| 35 #include "url/gurl.h" | 35 #include "url/gurl.h" |
| 36 | 36 |
| 37 using content::DownloadDangerType; | 37 using content::DownloadDangerType; |
| 38 using content::DownloadItem; | 38 using content::DownloadItem; |
| 39 | 39 |
| 40 namespace { | 40 namespace { |
| 41 | 41 |
| 42 // Templatized base::Value::GetAs*(). | 42 // Templatized base::Value::GetAs*(). |
| 43 template <typename T> bool GetAs(const base::Value& in, T* out); | 43 template <typename T> bool GetAs(const base::Value& in, T* out); |
| 44 template<> bool GetAs(const base::Value& in, bool* out) { | 44 template<> bool GetAs(const base::Value& in, bool* out) { |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 results->begin() + std::min(limit_ + skip_, results->size()), | 446 results->begin() + std::min(limit_ + skip_, results->size()), |
| 447 results->end(), | 447 results->end(), |
| 448 DownloadComparator(sorters_)); | 448 DownloadComparator(sorters_)); |
| 449 } | 449 } |
| 450 | 450 |
| 451 results->erase(results->begin(), results->begin() + skip_); | 451 results->erase(results->begin(), results->begin() + skip_); |
| 452 | 452 |
| 453 if (results->size() > limit_) | 453 if (results->size() > limit_) |
| 454 results->resize(limit_); | 454 results->resize(limit_); |
| 455 } | 455 } |
| OLD | NEW |