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

Unified Diff: third_party/libaddressinput/chromium/chrome_downloader_impl.h

Issue 127223003: [rAc - libaddressinput] Chrome download impl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 6 years, 11 months 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 | « no previous file | third_party/libaddressinput/chromium/chrome_downloader_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/libaddressinput/chromium/chrome_downloader_impl.h
diff --git a/third_party/libaddressinput/chromium/chrome_downloader_impl.h b/third_party/libaddressinput/chromium/chrome_downloader_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..70fe16a3711f4e40dab5ce73f01d229bcd87e3d8
--- /dev/null
+++ b/third_party/libaddressinput/chromium/chrome_downloader_impl.h
@@ -0,0 +1,52 @@
+// 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 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;
+}
+
+// A class for downloading rules to let libaddressinput validate international
+// addresses.
+class ChromeDownloaderImpl : public i18n::addressinput::Downloader,
+ public net::URLFetcherDelegate {
+ public:
+ explicit ChromeDownloaderImpl(net::URLRequestContextGetter* getter);
+ virtual ~ChromeDownloaderImpl();
+
+ // i18n::addressinput::Downloader:
+ virtual void Download(const std::string& url,
+ scoped_ptr<Callback> downloaded) OVERRIDE;
+
+ // net::URLFetcherDelegate:
+ virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
+
+ private:
+ struct Request {
+ Request(const std::string& url, scoped_ptr<Callback> callback);
+
+ std::string url;
+ scoped_ptr<Callback> callback;
+ };
+
+ net::URLRequestContextGetter* const getter_; // weak
+
+ // Maps from active url fetcher to request metadata. Both the key and value
+ // are owned.
+ std::map<const net::URLFetcher*, Request*> requests_;
+
+ DISALLOW_COPY_AND_ASSIGN(ChromeDownloaderImpl);
+};
+
+#endif // THIRD_PARTY_LIBADDRESSINPUT_CHROMIUM_CHROME_DOWNLOADER_IMPL_H_
« no previous file with comments | « no previous file | third_party/libaddressinput/chromium/chrome_downloader_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698