#ifndef THIRD_PARTY_LIBADDRESSINPUT_CHROMIUM_CHROME_DOWNLOADER_IMPL_H_
#define THIRD_PARTY_LIBADDRESSINPUT_CHROMIUM_CHROME_DOWNLOADER_IMPL_H_
#include <map>
#include <string>
#include "base/memory/scoped_vector.h"
#include "net/url_request/url_fetcher_delegate.h"
#include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/downloader.h"
namespace net {
class URLFetcher;
class URLRequestContextGetter;
}
namespace autofill {
class ChromeDownloaderImpl : public ::i18n::addressinput::Downloader,
public net::URLFetcherDelegate {
public:
explicit ChromeDownloaderImpl(net::URLRequestContextGetter* getter);
virtual ~ChromeDownloaderImpl();
virtual void Download(const std::string& url,
scoped_ptr<Callback> downloaded) OVERRIDE;
virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
private:
struct Request {
Request(const std::string& url,
scoped_ptr<net::URLFetcher> fetcher,
scoped_ptr<Callback> callback);
std::string url;
std::string data;
scoped_ptr<net::URLFetcher> fetcher;
scoped_ptr<Callback> callback;
};
net::URLRequestContextGetter* const getter_;
std::map<const net::URLFetcher*, Request*> requests_;
DISALLOW_COPY_AND_ASSIGN(ChromeDownloaderImpl);
};
}
#endif