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

Side by Side Diff: components/filesystem/public/cpp/prefs/filesystem_json_pref_store.cc

Issue 2692203007: Add PrefStore::GetValues (Closed)
Patch Set: Add GetValues to FilesystemJsonPrefStore Created 3 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 "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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698