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

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

Issue 7408001: If we show a SafeBrowsing warning we always send the client-side detection (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Merge Created 9 years, 5 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
Index: chrome/browser/safe_browsing/safe_browsing_service.h
diff --git a/chrome/browser/safe_browsing/safe_browsing_service.h b/chrome/browser/safe_browsing/safe_browsing_service.h
index f9b2c6cbfaf34b1a7284470fbcb3e1b68758b571..6dbcdc0b638e804e6636fd2c4e601c155bb73ca8 100644
--- a/chrome/browser/safe_browsing/safe_browsing_service.h
+++ b/chrome/browser/safe_browsing/safe_browsing_service.h
@@ -18,6 +18,7 @@
#include "base/hash_tables.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
+#include "base/observer_list.h"
#include "base/synchronization/lock.h"
#include "base/task.h"
#include "base/time.h"
@@ -106,6 +107,22 @@ class SafeBrowsingService
DISALLOW_COPY_AND_ASSIGN(SafeBrowsingCheck);
};
+ // Observer class can be used to get notified when a SafeBrowsing hit
+ // was found.
+ class Observer {
+ public:
+ // The |resource| must not be accessed after OnSafeBrowsingHit returns.
+ // This method will be called on the UI thread.
+ virtual void OnSafeBrowsingHit(const UnsafeResource& resource) = 0;
+
+ protected:
+ Observer() {}
+ virtual ~Observer() {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(Observer);
+ };
+
class Client {
public:
virtual ~Client() {}
@@ -130,7 +147,6 @@ class SafeBrowsingService
UrlCheckResult result) {}
};
-
// Makes the passed |factory| the factory used to instanciate
// a SafeBrowsingService. Useful for tests.
static void RegisterFactory(SafeBrowsingServiceFactory* factory) {
@@ -261,6 +277,10 @@ class SafeBrowsingService
UrlCheckResult threat_type,
const std::string& post_data);
+ // Add and remove observers. These methods must be invoked on the UI thread.
+ void AddObserver(Observer* observer);
+ void RemoveObserver(Observer* remove);
+
protected:
// Creates the safe browsing service. Need to initialize before using.
SafeBrowsingService();
@@ -489,6 +509,8 @@ class SafeBrowsingService
// Similar to |download_urlcheck_timeout_ms_|, but for download hash checks.
int64 download_hashcheck_timeout_ms_;
+ ObserverList<Observer> observer_list_;
+
// Used to track purge memory notifications. Lives on the IO thread.
NotificationRegistrar registrar_;
« no previous file with comments | « chrome/browser/safe_browsing/client_side_detection_service.cc ('k') | chrome/browser/safe_browsing/safe_browsing_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698