Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Unified Diff: components/autofill/core/browser/validation_downloader.h

Issue 96323002: Implement i18n::addressinput::Downloader for requestAutocomplete() (and (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/autofill/core/browser/DEPS ('k') | components/autofill/core/browser/validation_downloader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_
« no previous file with comments | « components/autofill/core/browser/DEPS ('k') | components/autofill/core/browser/validation_downloader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698