Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5637)

Unified Diff: chrome/browser/download/download_history.h

Issue 7065015: For downloads requiring a user gesture, also require... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/download/download_create_info.cc ('k') | chrome/browser/download/download_history.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
};
« no previous file with comments | « chrome/browser/download/download_create_info.cc ('k') | chrome/browser/download/download_history.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698