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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_EXTENSIONS_BLACKLIST_FETCHER_H_
6 #define CHROME_BROWSER_EXTENSIONS_BLACKLIST_FETCHER_H_
7
8 #include <set>
9 #include <string>
10
11 #include "base/callback.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "chrome/browser/extensions/blacklist.h"
14 #include "net/url_request/url_fetcher.h"
15 #include "net/url_request/url_fetcher_delegate.h"
16
17 namespace extensions {
18
19 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.
20 public:
21 BlacklistFetcher();
22
23 typedef base::Callback<void(Blacklist::BlacklistState)> RequestCallback;
24
25 virtual void Request(const std::string& id, const RequestCallback& callback);
26
27 void SetSafeBrowsingConfig(const SafeBrowsingProtocolConfig& config);
28
29 protected:
30 // net::URLFetcherDelegate interface.
31 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
32
33 private:
34 GURL RequestUrl() const;
35
36 SafeBrowsingProtocolConfig safe_browsing_config_;
37 bool safe_browsing_config_initialized_;
38
39 // ID for URLFetchers for testing.
40 int url_fetcher_id_;
41
42 // Extension id by URLFetcher.
43 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.
44
45 typedef std::multimap<std::string, RequestCallback> CallbackMultiMap;
46
47 // 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.
48 CallbackMultiMap callbacks_;
49
50 DISALLOW_COPY_AND_ASSIGN(BlacklistFetcher);
51 };
52
53 } // namespace extensions
54
55 #endif // CHROME_BROWSER_EXTENSIONS_BLACKLIST_FETCHER_H_
56
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698