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

Unified Diff: third_party/libaddressinput/chromium/cpp/src/retriever.cc

Issue 137563004: libaddressinput: Add fallback data for US address validation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix fmt 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/cpp/src/retriever.cc
diff --git a/third_party/libaddressinput/chromium/cpp/src/retriever.cc b/third_party/libaddressinput/chromium/cpp/src/retriever.cc
index 7dd788107efec20b5b6541b144972e9810af6689..b7c17a55e0374eebdf5c01bc29e36f4d9b98780e 100644
--- a/third_party/libaddressinput/chromium/cpp/src/retriever.cc
+++ b/third_party/libaddressinput/chromium/cpp/src/retriever.cc
@@ -26,6 +26,7 @@
#include <string>
#include <utility>
+#include "fallback_data_store.h"
#include "lookup_key_util.h"
#include "util/stl_util.h"
@@ -79,14 +80,19 @@ void Retriever::OnDataRetrievedFromStorage(bool success,
void Retriever::OnDownloaded(bool success,
const std::string& url,
- const std::string& data) {
+ const std::string& downloaded_data) {
+ std::string response;
const std::string& key = lookup_key_util_.GetKeyForUrl(url);
if (success) {
- storage_->Put(key, data);
+ storage_->Put(key, downloaded_data);
+ response = downloaded_data;
+ } else {
+ success = FallbackDataStore::Get(key, &response);
}
+
scoped_ptr<Callback> retrieved = GetCallbackForKey(key);
if (retrieved != NULL) {
- (*retrieved)(success, key, success ? data : std::string());
+ (*retrieved)(success, key, response);
}
}

Powered by Google App Engine
This is Rietveld 408576698