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

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'd 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
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..183c296fcd284fed4451946e305e7bbdde65a5e9
--- /dev/null
+++ b/third_party/libaddressinput/chromium/chrome_downloader_impl.h
@@ -0,0 +1,51 @@
+// 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>
Dan Beam 2014/01/08 03:25:49 #include <string> #include "base/memory/scoped_pt
Evan Stade 2014/01/09 00:05:12 Done.
+
+#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_;
Dan Beam 2014/01/08 03:25:49 I'm surprised we don't have an all-purpose ScopedM
Evan Stade 2014/01/09 00:05:12 good thing you were sitting down when you reviewed
+
+ DISALLOW_COPY_AND_ASSIGN(ChromeDownloaderImpl);
+};
+
+#endif // THIRD_PARTY_LIBADDRESSINPUT_CHROMIUM_CHROME_DOWNLOADER_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698