| Index: components/autofill/core/browser/validation_downloader.h
|
| diff --git a/components/autofill/core/browser/validation_downloader.h b/components/autofill/core/browser/validation_downloader.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..77fc8923967da48a547ca6216f81757f3dd5a6d7
|
| --- /dev/null
|
| +++ b/components/autofill/core/browser/validation_downloader.h
|
| @@ -0,0 +1,49 @@
|
| +// Copyright 2013 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_VALIDATION_DOWNLOADER_H_
|
| +#define COMPONENTS_AUTOFILL_CORE_BROWSER_VALIDATION_DOWNLOADER_H_
|
| +
|
| +#include <map>
|
| +
|
| +#include "base/memory/scoped_vector.h"
|
| +#include "third_party/libaddressinput/src/cpp/include/libaddressinput/downloader.h"
|
| +
|
| +namespace net {
|
| +class URLFetcher;
|
| +class URLRequestContextGetter;
|
| +}
|
| +
|
| +namespace autofill {
|
| +
|
| +// A class for downloading rules to let libaddressinput validate international
|
| +// addresses.
|
| +class ValidationDownloader : public i18n::addressinput::Downloader {
|
| + public:
|
| + explicit ValidationDownloader(net::URLRequestContextGetter* getter);
|
| + virtual ~ValidationDownloader();
|
| +
|
| + // i18n::addressinput::Downloader:
|
| + virtual void Download(
|
| + const std::string& url,
|
| + const i18n::addressinput::Downloader::Callback& downloaded) OVERRIDE;
|
| +
|
| + private:
|
| + // Needed to create a net::URLFetcher. Weak, not owned.
|
| + net::URLRequestContextGetter* const getter_;
|
| +
|
| + // All created fetchers; owned by this class and deleted upon destruction.
|
| + ScopedVector<net::URLFetcher> fetchers_;
|
| +
|
| + // A map to trigger a callback when a fetcher completes.
|
| + typedef std::map<net::URLFetcher*, i18n::addressinput::Downloader::Callback>
|
| + CallbackMap;
|
| + CallbackMap callbacks_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(ValidationDownloader);
|
| +};
|
| +
|
| +} // namespace autofill
|
| +
|
| +#endif // COMPONENTS_AUTOFILL_CORE_BROWSER_VALIDATION_DOWNLOADER_H_
|
|
|