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 "components/filesystem/public/cpp/prefs/filesystem_json_pref_store.h" | 5 #include "components/filesystem/public/cpp/prefs/filesystem_json_pref_store.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <utility> | 10 #include <utility> |
(...skipping 30 matching lines...) Expand all Loading... |
41 }; | 41 }; |
42 | 42 |
43 FilesystemJsonPrefStore::ReadResult::ReadResult() | 43 FilesystemJsonPrefStore::ReadResult::ReadResult() |
44 : error(PersistentPrefStore::PREF_READ_ERROR_NONE) {} | 44 : error(PersistentPrefStore::PREF_READ_ERROR_NONE) {} |
45 | 45 |
46 FilesystemJsonPrefStore::ReadResult::~ReadResult() {} | 46 FilesystemJsonPrefStore::ReadResult::~ReadResult() {} |
47 | 47 |
48 namespace { | 48 namespace { |
49 | 49 |
50 PersistentPrefStore::PrefReadError HandleReadErrors(const base::Value* value) { | 50 PersistentPrefStore::PrefReadError HandleReadErrors(const base::Value* value) { |
51 if (!value->IsType(base::Value::TYPE_DICTIONARY)) | 51 if (!value->IsType(base::Value::Type::DICTIONARY)) |
52 return PersistentPrefStore::PREF_READ_ERROR_JSON_TYPE; | 52 return PersistentPrefStore::PREF_READ_ERROR_JSON_TYPE; |
53 return PersistentPrefStore::PREF_READ_ERROR_NONE; | 53 return PersistentPrefStore::PREF_READ_ERROR_NONE; |
54 } | 54 } |
55 | 55 |
56 } // namespace | 56 } // namespace |
57 | 57 |
58 FilesystemJsonPrefStore::FilesystemJsonPrefStore( | 58 FilesystemJsonPrefStore::FilesystemJsonPrefStore( |
59 const std::string& pref_filename, | 59 const std::string& pref_filename, |
60 filesystem::mojom::FileSystemPtr filesystem, | 60 filesystem::mojom::FileSystemPtr filesystem, |
61 std::unique_ptr<PrefFilter> pref_filter) | 61 std::unique_ptr<PrefFilter> pref_filter) |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 reinterpret_cast<char*>(&contents.front()), contents.size())); | 416 reinterpret_cast<char*>(&contents.front()), contents.size())); |
417 read_result->value = deserializer.Deserialize(&error_code, &error_msg); | 417 read_result->value = deserializer.Deserialize(&error_code, &error_msg); |
418 read_result->error = HandleReadErrors(read_result->value.get()); | 418 read_result->error = HandleReadErrors(read_result->value.get()); |
419 } | 419 } |
420 } | 420 } |
421 | 421 |
422 OnFileRead(std::move(read_result)); | 422 OnFileRead(std::move(read_result)); |
423 } | 423 } |
424 | 424 |
425 } // namespace filesystem | 425 } // namespace filesystem |
OLD | NEW |