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

Unified Diff: third_party/libaddressinput/chromium/json.cc

Issue 140823005: [rac] Download country code data in a single HTTP request. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Temporarily switch to staging URL. 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/json.cc
diff --git a/third_party/libaddressinput/chromium/json.cc b/third_party/libaddressinput/chromium/json.cc
index 4a0fcd5b6e1dfe950925a6dfdafa84b656ebc5aa..37a1b77c64342ae4b5a5899d31c45f960efd07ac 100644
--- a/third_party/libaddressinput/chromium/json.cc
+++ b/third_party/libaddressinput/chromium/json.cc
@@ -35,10 +35,29 @@ class ChromeJson : public Json {
virtual bool GetStringValueForKey(const std::string& key, std::string* value)
const OVERRIDE {
+ DCHECK(dict_);
return dict_->GetStringWithoutPathExpansion(key, value);
}
+ virtual bool GetJsonValueForKey(const std::string& key,
+ scoped_ptr<Json>* value) const OVERRIDE {
+ DCHECK(dict_);
+ base::DictionaryValue* sub_dict = NULL; // Owned by |dict_|.
+ if (!dict_->GetDictionaryWithoutPathExpansion(key, &sub_dict) || !sub_dict)
+ return false;
+
+ if (value) {
+ value->reset(new ChromeJson(
+ scoped_ptr<base::DictionaryValue>(sub_dict->DeepCopy())));
+ }
+
+ return true;
+ }
+
private:
+ explicit ChromeJson(scoped_ptr<base::DictionaryValue> dict)
+ : dict_(dict.Pass()) {}
+
scoped_ptr<base::DictionaryValue> dict_;
DISALLOW_COPY_AND_ASSIGN(ChromeJson);
« no previous file with comments | « third_party/libaddressinput/chromium/cpp/test/util/json_test.cc ('k') | third_party/libaddressinput/libaddressinput.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698