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

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

Issue 2476493003: Remove FundamentalValue
Patch Set: Fix Created 4 years, 1 month 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
54 return result; 54 return result;
55 } 55 }
56 56
57 void ServiceProcessPrefs::SetBoolean(const std::string& key, bool value) { 57 void ServiceProcessPrefs::SetBoolean(const std::string& key, bool value) {
58 prefs_->SetValue(key, base::MakeUnique<base::FundamentalValue>(value), 58 prefs_->SetValue(key, base::MakeUnique<base::Value>(value),
59 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); 59 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
60 } 60 }
61 61
62 int ServiceProcessPrefs::GetInt(const std::string& key, 62 int ServiceProcessPrefs::GetInt(const std::string& key,
63 int default_value) const { 63 int default_value) const {
64 const base::Value* value; 64 const base::Value* value;
65 int result = default_value; 65 int result = default_value;
66 if (!prefs_->GetValue(key, &value) || !value->GetAsInteger(&result)) 66 if (!prefs_->GetValue(key, &value) || !value->GetAsInteger(&result))
67 return default_value; 67 return default_value;
68 68
69 return result; 69 return result;
70 } 70 }
71 71
72 void ServiceProcessPrefs::SetInt(const std::string& key, int value) { 72 void ServiceProcessPrefs::SetInt(const std::string& key, int value) {
73 prefs_->SetValue(key, base::MakeUnique<base::FundamentalValue>(value), 73 prefs_->SetValue(key, base::MakeUnique<base::Value>(value),
74 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); 74 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
75 } 75 }
76 76
77 const base::DictionaryValue* ServiceProcessPrefs::GetDictionary( 77 const base::DictionaryValue* ServiceProcessPrefs::GetDictionary(
78 const std::string& key) const { 78 const std::string& key) const {
79 const base::Value* value; 79 const base::Value* value;
80 if (!prefs_->GetValue(key, &value)) 80 if (!prefs_->GetValue(key, &value))
81 return nullptr; 81 return nullptr;
82 82
83 const base::DictionaryValue* dict_value = nullptr; 83 const base::DictionaryValue* dict_value = nullptr;
(...skipping 14 matching lines...) Expand all
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/manifest_unittest.cc ('k') | chrome/test/base/javascript_browser_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698