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

Unified Diff: chrome/browser/safe_browsing/browser_feature_extractor.h

Issue 8573018: Convert to base::Callback in safe_browsing client-side-detection code. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Don't call Run() on null callbacks. Created 9 years, 1 month 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 | « no previous file | chrome/browser/safe_browsing/browser_feature_extractor.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/safe_browsing/browser_feature_extractor.h
diff --git a/chrome/browser/safe_browsing/browser_feature_extractor.h b/chrome/browser/safe_browsing/browser_feature_extractor.h
index a9469fe2b9b8200213e88fd4831ab5423a6a3493..9b6ec7274022d04f053ed871c92bc9145f7a86e8 100644
--- a/chrome/browser/safe_browsing/browser_feature_extractor.h
+++ b/chrome/browser/safe_browsing/browser_feature_extractor.h
@@ -18,7 +18,7 @@
#include <vector>
#include "base/basictypes.h"
-#include "base/callback_old.h"
+#include "base/callback.h"
#include "base/memory/scoped_ptr.h"
#include "base/task.h"
#include "base/time.h"
@@ -64,7 +64,7 @@ class BrowserFeatureExtractor {
// true iff feature extraction succeeded. The second argument is the
// phishing request which was modified by the feature extractor. The
// DoneCallback takes ownership of the request object.
- typedef Callback2<bool, ClientPhishingRequest*>::Type DoneCallback;
+ typedef base::Callback<void(bool, ClientPhishingRequest*)> DoneCallback;
// The caller keeps ownership of the tab and service objects and is
// responsible for ensuring that they stay valid for the entire
@@ -83,11 +83,11 @@ class BrowserFeatureExtractor {
// ExtractFeatures returns. This method must run on the UI thread.
virtual void ExtractFeatures(const BrowseInfo* info,
ClientPhishingRequest* request,
- DoneCallback* callback);
+ const DoneCallback& callback);
private:
friend class DeleteTask<BrowserFeatureExtractor>;
- typedef std::pair<ClientPhishingRequest*, DoneCallback*> ExtractionData;
+ typedef std::pair<ClientPhishingRequest*, DoneCallback> ExtractionData;
typedef std::map<CancelableRequestProvider::Handle,
ExtractionData> PendingQueriesMap;
@@ -97,7 +97,7 @@ class BrowserFeatureExtractor {
// Actually starts feature extraction (does the real work).
void StartExtractFeatures(ClientPhishingRequest* request,
- DoneCallback* callback);
+ const DoneCallback& callback);
// HistoryService callback which is called when we're done querying URL visits
// in the history.
@@ -133,14 +133,14 @@ class BrowserFeatureExtractor {
// query is being processed.
void StorePendingQuery(CancelableRequestProvider::Handle handle,
ClientPhishingRequest* request,
- DoneCallback* callback);
+ const DoneCallback& callback);
// Helper function which is the counterpart of StorePendingQuery. If there
// is a pending query for the given handle it will return false and set both
// the request and cb pointers. Otherwise, it will return false.
bool GetPendingQuery(CancelableRequestProvider::Handle handle,
ClientPhishingRequest** request,
- DoneCallback** callback);
+ DoneCallback* callback);
// Helper function which gets the history server if possible. If the pointer
// is set it will return true and false otherwise.
@@ -153,7 +153,7 @@ class BrowserFeatureExtractor {
// Set of pending extractions (i.e. extractions for which ExtractFeatures was
// called but not StartExtractFeatures).
- std::set<ExtractionData> pending_extractions_;
+ std::map<ClientPhishingRequest*, DoneCallback> pending_extractions_;
// Set of pending queries (i.e., where history->Query...() was called but
// the history callback hasn't been invoked yet).
@@ -161,5 +161,6 @@ class BrowserFeatureExtractor {
DISALLOW_COPY_AND_ASSIGN(BrowserFeatureExtractor);
};
+
} // namespace safe_browsing
#endif // CHROME_BROWSER_SAFE_BROWSING_BROWSER_FEATURE_EXTRACTOR_H_
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/browser_feature_extractor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698