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

Side by Side Diff: rlz/chromeos/lib/rlz_value_store_chromeos.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) 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 "rlz/chromeos/lib/rlz_value_store_chromeos.h" 5 #include "rlz/chromeos/lib/rlz_value_store_chromeos.h"
6 6
7 #include "base/base_paths.h" 7 #include "base/base_paths.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/files/important_file_writer.h" 9 #include "base/files/important_file_writer.h"
10 #include "base/json/json_file_value_serializer.h" 10 #include "base/json/json_file_value_serializer.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 bool RlzValueStoreChromeOS::ClearAccessPointRlz(AccessPoint access_point) { 141 bool RlzValueStoreChromeOS::ClearAccessPointRlz(AccessPoint access_point) {
142 DCHECK(CalledOnValidThread()); 142 DCHECK(CalledOnValidThread());
143 rlz_store_->Remove(GetKeyName(kAccessPointKey, access_point), NULL); 143 rlz_store_->Remove(GetKeyName(kAccessPointKey, access_point), NULL);
144 return true; 144 return true;
145 } 145 }
146 146
147 bool RlzValueStoreChromeOS::AddProductEvent(Product product, 147 bool RlzValueStoreChromeOS::AddProductEvent(Product product,
148 const char* event_rlz) { 148 const char* event_rlz) {
149 DCHECK(CalledOnValidThread()); 149 DCHECK(CalledOnValidThread());
150 return AddValueToList(GetKeyName(kProductEventKey, product), 150 return AddValueToList(GetKeyName(kProductEventKey, product),
151 base::MakeUnique<base::StringValue>(event_rlz)); 151 base::MakeUnique<base::Value>(event_rlz));
152 } 152 }
153 153
154 bool RlzValueStoreChromeOS::ReadProductEvents( 154 bool RlzValueStoreChromeOS::ReadProductEvents(
155 Product product, 155 Product product,
156 std::vector<std::string>* events) { 156 std::vector<std::string>* events) {
157 DCHECK(CalledOnValidThread()); 157 DCHECK(CalledOnValidThread());
158 base::ListValue* events_list = NULL; ; 158 base::ListValue* events_list = NULL; ;
159 if (!rlz_store_->GetList(GetKeyName(kProductEventKey, product), &events_list)) 159 if (!rlz_store_->GetList(GetKeyName(kProductEventKey, product), &events_list))
160 return false; 160 return false;
161 events->clear(); 161 events->clear();
162 for (size_t i = 0; i < events_list->GetSize(); ++i) { 162 for (size_t i = 0; i < events_list->GetSize(); ++i) {
163 std::string event; 163 std::string event;
164 if (events_list->GetString(i, &event)) 164 if (events_list->GetString(i, &event))
165 events->push_back(event); 165 events->push_back(event);
166 } 166 }
167 return true; 167 return true;
168 } 168 }
169 169
170 bool RlzValueStoreChromeOS::ClearProductEvent(Product product, 170 bool RlzValueStoreChromeOS::ClearProductEvent(Product product,
171 const char* event_rlz) { 171 const char* event_rlz) {
172 DCHECK(CalledOnValidThread()); 172 DCHECK(CalledOnValidThread());
173 base::StringValue event_value(event_rlz); 173 base::Value event_value(event_rlz);
174 return RemoveValueFromList(GetKeyName(kProductEventKey, product), 174 return RemoveValueFromList(GetKeyName(kProductEventKey, product),
175 event_value); 175 event_value);
176 } 176 }
177 177
178 bool RlzValueStoreChromeOS::ClearAllProductEvents(Product product) { 178 bool RlzValueStoreChromeOS::ClearAllProductEvents(Product product) {
179 DCHECK(CalledOnValidThread()); 179 DCHECK(CalledOnValidThread());
180 rlz_store_->Remove(GetKeyName(kProductEventKey, product), NULL); 180 rlz_store_->Remove(GetKeyName(kProductEventKey, product), NULL);
181 return true; 181 return true;
182 } 182 }
183 183
184 bool RlzValueStoreChromeOS::AddStatefulEvent(Product product, 184 bool RlzValueStoreChromeOS::AddStatefulEvent(Product product,
185 const char* event_rlz) { 185 const char* event_rlz) {
186 DCHECK(CalledOnValidThread()); 186 DCHECK(CalledOnValidThread());
187 return AddValueToList(GetKeyName(kStatefulEventKey, product), 187 return AddValueToList(GetKeyName(kStatefulEventKey, product),
188 base::MakeUnique<base::StringValue>(event_rlz)); 188 base::MakeUnique<base::Value>(event_rlz));
189 } 189 }
190 190
191 bool RlzValueStoreChromeOS::IsStatefulEvent(Product product, 191 bool RlzValueStoreChromeOS::IsStatefulEvent(Product product,
192 const char* event_rlz) { 192 const char* event_rlz) {
193 DCHECK(CalledOnValidThread()); 193 DCHECK(CalledOnValidThread());
194 base::StringValue event_value(event_rlz); 194 base::Value event_value(event_rlz);
195 base::ListValue* events_list = NULL; 195 base::ListValue* events_list = NULL;
196 return rlz_store_->GetList(GetKeyName(kStatefulEventKey, product), 196 return rlz_store_->GetList(GetKeyName(kStatefulEventKey, product),
197 &events_list) && 197 &events_list) &&
198 events_list->Find(event_value) != events_list->end(); 198 events_list->Find(event_value) != events_list->end();
199 } 199 }
200 200
201 bool RlzValueStoreChromeOS::ClearAllStatefulEvents(Product product) { 201 bool RlzValueStoreChromeOS::ClearAllStatefulEvents(Product product) {
202 DCHECK(CalledOnValidThread()); 202 DCHECK(CalledOnValidThread());
203 rlz_store_->Remove(GetKeyName(kStatefulEventKey, product), NULL); 203 rlz_store_->Remove(GetKeyName(kStatefulEventKey, product), NULL);
204 return true; 204 return true;
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 g_testing_rlz_store_path_ = directory; 334 g_testing_rlz_store_path_ = directory;
335 } 335 }
336 336
337 std::string RlzStoreFilenameStr() { 337 std::string RlzStoreFilenameStr() {
338 return GetRlzStorePath().value(); 338 return GetRlzStorePath().value();
339 } 339 }
340 340
341 } // namespace testing 341 } // namespace testing
342 342
343 } // namespace rlz_lib 343 } // namespace rlz_lib
OLDNEW
« no previous file with comments | « net/test/spawned_test_server/base_test_server.cc ('k') | services/catalog/public/tools/catalog.cc.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698