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

Unified Diff: chrome/browser/extensions/blacklist_fetcher.h

Issue 49253005: Fetch extension blacklist states from SafeBrowsing server (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add unit tests, fix bugs. Created 7 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
Index: chrome/browser/extensions/blacklist_fetcher.h
diff --git a/chrome/browser/extensions/blacklist_fetcher.h b/chrome/browser/extensions/blacklist_fetcher.h
new file mode 100644
index 0000000000000000000000000000000000000000..4d489d1531d8243edd70c9e80065bfc8a8058a3f
--- /dev/null
+++ b/chrome/browser/extensions/blacklist_fetcher.h
@@ -0,0 +1,56 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_EXTENSIONS_BLACKLIST_FETCHER_H_
+#define CHROME_BROWSER_EXTENSIONS_BLACKLIST_FETCHER_H_
+
+#include <set>
+#include <string>
+
+#include "base/callback.h"
+#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/extensions/blacklist.h"
+#include "net/url_request/url_fetcher.h"
+#include "net/url_request/url_fetcher_delegate.h"
+
+namespace extensions {
+
+class BlacklistFetcher : public net::URLFetcherDelegate {
not at google - send to devlin 2013/11/18 17:03:49 comment also I made this comment earlier, but sho
Oleg Eterevsky 2013/11/20 12:58:45 Done.
+ public:
+ BlacklistFetcher();
+
+ typedef base::Callback<void(Blacklist::BlacklistState)> RequestCallback;
+
+ virtual void Request(const std::string& id, const RequestCallback& callback);
+
+ void SetSafeBrowsingConfig(const SafeBrowsingProtocolConfig& config);
+
+ protected:
+ // net::URLFetcherDelegate interface.
+ virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
+
+ private:
+ GURL RequestUrl() const;
+
+ SafeBrowsingProtocolConfig safe_browsing_config_;
+ bool safe_browsing_config_initialized_;
+
+ // ID for URLFetchers for testing.
+ int url_fetcher_id_;
+
+ // Extension id by URLFetcher.
+ std::map<const net::URLFetcher*, std::string> requests_;
not at google - send to devlin 2013/11/18 18:21:28 also, I think you need to delete all of the unreso
Oleg Eterevsky 2013/11/20 12:58:45 Done. Nice catch.
+
+ typedef std::multimap<std::string, RequestCallback> CallbackMultiMap;
+
+ // Callbacks by
not at google - send to devlin 2013/11/18 17:03:49 extension ID?
Oleg Eterevsky 2013/11/20 12:58:45 Done.
+ CallbackMultiMap callbacks_;
+
+ DISALLOW_COPY_AND_ASSIGN(BlacklistFetcher);
+};
+
+} // namespace extensions
+
+#endif // CHROME_BROWSER_EXTENSIONS_BLACKLIST_FETCHER_H_
+

Powered by Google App Engine
This is Rietveld 408576698