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; downloads cannot happen until after this. |
| 36 void GetNextId(HistoryService::DownloadNextIdCallback* callback); |
| 37 |
34 // Retrieves DownloadCreateInfos saved in the history. | 38 // Retrieves DownloadCreateInfos saved in the history. |
35 void Load(HistoryService::DownloadQueryCallback* callback); | 39 void Load(HistoryService::DownloadQueryCallback* callback); |
36 | 40 |
37 // Checks whether |referrer_url| has been visited before today. This takes | 41 // Checks whether |referrer_url| has been visited before today. This takes |
38 // ownership of |callback|. | 42 // ownership of |callback|. |
39 void CheckVisitedReferrerBefore(int32 download_id, | 43 void CheckVisitedReferrerBefore(int32 download_id, |
40 const GURL& referrer_url, | 44 const GURL& referrer_url, |
41 VisitedBeforeDoneCallback* callback); | 45 VisitedBeforeDoneCallback* callback); |
42 | 46 |
43 // Adds a new entry for a download to the history database. | 47 // 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 | 85 |
82 CancelableRequestConsumer history_consumer_; | 86 CancelableRequestConsumer history_consumer_; |
83 | 87 |
84 // The outstanding requests made by CheckVisitedReferrerBefore(). | 88 // The outstanding requests made by CheckVisitedReferrerBefore(). |
85 VisitedBeforeRequestsMap visited_before_requests_; | 89 VisitedBeforeRequestsMap visited_before_requests_; |
86 | 90 |
87 DISALLOW_COPY_AND_ASSIGN(DownloadHistory); | 91 DISALLOW_COPY_AND_ASSIGN(DownloadHistory); |
88 }; | 92 }; |
89 | 93 |
90 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_HISTORY_H_ | 94 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_HISTORY_H_ |
OLD | NEW |