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

Side by Side Diff: chrome/service/service_process_prefs.cc

Issue 2664753002: Remove base::StringValue (Closed)
Patch Set: Rebase Created 3 years, 9 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) 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> 7 #include <utility>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 22 matching lines...) Expand all
33 const base::Value* value; 33 const base::Value* value;
34 std::string result; 34 std::string result;
35 if (!prefs_->GetValue(key, &value) || !value->GetAsString(&result)) 35 if (!prefs_->GetValue(key, &value) || !value->GetAsString(&result))
36 return default_value; 36 return default_value;
37 37
38 return result; 38 return result;
39 } 39 }
40 40
41 void ServiceProcessPrefs::SetString(const std::string& key, 41 void ServiceProcessPrefs::SetString(const std::string& key,
42 const std::string& value) { 42 const std::string& value) {
43 prefs_->SetValue(key, base::MakeUnique<base::StringValue>(value), 43 prefs_->SetValue(key, base::MakeUnique<base::Value>(value),
44 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); 44 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
45 } 45 }
46 46
47 bool ServiceProcessPrefs::GetBoolean(const std::string& key, 47 bool ServiceProcessPrefs::GetBoolean(const std::string& key,
48 bool default_value) const { 48 bool default_value) const {
49 const base::Value* value; 49 const base::Value* value;
50 bool result = false; 50 bool result = false;
51 if (!prefs_->GetValue(key, &value) || !value->GetAsBoolean(&result)) 51 if (!prefs_->GetValue(key, &value) || !value->GetAsBoolean(&result))
52 return default_value; 52 return default_value;
53 53
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 98
99 void ServiceProcessPrefs::SetValue(const std::string& key, 99 void ServiceProcessPrefs::SetValue(const std::string& key,
100 std::unique_ptr<base::Value> value) { 100 std::unique_ptr<base::Value> value) {
101 prefs_->SetValue(key, std::move(value), 101 prefs_->SetValue(key, std::move(value),
102 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); 102 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
103 } 103 }
104 104
105 void ServiceProcessPrefs::RemovePref(const std::string& key) { 105 void ServiceProcessPrefs::RemovePref(const std::string& key) {
106 prefs_->RemoveValue(key, WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); 106 prefs_->RemoveValue(key, WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
107 } 107 }
OLDNEW
« no previous file with comments | « chrome/common/extensions/sync_type_unittest.cc ('k') | chrome/test/base/extension_js_browser_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698