| 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 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_HISTORY_H_ | 5 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_HISTORY_H_ |
| 6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_HISTORY_H_ | 6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_HISTORY_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 public: | 24 public: |
| 25 typedef Callback2<int32, bool>::Type VisitedBeforeDoneCallback; | 25 typedef Callback2<int32, bool>::Type VisitedBeforeDoneCallback; |
| 26 | 26 |
| 27 // A fake download table ID which represents a download that has started, | 27 // A fake download table ID which represents a download that has started, |
| 28 // but is not yet in the table. | 28 // but is not yet in the table. |
| 29 static const int kUninitializedHandle; | 29 static const int kUninitializedHandle; |
| 30 | 30 |
| 31 explicit DownloadHistory(Profile* profile); | 31 explicit DownloadHistory(Profile* profile); |
| 32 ~DownloadHistory(); | 32 ~DownloadHistory(); |
| 33 | 33 |
| 34 // Retrieves the next_id counter from the sql meta_table. |
| 35 // Should be much faster than Load so that we may delay downloads until after |
| 36 // this call with minimal performance penalty. |
| 37 void GetNextId(HistoryService::DownloadNextIdCallback* callback); |
| 38 |
| 34 // Retrieves DownloadCreateInfos saved in the history. | 39 // Retrieves DownloadCreateInfos saved in the history. |
| 35 void Load(HistoryService::DownloadQueryCallback* callback); | 40 void Load(HistoryService::DownloadQueryCallback* callback); |
| 36 | 41 |
| 37 // Checks whether |referrer_url| has been visited before today. This takes | 42 // Checks whether |referrer_url| has been visited before today. This takes |
| 38 // ownership of |callback|. | 43 // ownership of |callback|. |
| 39 void CheckVisitedReferrerBefore(int32 download_id, | 44 void CheckVisitedReferrerBefore(int32 download_id, |
| 40 const GURL& referrer_url, | 45 const GURL& referrer_url, |
| 41 VisitedBeforeDoneCallback* callback); | 46 VisitedBeforeDoneCallback* callback); |
| 42 | 47 |
| 43 // Adds a new entry for a download to the history database. | 48 // Adds a new entry for a download to the history database. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 86 |
| 82 CancelableRequestConsumer history_consumer_; | 87 CancelableRequestConsumer history_consumer_; |
| 83 | 88 |
| 84 // The outstanding requests made by CheckVisitedReferrerBefore(). | 89 // The outstanding requests made by CheckVisitedReferrerBefore(). |
| 85 VisitedBeforeRequestsMap visited_before_requests_; | 90 VisitedBeforeRequestsMap visited_before_requests_; |
| 86 | 91 |
| 87 DISALLOW_COPY_AND_ASSIGN(DownloadHistory); | 92 DISALLOW_COPY_AND_ASSIGN(DownloadHistory); |
| 88 }; | 93 }; |
| 89 | 94 |
| 90 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_HISTORY_H_ | 95 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_HISTORY_H_ |
| OLD | NEW |