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 COMPONENTS_AUTOFILL_CORE_BROWSER_VALIDATION_DOWNLOADER_H_ |
| 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_VALIDATION_DOWNLOADER_H_ |
| 7 |
| 8 #include <map> |
| 9 |
| 10 #include "base/memory/scoped_vector.h" |
| 11 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/downloader
.h" |
| 12 |
| 13 namespace net { |
| 14 class URLFetcher; |
| 15 class URLRequestContextGetter; |
| 16 } |
| 17 |
| 18 namespace autofill { |
| 19 |
| 20 // A class for downloading rules to let libaddressinput validate international |
| 21 // addresses. |
| 22 class ValidationDownloader : public i18n::addressinput::Downloader { |
| 23 public: |
| 24 explicit ValidationDownloader(net::URLRequestContextGetter* getter); |
| 25 virtual ~ValidationDownloader(); |
| 26 |
| 27 // i18n::addressinput::Downloader: |
| 28 virtual void Download( |
| 29 const std::string& url, |
| 30 const i18n::addressinput::Downloader::Callback& downloaded) OVERRIDE; |
| 31 |
| 32 private: |
| 33 // Needed to create a net::URLFetcher. Weak, not owned. |
| 34 net::URLRequestContextGetter* const getter_; |
| 35 |
| 36 // All created fetchers; owned by this class and deleted upon destruction. |
| 37 ScopedVector<net::URLFetcher> fetchers_; |
| 38 |
| 39 // A map to trigger a callback when a fetcher completes. |
| 40 typedef std::map<net::URLFetcher*, i18n::addressinput::Downloader::Callback> |
| 41 CallbackMap; |
| 42 CallbackMap callbacks_; |
| 43 |
| 44 DISALLOW_COPY_AND_ASSIGN(ValidationDownloader); |
| 45 }; |
| 46 |
| 47 } // namespace autofill |
| 48 |
| 49 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_VALIDATION_DOWNLOADER_H_ |
OLD | NEW |