OLD | NEW |
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 Loading... |
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 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1770 | 1770 |
1771 NOTREACHED(); | 1771 NOTREACHED(); |
1772 return CancelCallback(); | 1772 return CancelCallback(); |
1773 } | 1773 } |
1774 | 1774 |
1775 void FakeDriveService::NotifyObservers() { | 1775 void FakeDriveService::NotifyObservers() { |
1776 FOR_EACH_OBSERVER(ChangeObserver, change_observers_, OnNewChangeAvailable()); | 1776 FOR_EACH_OBSERVER(ChangeObserver, change_observers_, OnNewChangeAvailable()); |
1777 } | 1777 } |
1778 | 1778 |
1779 } // namespace drive | 1779 } // namespace drive |
OLD | NEW |