| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 | 77 |
| 78 base::Value* tmp = nullptr; | 78 base::Value* tmp = nullptr; |
| 79 if (!prefs_->Get(key, &tmp)) | 79 if (!prefs_->Get(key, &tmp)) |
| 80 return false; | 80 return false; |
| 81 | 81 |
| 82 if (result) | 82 if (result) |
| 83 *result = tmp; | 83 *result = tmp; |
| 84 return true; | 84 return true; |
| 85 } | 85 } |
| 86 | 86 |
| 87 std::unique_ptr<base::DictionaryValue> FilesystemJsonPrefStore::GetValues() |
| 88 const { |
| 89 return prefs_->CreateDeepCopy(); |
| 90 } |
| 91 |
| 87 void FilesystemJsonPrefStore::AddObserver(PrefStore::Observer* observer) { | 92 void FilesystemJsonPrefStore::AddObserver(PrefStore::Observer* observer) { |
| 88 DCHECK(CalledOnValidThread()); | 93 DCHECK(CalledOnValidThread()); |
| 89 | 94 |
| 90 observers_.AddObserver(observer); | 95 observers_.AddObserver(observer); |
| 91 } | 96 } |
| 92 | 97 |
| 93 void FilesystemJsonPrefStore::RemoveObserver(PrefStore::Observer* observer) { | 98 void FilesystemJsonPrefStore::RemoveObserver(PrefStore::Observer* observer) { |
| 94 DCHECK(CalledOnValidThread()); | 99 DCHECK(CalledOnValidThread()); |
| 95 | 100 |
| 96 observers_.RemoveObserver(observer); | 101 observers_.RemoveObserver(observer); |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 reinterpret_cast<char*>(&contents.front()), contents.size())); | 419 reinterpret_cast<char*>(&contents.front()), contents.size())); |
| 415 read_result->value = deserializer.Deserialize(&error_code, &error_msg); | 420 read_result->value = deserializer.Deserialize(&error_code, &error_msg); |
| 416 read_result->error = HandleReadErrors(read_result->value.get()); | 421 read_result->error = HandleReadErrors(read_result->value.get()); |
| 417 } | 422 } |
| 418 } | 423 } |
| 419 | 424 |
| 420 OnFileRead(std::move(read_result)); | 425 OnFileRead(std::move(read_result)); |
| 421 } | 426 } |
| 422 | 427 |
| 423 } // namespace filesystem | 428 } // namespace filesystem |
| OLD | NEW |