Chromium Code Reviews| 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_ | |
|
mattm
2013/11/25 21:48:55
kinda seems like the fetcher should live in the sa
Oleg Eterevsky
2013/11/27 14:07:38
I thought about it and it seems strange to have bl
mattm
2013/12/03 02:55:45
Well, it's also weird that BlacklistStateFetcher d
| |
| 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" | |
|
mattm
2013/12/03 02:55:45
This is just for BlacklistState? This is somewhat
Oleg Eterevsky
2013/12/04 10:45:11
As I said, I don't like the idea of some arbitrary
mattm
2013/12/10 11:09:40
I guess either is fine.
Oleg Eterevsky
2013/12/10 17:10:44
Done.
| |
| 14 #include "net/url_request/url_fetcher.h" | |
| 15 #include "net/url_request/url_fetcher_delegate.h" | |
| 16 | |
| 17 namespace extensions { | |
| 18 | |
| 19 class BlacklistStateFetcher : public net::URLFetcherDelegate { | |
| 20 public: | |
| 21 BlacklistStateFetcher(); | |
| 22 | |
| 23 ~BlacklistStateFetcher(); | |
| 24 | |
| 25 typedef base::Callback<void(Blacklist::BlacklistState)> RequestCallback; | |
| 26 | |
| 27 virtual void Request(const std::string& id, const RequestCallback& callback); | |
| 28 | |
| 29 void SetSafeBrowsingConfig(const SafeBrowsingProtocolConfig& config); | |
|
mattm
2013/11/25 21:48:55
Seems cleaner to just pass the config into the con
Oleg Eterevsky
2013/11/27 14:07:38
The config is either passed here (usually in case
mattm
2013/12/03 02:55:45
Right, but with the constructor the unittests can
Oleg Eterevsky
2013/12/04 10:45:11
Ok, makes sense, in case this moves to SafeBrowsin
| |
| 30 | |
| 31 protected: | |
| 32 // net::URLFetcherDelegate interface. | |
| 33 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; | |
| 34 | |
| 35 private: | |
| 36 GURL RequestUrl() const; | |
| 37 | |
| 38 SafeBrowsingProtocolConfig safe_browsing_config_; | |
| 39 bool safe_browsing_config_initialized_; | |
| 40 | |
| 41 // ID for URLFetchers for testing. | |
| 42 int url_fetcher_id_; | |
| 43 | |
| 44 // Extension id by URLFetcher. | |
| 45 std::map<const net::URLFetcher*, std::string> requests_; | |
| 46 | |
| 47 typedef std::multimap<std::string, RequestCallback> CallbackMultiMap; | |
| 48 | |
| 49 // Callbacks by extension ID. | |
| 50 CallbackMultiMap callbacks_; | |
| 51 | |
| 52 DISALLOW_COPY_AND_ASSIGN(BlacklistStateFetcher); | |
| 53 }; | |
| 54 | |
| 55 } // namespace extensions | |
| 56 | |
| 57 #endif // CHROME_BROWSER_EXTENSIONS_BLACKLIST_STATE_FETCHER_H_ | |
| 58 | |
| OLD | NEW |