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

Side by Side Diff: chrome/browser/drive/fake_drive_service.cc

Issue 925783002: Split ValueSerializer into separate Serializer and Deserializer classes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated as per review comment. Created 5 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/drive/fake_drive_service.h" 5 #include "chrome/browser/drive/fake_drive_service.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/json/json_string_value_serializer.h" 10 #include "base/json/json_string_value_serializer.h"
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 } 273 }
274 274
275 std::string app_json = app_json_template_; 275 std::string app_json = app_json_template_;
276 ReplaceSubstringsAfterOffset(&app_json, 0, "$AppId", app_id); 276 ReplaceSubstringsAfterOffset(&app_json, 0, "$AppId", app_id);
277 ReplaceSubstringsAfterOffset(&app_json, 0, "$AppName", app_name); 277 ReplaceSubstringsAfterOffset(&app_json, 0, "$AppName", app_name);
278 ReplaceSubstringsAfterOffset(&app_json, 0, "$ProductId", product_id); 278 ReplaceSubstringsAfterOffset(&app_json, 0, "$ProductId", product_id);
279 ReplaceSubstringsAfterOffset(&app_json, 0, "$CreateUrl", create_url); 279 ReplaceSubstringsAfterOffset(&app_json, 0, "$CreateUrl", create_url);
280 ReplaceSubstringsAfterOffset( 280 ReplaceSubstringsAfterOffset(
281 &app_json, 0, "$Removable", is_removable ? "true" : "false"); 281 &app_json, 0, "$Removable", is_removable ? "true" : "false");
282 282
283 JSONStringValueSerializer json(app_json); 283 JSONStringValueDeserializer json(app_json);
284 std::string error_message; 284 std::string error_message;
285 scoped_ptr<base::Value> value(json.Deserialize(NULL, &error_message)); 285 scoped_ptr<base::Value> value(json.Deserialize(NULL, &error_message));
286 CHECK_EQ(base::Value::TYPE_DICTIONARY, value->GetType()); 286 CHECK_EQ(base::Value::TYPE_DICTIONARY, value->GetType());
287 287
288 base::ListValue* item_list; 288 base::ListValue* item_list;
289 CHECK(app_info_value_->GetListWithoutPathExpansion("items", &item_list)); 289 CHECK(app_info_value_->GetListWithoutPathExpansion("items", &item_list));
290 item_list->Append(value.release()); 290 item_list->Append(value.release());
291 } 291 }
292 292
293 void FakeDriveService::RemoveAppByProductId(const std::string& product_id) { 293 void FakeDriveService::RemoveAppByProductId(const std::string& product_id) {
(...skipping 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after
1769 1769
1770 NOTREACHED(); 1770 NOTREACHED();
1771 return CancelCallback(); 1771 return CancelCallback();
1772 } 1772 }
1773 1773
1774 void FakeDriveService::NotifyObservers() { 1774 void FakeDriveService::NotifyObservers() {
1775 FOR_EACH_OBSERVER(ChangeObserver, change_observers_, OnNewChangeAvailable()); 1775 FOR_EACH_OBSERVER(ChangeObserver, change_observers_, OnNewChangeAvailable());
1776 } 1776 }
1777 1777
1778 } // namespace drive 1778 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698