OLD | NEW |
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/win/lib/rlz_value_store_registry.h" | 5 #include "rlz/win/lib/rlz_value_store_registry.h" |
6 | 6 |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "base/win/registry.h" | 9 #include "base/win/registry.h" |
10 #include "rlz/lib/assert.h" | 10 #include "rlz/lib/assert.h" |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 | 342 |
343 void RlzValueStoreRegistry::CollectGarbage() { | 343 void RlzValueStoreRegistry::CollectGarbage() { |
344 // Delete each of the known subkeys if empty. | 344 // Delete each of the known subkeys if empty. |
345 const char* const subkeys[] = { | 345 const char* const subkeys[] = { |
346 kRlzsSubkeyName, | 346 kRlzsSubkeyName, |
347 kEventsSubkeyName, | 347 kEventsSubkeyName, |
348 kStatefulEventsSubkeyName, | 348 kStatefulEventsSubkeyName, |
349 kPingTimesSubkeyName | 349 kPingTimesSubkeyName |
350 }; | 350 }; |
351 | 351 |
352 for (int i = 0; i < arraysize(subkeys); i++) { | 352 for (size_t i = 0; i < arraysize(subkeys); i++) { |
353 std::string subkey_name; | 353 std::string subkey_name; |
354 base::StringAppendF(&subkey_name, "%s\\%s", kLibKeyName, subkeys[i]); | 354 base::StringAppendF(&subkey_name, "%s\\%s", kLibKeyName, subkeys[i]); |
355 AppendBrandToString(&subkey_name); | 355 AppendBrandToString(&subkey_name); |
356 base::string16 subkey_name16 = ASCIIToUTF16(subkey_name); | 356 base::string16 subkey_name16 = ASCIIToUTF16(subkey_name); |
357 | 357 |
358 VERIFY(DeleteKeyIfEmpty(HKEY_CURRENT_USER, subkey_name16.c_str())); | 358 VERIFY(DeleteKeyIfEmpty(HKEY_CURRENT_USER, subkey_name16.c_str())); |
359 } | 359 } |
360 | 360 |
361 // Delete the library key and its parents too now if empty. | 361 // Delete the library key and its parents too now if empty. |
362 VERIFY(DeleteKeyIfEmpty(HKEY_CURRENT_USER, GetWideLibKeyName().c_str())); | 362 VERIFY(DeleteKeyIfEmpty(HKEY_CURRENT_USER, GetWideLibKeyName().c_str())); |
363 VERIFY(DeleteKeyIfEmpty(HKEY_CURRENT_USER, kGoogleCommonKeyName)); | 363 VERIFY(DeleteKeyIfEmpty(HKEY_CURRENT_USER, kGoogleCommonKeyName)); |
364 VERIFY(DeleteKeyIfEmpty(HKEY_CURRENT_USER, kGoogleKeyName)); | 364 VERIFY(DeleteKeyIfEmpty(HKEY_CURRENT_USER, kGoogleKeyName)); |
365 } | 365 } |
366 | 366 |
367 ScopedRlzValueStoreLock::ScopedRlzValueStoreLock() { | 367 ScopedRlzValueStoreLock::ScopedRlzValueStoreLock() { |
368 if (!lock_.failed()) | 368 if (!lock_.failed()) |
369 store_.reset(new RlzValueStoreRegistry); | 369 store_.reset(new RlzValueStoreRegistry); |
370 } | 370 } |
371 | 371 |
372 ScopedRlzValueStoreLock::~ScopedRlzValueStoreLock() { | 372 ScopedRlzValueStoreLock::~ScopedRlzValueStoreLock() { |
373 } | 373 } |
374 | 374 |
375 RlzValueStore* ScopedRlzValueStoreLock::GetStore() { | 375 RlzValueStore* ScopedRlzValueStoreLock::GetStore() { |
376 return store_.get(); | 376 return store_.get(); |
377 } | 377 } |
378 | 378 |
379 } // namespace rlz_lib | 379 } // namespace rlz_lib |
OLD | NEW |