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

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

Issue 115523011: [rAc - libaddressinput] slay a Helper class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: assert instead 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/cpp/src/retriever.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/libaddressinput/chromium/cpp/src/retriever.h
diff --git a/third_party/libaddressinput/chromium/cpp/src/retriever.h b/third_party/libaddressinput/chromium/cpp/src/retriever.h
index 96e1b904c517f01a055d243a8c50febec5a8dfa6..003774631e7d55fa8b9310aea5c28413a78afe88 100644
--- a/third_party/libaddressinput/chromium/cpp/src/retriever.h
+++ b/third_party/libaddressinput/chromium/cpp/src/retriever.h
@@ -21,6 +21,7 @@
#include <libaddressinput/util/basictypes.h>
#include <libaddressinput/util/scoped_ptr.h>
+#include <map>
#include <string>
#include "lookup_key_util.h"
@@ -50,12 +51,28 @@ class Retriever {
// Retrieves the data for |key| and invokes the |retrieved| callback. Checks
// for the data in storage first. If storage does not have the data for |key|,
// then downloads the data and places it in storage.
- void Retrieve(const std::string& key, scoped_ptr<Callback> retrieved) const;
+ void Retrieve(const std::string& key, scoped_ptr<Callback> retrieved);
private:
+ // Callback for when a rule is retrieved from |storage_|.
+ void OnDataRetrievedFromStorage(bool success,
+ const std::string& key,
+ const std::string& data);
+
+ // Callback for when a rule is retrieved by |downloader_|.
+ void OnDownloaded(bool success,
+ const std::string& url,
+ const std::string& data);
+
+ // Looks up the callback for |key| in |requests_|, removes it from the map
+ // and returns it. Assumes that |key| is in fact in |requests_|.
+ scoped_ptr<Callback> GetCallbackForKey(const std::string& key);
+
const LookupKeyUtil lookup_key_util_;
scoped_ptr<const Downloader> downloader_;
scoped_ptr<Storage> storage_;
+ // Holds pending requests. The callback pointers are owned.
+ std::map<std::string, Callback*> requests_;
DISALLOW_COPY_AND_ASSIGN(Retriever);
};
« no previous file with comments | « no previous file | third_party/libaddressinput/chromium/cpp/src/retriever.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698