Index: chrome/browser/download/download_history.h |
=================================================================== |
--- chrome/browser/download/download_history.h (revision 86341) |
+++ chrome/browser/download/download_history.h (working copy) |
@@ -6,6 +6,8 @@ |
#define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_HISTORY_H_ |
#pragma once |
+#include <map> |
+ |
#include "base/basictypes.h" |
#include "chrome/browser/history/history.h" |
#include "content/browser/cancelable_request.h" |
@@ -20,6 +22,8 @@ |
// Interacts with the HistoryService on behalf of the download subsystem. |
class DownloadHistory { |
public: |
+ typedef Callback2<int32, bool>::Type VisitedBeforeDoneCallback; |
+ |
// A fake download table ID which represents a download that has started, |
// but is not yet in the table. |
static const int kUninitializedHandle; |
@@ -30,6 +34,11 @@ |
// Retrieves DownloadCreateInfos saved in the history. |
void Load(HistoryService::DownloadQueryCallback* callback); |
+ // Checks whether |referrer_url| has been visited before today. |
+ void CheckVisitedReferrerBefore(int32 download_id, |
+ const GURL& referrer_url, |
+ VisitedBeforeDoneCallback* callback); |
+ |
// Adds a new entry for a download to the history database. |
void AddEntry(DownloadItem* download_item, |
HistoryService::DownloadCreateCallback* callback); |
@@ -52,6 +61,15 @@ |
int64 GetNextFakeDbHandle(); |
private: |
+ typedef std::map<HistoryService::Handle, |
+ std::pair<int32, VisitedBeforeDoneCallback*> > |
+ VisitedBeforeRequestsMap; |
+ |
+ void OnGotVisitCountToHost(HistoryService::Handle handle, |
+ bool found_visits, |
+ int count, |
+ base::Time first_visit); |
+ |
Profile* profile_; |
// In case we don't have a valid db_handle, we use |fake_db_handle_| instead. |
@@ -62,6 +80,9 @@ |
CancelableRequestConsumer history_consumer_; |
+ // The outstanding requests made by CheckVisitedReferrerBefore(). |
+ VisitedBeforeRequestsMap visited_before_requests_; |
+ |
DISALLOW_COPY_AND_ASSIGN(DownloadHistory); |
}; |