OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/service/service_process_prefs.h" | 5 #include "chrome/service/service_process_prefs.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/prefs/pref_filter.h" | 9 #include "base/prefs/pref_filter.h" |
8 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
9 #include "base/values.h" | 11 #include "base/values.h" |
10 | 12 |
11 ServiceProcessPrefs::ServiceProcessPrefs( | 13 ServiceProcessPrefs::ServiceProcessPrefs( |
12 const base::FilePath& pref_filename, | 14 const base::FilePath& pref_filename, |
13 base::SequencedTaskRunner* task_runner) | 15 base::SequencedTaskRunner* task_runner) |
14 : prefs_(new JsonPrefStore(pref_filename, | 16 : prefs_(new JsonPrefStore(pref_filename, |
15 task_runner, | 17 task_runner, |
16 scoped_ptr<PrefFilter>())) { | 18 scoped_ptr<PrefFilter>())) { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 const std::string& key) const { | 90 const std::string& key) const { |
89 const base::Value* value; | 91 const base::Value* value; |
90 if (!prefs_->GetValue(key, &value) || !value->IsType(base::Value::TYPE_LIST)) | 92 if (!prefs_->GetValue(key, &value) || !value->IsType(base::Value::TYPE_LIST)) |
91 return NULL; | 93 return NULL; |
92 | 94 |
93 return static_cast<const base::ListValue*>(value); | 95 return static_cast<const base::ListValue*>(value); |
94 } | 96 } |
95 | 97 |
96 void ServiceProcessPrefs::SetValue(const std::string& key, | 98 void ServiceProcessPrefs::SetValue(const std::string& key, |
97 scoped_ptr<base::Value> value) { | 99 scoped_ptr<base::Value> value) { |
98 prefs_->SetValue(key, value.Pass(), | 100 prefs_->SetValue(key, std::move(value), |
99 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); | 101 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); |
100 } | 102 } |
101 | 103 |
102 void ServiceProcessPrefs::RemovePref(const std::string& key) { | 104 void ServiceProcessPrefs::RemovePref(const std::string& key) { |
103 prefs_->RemoveValue(key, WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); | 105 prefs_->RemoveValue(key, WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); |
104 } | 106 } |
105 | 107 |
OLD | NEW |