OLD | NEW |
---|---|
(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 "chrome/common/safe_browsing/crx_info.pb.h" | |
mattm
2013/12/10 22:58:50
Does this need to be in the header now?
Oleg Eterevsky
2013/12/11 13:02:54
Done.
| |
16 #include "net/url_request/url_fetcher.h" | |
17 #include "net/url_request/url_fetcher_delegate.h" | |
18 | |
19 namespace extensions { | |
20 | |
21 class BlacklistStateFetcher : public net::URLFetcherDelegate { | |
22 public: | |
23 BlacklistStateFetcher(); | |
24 | |
25 ~BlacklistStateFetcher(); | |
26 | |
27 typedef base::Callback<void(BlacklistState)> RequestCallback; | |
28 | |
29 virtual void Request(const std::string& id, const RequestCallback& callback); | |
30 | |
31 void SetSafeBrowsingConfig(const SafeBrowsingProtocolConfig& config); | |
32 | |
33 protected: | |
34 // net::URLFetcherDelegate interface. | |
35 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; | |
36 | |
37 private: | |
38 GURL RequestUrl() const; | |
39 | |
40 SafeBrowsingProtocolConfig safe_browsing_config_; | |
41 bool safe_browsing_config_initialized_; | |
42 | |
43 // ID for URLFetchers for testing. | |
44 int url_fetcher_id_; | |
45 | |
46 // Extension id by URLFetcher. | |
47 std::map<const net::URLFetcher*, std::string> requests_; | |
48 | |
49 typedef std::multimap<std::string, RequestCallback> CallbackMultiMap; | |
50 | |
51 // Callbacks by extension ID. | |
52 CallbackMultiMap callbacks_; | |
53 | |
54 DISALLOW_COPY_AND_ASSIGN(BlacklistStateFetcher); | |
55 }; | |
56 | |
57 } // namespace extensions | |
58 | |
59 #endif // CHROME_BROWSER_EXTENSIONS_BLACKLIST_STATE_FETCHER_H_ | |
60 | |
OLD | NEW |