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); |
} |
} |