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

Side by Side Diff: chrome/browser/extensions/blacklist_state_fetcher.h

Issue 49253005: Fetch extension blacklist states from SafeBrowsing server (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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_STATE_FETCHER_H_
6 #define CHROME_BROWSER_EXTENSIONS_BLACKLIST_STATE_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_state.h"
14 #include "chrome/browser/safe_browsing/protocol_manager_helper.h"
15 #include "net/url_request/url_fetcher.h"
16 #include "net/url_request/url_fetcher_delegate.h"
17
18 namespace extensions {
19
20 class BlacklistStateFetcher : public net::URLFetcherDelegate {
21 public:
22 BlacklistStateFetcher();
23
24 virtual ~BlacklistStateFetcher();
25
26 typedef base::Callback<void(BlacklistState)> RequestCallback;
27
28 virtual void Request(const std::string& id, const RequestCallback& callback);
29
30 void SetSafeBrowsingConfig(const SafeBrowsingProtocolConfig& config);
31
32 protected:
33 // net::URLFetcherDelegate interface.
34 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
35
36 private:
37 GURL RequestUrl() const;
38
39 SafeBrowsingProtocolConfig safe_browsing_config_;
40 bool safe_browsing_config_initialized_;
41
42 // ID for URLFetchers for testing.
43 int url_fetcher_id_;
44
45 // Extension id by URLFetcher.
46 std::map<const net::URLFetcher*, std::string> requests_;
47
48 typedef std::multimap<std::string, RequestCallback> CallbackMultiMap;
49
50 // Callbacks by extension ID.
51 CallbackMultiMap callbacks_;
52
53 DISALLOW_COPY_AND_ASSIGN(BlacklistStateFetcher);
54 };
55
56 } // namespace extensions
57
58 #endif // CHROME_BROWSER_EXTENSIONS_BLACKLIST_STATE_FETCHER_H_
59
OLDNEW
« no previous file with comments | « chrome/browser/extensions/blacklist_state.h ('k') | chrome/browser/extensions/blacklist_state_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698