| 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" |
| 11 #include "rlz/lib/lib_values.h" | 11 #include "rlz/lib/lib_values.h" |
| 12 #include "rlz/lib/rlz_lib.h" | 12 #include "rlz/lib/rlz_lib.h" |
| 13 #include "rlz/lib/string_utils.h" | 13 #include "rlz/lib/string_utils.h" |
| 14 #include "rlz/win/lib/registry_util.h" | 14 #include "rlz/win/lib/registry_util.h" |
| 15 | 15 |
| 16 using base::ASCIIToWide; | 16 using base::ASCIIToUTF16; |
| 17 | 17 |
| 18 namespace rlz_lib { | 18 namespace rlz_lib { |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 // | 22 // |
| 23 // Registry keys: | 23 // Registry keys: |
| 24 // | 24 // |
| 25 // RLZ's are stored as: | 25 // RLZ's are stored as: |
| 26 // <AccessPointName> = <RLZ value> @ kRootKey\kLibKeyName\kRlzsSubkeyName. | 26 // <AccessPointName> = <RLZ value> @ kRootKey\kLibKeyName\kRlzsSubkeyName. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 40 // | 40 // |
| 41 const char kLibKeyName[] = "Software\\Google\\Common\\Rlz"; | 41 const char kLibKeyName[] = "Software\\Google\\Common\\Rlz"; |
| 42 const wchar_t kGoogleKeyName[] = L"Software\\Google"; | 42 const wchar_t kGoogleKeyName[] = L"Software\\Google"; |
| 43 const wchar_t kGoogleCommonKeyName[] = L"Software\\Google\\Common"; | 43 const wchar_t kGoogleCommonKeyName[] = L"Software\\Google\\Common"; |
| 44 const char kRlzsSubkeyName[] = "RLZs"; | 44 const char kRlzsSubkeyName[] = "RLZs"; |
| 45 const char kEventsSubkeyName[] = "Events"; | 45 const char kEventsSubkeyName[] = "Events"; |
| 46 const char kStatefulEventsSubkeyName[] = "StatefulEvents"; | 46 const char kStatefulEventsSubkeyName[] = "StatefulEvents"; |
| 47 const char kPingTimesSubkeyName[] = "PTimes"; | 47 const char kPingTimesSubkeyName[] = "PTimes"; |
| 48 | 48 |
| 49 std::wstring GetWideProductName(Product product) { | 49 std::wstring GetWideProductName(Product product) { |
| 50 return ASCIIToWide(GetProductName(product)); | 50 return ASCIIToUTF16(GetProductName(product)); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void AppendBrandToString(std::string* str) { | 53 void AppendBrandToString(std::string* str) { |
| 54 std::string brand(SupplementaryBranding::GetBrand()); | 54 std::string brand(SupplementaryBranding::GetBrand()); |
| 55 if (!brand.empty()) | 55 if (!brand.empty()) |
| 56 base::StringAppendF(str, "\\_%s", brand.c_str()); | 56 base::StringAppendF(str, "\\_%s", brand.c_str()); |
| 57 } | 57 } |
| 58 | 58 |
| 59 // Function to get the specific registry keys. | 59 // Function to get the specific registry keys. |
| 60 bool GetRegKey(const char* name, REGSAM access, base::win::RegKey* key) { | 60 bool GetRegKey(const char* name, REGSAM access, base::win::RegKey* key) { |
| 61 std::string key_location; | 61 std::string key_location; |
| 62 base::StringAppendF(&key_location, "%s\\%s", kLibKeyName, name); | 62 base::StringAppendF(&key_location, "%s\\%s", kLibKeyName, name); |
| 63 AppendBrandToString(&key_location); | 63 AppendBrandToString(&key_location); |
| 64 base::string16 key_location16 = ASCIIToUTF16(key_location); |
| 64 | 65 |
| 65 LONG ret = ERROR_SUCCESS; | 66 LONG ret; |
| 66 if (access & (KEY_SET_VALUE | KEY_CREATE_SUB_KEY | KEY_CREATE_LINK)) { | 67 if (access & (KEY_SET_VALUE | KEY_CREATE_SUB_KEY | KEY_CREATE_LINK)) |
| 67 ret = key->Create(HKEY_CURRENT_USER, ASCIIToWide(key_location).c_str(), | 68 ret = key->Create(HKEY_CURRENT_USER, key_location16.c_str(), access); |
| 68 access); | 69 else |
| 69 } else { | 70 ret = key->Open(HKEY_CURRENT_USER, key_location16.c_str(), access); |
| 70 ret = key->Open(HKEY_CURRENT_USER, ASCIIToWide(key_location).c_str(), | |
| 71 access); | |
| 72 } | |
| 73 | |
| 74 return ret == ERROR_SUCCESS; | 71 return ret == ERROR_SUCCESS; |
| 75 } | 72 } |
| 76 | 73 |
| 77 bool GetPingTimesRegKey(REGSAM access, base::win::RegKey* key) { | 74 bool GetPingTimesRegKey(REGSAM access, base::win::RegKey* key) { |
| 78 return GetRegKey(kPingTimesSubkeyName, access, key); | 75 return GetRegKey(kPingTimesSubkeyName, access, key); |
| 79 } | 76 } |
| 80 | 77 |
| 81 | 78 |
| 82 bool GetEventsRegKey(const char* event_type, | 79 bool GetEventsRegKey(const char* event_type, |
| 83 const rlz_lib::Product* product, | 80 const rlz_lib::Product* product, |
| 84 REGSAM access, base::win::RegKey* key) { | 81 REGSAM access, base::win::RegKey* key) { |
| 85 std::string key_location; | 82 std::string key_location; |
| 86 base::StringAppendF(&key_location, "%s\\%s", kLibKeyName, | 83 base::StringAppendF(&key_location, "%s\\%s", kLibKeyName, |
| 87 event_type); | 84 event_type); |
| 88 AppendBrandToString(&key_location); | 85 AppendBrandToString(&key_location); |
| 89 | 86 |
| 90 if (product != NULL) { | 87 if (product != NULL) { |
| 91 std::string product_name = GetProductName(*product); | 88 std::string product_name = GetProductName(*product); |
| 92 if (product_name.empty()) | 89 if (product_name.empty()) |
| 93 return false; | 90 return false; |
| 94 | 91 |
| 95 base::StringAppendF(&key_location, "\\%s", product_name.c_str()); | 92 base::StringAppendF(&key_location, "\\%s", product_name.c_str()); |
| 96 } | 93 } |
| 94 base::string16 key_location16 = ASCIIToUTF16(key_location); |
| 97 | 95 |
| 98 LONG ret = ERROR_SUCCESS; | 96 LONG ret; |
| 99 if (access & (KEY_SET_VALUE | KEY_CREATE_SUB_KEY | KEY_CREATE_LINK)) { | 97 if (access & (KEY_SET_VALUE | KEY_CREATE_SUB_KEY | KEY_CREATE_LINK)) |
| 100 ret = key->Create(HKEY_CURRENT_USER, ASCIIToWide(key_location).c_str(), | 98 ret = key->Create(HKEY_CURRENT_USER, key_location16.c_str(), access); |
| 101 access); | 99 else |
| 102 } else { | 100 ret = key->Open(HKEY_CURRENT_USER, key_location16.c_str(), access); |
| 103 ret = key->Open(HKEY_CURRENT_USER, ASCIIToWide(key_location).c_str(), | |
| 104 access); | |
| 105 } | |
| 106 | |
| 107 return ret == ERROR_SUCCESS; | 101 return ret == ERROR_SUCCESS; |
| 108 } | 102 } |
| 109 | 103 |
| 110 bool GetAccessPointRlzsRegKey(REGSAM access, base::win::RegKey* key) { | 104 bool GetAccessPointRlzsRegKey(REGSAM access, base::win::RegKey* key) { |
| 111 return GetRegKey(kRlzsSubkeyName, access, key); | 105 return GetRegKey(kRlzsSubkeyName, access, key); |
| 112 } | 106 } |
| 113 | 107 |
| 114 bool ClearAllProductEventValues(rlz_lib::Product product, const char* key) { | 108 bool ClearAllProductEventValues(rlz_lib::Product product, const char* key) { |
| 115 std::wstring product_name = GetWideProductName(product); | 109 std::wstring product_name = GetWideProductName(product); |
| 116 if (product_name.empty()) | 110 if (product_name.empty()) |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 147 |
| 154 // The key is empty - delete it now. | 148 // The key is empty - delete it now. |
| 155 base::win::RegKey key(root_key, L"", KEY_WRITE); | 149 base::win::RegKey key(root_key, L"", KEY_WRITE); |
| 156 return key.DeleteKey(key_name) == ERROR_SUCCESS; | 150 return key.DeleteKey(key_name) == ERROR_SUCCESS; |
| 157 } | 151 } |
| 158 | 152 |
| 159 } // namespace | 153 } // namespace |
| 160 | 154 |
| 161 // static | 155 // static |
| 162 std::wstring RlzValueStoreRegistry::GetWideLibKeyName() { | 156 std::wstring RlzValueStoreRegistry::GetWideLibKeyName() { |
| 163 return ASCIIToWide(kLibKeyName); | 157 return ASCIIToUTF16(kLibKeyName); |
| 164 } | 158 } |
| 165 | 159 |
| 166 bool RlzValueStoreRegistry::HasAccess(AccessType type) { | 160 bool RlzValueStoreRegistry::HasAccess(AccessType type) { |
| 167 return HasUserKeyAccess(type == kWriteAccess); | 161 return HasUserKeyAccess(type == kWriteAccess); |
| 168 } | 162 } |
| 169 | 163 |
| 170 bool RlzValueStoreRegistry::WritePingTime(Product product, int64 time) { | 164 bool RlzValueStoreRegistry::WritePingTime(Product product, int64 time) { |
| 171 base::win::RegKey key; | 165 base::win::RegKey key; |
| 172 std::wstring product_name = GetWideProductName(product); | 166 std::wstring product_name = GetWideProductName(product); |
| 173 return GetPingTimesRegKey(KEY_WRITE, &key) && | 167 return GetPingTimesRegKey(KEY_WRITE, &key) && |
| (...skipping 26 matching lines...) Expand all Loading... |
| 200 | 194 |
| 201 return true; | 195 return true; |
| 202 } | 196 } |
| 203 | 197 |
| 204 bool RlzValueStoreRegistry::WriteAccessPointRlz(AccessPoint access_point, | 198 bool RlzValueStoreRegistry::WriteAccessPointRlz(AccessPoint access_point, |
| 205 const char* new_rlz) { | 199 const char* new_rlz) { |
| 206 const char* access_point_name = GetAccessPointName(access_point); | 200 const char* access_point_name = GetAccessPointName(access_point); |
| 207 if (!access_point_name) | 201 if (!access_point_name) |
| 208 return false; | 202 return false; |
| 209 | 203 |
| 210 std::wstring access_point_name_wide(ASCIIToWide(access_point_name)); | 204 base::string16 access_point_name16(ASCIIToUTF16(access_point_name)); |
| 211 base::win::RegKey key; | 205 base::win::RegKey key; |
| 212 GetAccessPointRlzsRegKey(KEY_WRITE, &key); | 206 GetAccessPointRlzsRegKey(KEY_WRITE, &key); |
| 213 | 207 |
| 214 if (!RegKeyWriteValue(key, access_point_name_wide.c_str(), new_rlz)) { | 208 if (!RegKeyWriteValue(&key, access_point_name16.c_str(), new_rlz)) { |
| 215 ASSERT_STRING("SetAccessPointRlz: Could not write the new RLZ value"); | 209 ASSERT_STRING("SetAccessPointRlz: Could not write the new RLZ value"); |
| 216 return false; | 210 return false; |
| 217 } | 211 } |
| 218 return true; | 212 return true; |
| 219 } | 213 } |
| 220 | 214 |
| 221 bool RlzValueStoreRegistry::ReadAccessPointRlz(AccessPoint access_point, | 215 bool RlzValueStoreRegistry::ReadAccessPointRlz(AccessPoint access_point, |
| 222 char* rlz, | 216 char* rlz, |
| 223 size_t rlz_size) { | 217 size_t rlz_size) { |
| 224 const char* access_point_name = GetAccessPointName(access_point); | 218 const char* access_point_name = GetAccessPointName(access_point); |
| 225 if (!access_point_name) | 219 if (!access_point_name) |
| 226 return false; | 220 return false; |
| 227 | 221 |
| 228 size_t size = rlz_size; | 222 size_t size = rlz_size; |
| 229 base::win::RegKey key; | 223 base::win::RegKey key; |
| 230 GetAccessPointRlzsRegKey(KEY_READ, &key); | 224 GetAccessPointRlzsRegKey(KEY_READ, &key); |
| 231 if (!RegKeyReadValue(key, ASCIIToWide(access_point_name).c_str(), | 225 base::string16 access_point_name16 = ASCIIToUTF16(access_point_name); |
| 232 rlz, &size)) { | 226 if (!RegKeyReadValue(key, access_point_name16.c_str(), rlz, &size)) { |
| 233 rlz[0] = 0; | 227 rlz[0] = 0; |
| 234 if (size > rlz_size) { | 228 if (size > rlz_size) { |
| 235 ASSERT_STRING("GetAccessPointRlz: Insufficient buffer size"); | 229 ASSERT_STRING("GetAccessPointRlz: Insufficient buffer size"); |
| 236 return false; | 230 return false; |
| 237 } | 231 } |
| 238 } | 232 } |
| 239 return true; | 233 return true; |
| 240 } | 234 } |
| 241 | 235 |
| 242 bool RlzValueStoreRegistry::ClearAccessPointRlz(AccessPoint access_point) { | 236 bool RlzValueStoreRegistry::ClearAccessPointRlz(AccessPoint access_point) { |
| 243 const char* access_point_name = GetAccessPointName(access_point); | 237 const char* access_point_name = GetAccessPointName(access_point); |
| 244 if (!access_point_name) | 238 if (!access_point_name) |
| 245 return false; | 239 return false; |
| 246 | 240 |
| 247 std::wstring access_point_name_wide(ASCIIToWide(access_point_name)); | 241 base::string16 access_point_name16(ASCIIToUTF16(access_point_name)); |
| 248 base::win::RegKey key; | 242 base::win::RegKey key; |
| 249 GetAccessPointRlzsRegKey(KEY_WRITE, &key); | 243 GetAccessPointRlzsRegKey(KEY_WRITE, &key); |
| 250 | 244 |
| 251 key.DeleteValue(access_point_name_wide.c_str()); | 245 key.DeleteValue(access_point_name16.c_str()); |
| 252 | 246 |
| 253 // Verify deletion. | 247 // Verify deletion. |
| 254 DWORD value; | 248 DWORD value; |
| 255 if (key.ReadValueDW(access_point_name_wide.c_str(), &value) == | 249 if (key.ReadValueDW(access_point_name16.c_str(), &value) == ERROR_SUCCESS) { |
| 256 ERROR_SUCCESS) { | |
| 257 ASSERT_STRING("SetAccessPointRlz: Could not clear the RLZ value."); | 250 ASSERT_STRING("SetAccessPointRlz: Could not clear the RLZ value."); |
| 258 return false; | 251 return false; |
| 259 } | 252 } |
| 260 return true; | 253 return true; |
| 261 } | 254 } |
| 262 | 255 |
| 263 bool RlzValueStoreRegistry::AddProductEvent(Product product, | 256 bool RlzValueStoreRegistry::AddProductEvent(Product product, |
| 264 const char* event_rlz) { | 257 const char* event_rlz) { |
| 265 std::wstring event_rlz_wide(ASCIIToWide(event_rlz)); | 258 base::string16 event_rlz16(ASCIIToUTF16(event_rlz)); |
| 266 base::win::RegKey reg_key; | 259 base::win::RegKey reg_key; |
| 267 GetEventsRegKey(kEventsSubkeyName, &product, KEY_WRITE, ®_key); | 260 GetEventsRegKey(kEventsSubkeyName, &product, KEY_WRITE, ®_key); |
| 268 if (reg_key.WriteValue(event_rlz_wide.c_str(), 1) != ERROR_SUCCESS) { | 261 if (reg_key.WriteValue(event_rlz16.c_str(), 1) != ERROR_SUCCESS) { |
| 269 ASSERT_STRING("AddProductEvent: Could not write the new event value"); | 262 ASSERT_STRING("AddProductEvent: Could not write the new event value"); |
| 270 return false; | 263 return false; |
| 271 } | 264 } |
| 272 | 265 |
| 273 return true; | 266 return true; |
| 274 } | 267 } |
| 275 | 268 |
| 276 bool RlzValueStoreRegistry::ReadProductEvents(Product product, | 269 bool RlzValueStoreRegistry::ReadProductEvents(Product product, |
| 277 std::vector<std::string>* events) { | 270 std::vector<std::string>* events) { |
| 278 // Open the events key. | 271 // Open the events key. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 294 NULL, NULL, NULL, NULL); | 287 NULL, NULL, NULL, NULL); |
| 295 if (result == ERROR_SUCCESS) | 288 if (result == ERROR_SUCCESS) |
| 296 events->push_back(std::string(buffer)); | 289 events->push_back(std::string(buffer)); |
| 297 } | 290 } |
| 298 | 291 |
| 299 return result == ERROR_NO_MORE_ITEMS; | 292 return result == ERROR_NO_MORE_ITEMS; |
| 300 } | 293 } |
| 301 | 294 |
| 302 bool RlzValueStoreRegistry::ClearProductEvent(Product product, | 295 bool RlzValueStoreRegistry::ClearProductEvent(Product product, |
| 303 const char* event_rlz) { | 296 const char* event_rlz) { |
| 304 std::wstring event_rlz_wide(ASCIIToWide(event_rlz)); | 297 base::string16 event_rlz16(ASCIIToUTF16(event_rlz)); |
| 305 base::win::RegKey key; | 298 base::win::RegKey key; |
| 306 GetEventsRegKey(kEventsSubkeyName, &product, KEY_WRITE, &key); | 299 GetEventsRegKey(kEventsSubkeyName, &product, KEY_WRITE, &key); |
| 307 key.DeleteValue(event_rlz_wide.c_str()); | 300 key.DeleteValue(event_rlz16.c_str()); |
| 308 | 301 |
| 309 // Verify deletion. | 302 // Verify deletion. |
| 310 DWORD value; | 303 DWORD value; |
| 311 if (key.ReadValueDW(event_rlz_wide.c_str(), &value) == ERROR_SUCCESS) { | 304 if (key.ReadValueDW(event_rlz16.c_str(), &value) == ERROR_SUCCESS) { |
| 312 ASSERT_STRING("ClearProductEvent: Could not delete the event value."); | 305 ASSERT_STRING("ClearProductEvent: Could not delete the event value."); |
| 313 return false; | 306 return false; |
| 314 } | 307 } |
| 315 | 308 |
| 316 return true; | 309 return true; |
| 317 } | 310 } |
| 318 | 311 |
| 319 bool RlzValueStoreRegistry::ClearAllProductEvents(Product product) { | 312 bool RlzValueStoreRegistry::ClearAllProductEvents(Product product) { |
| 320 return ClearAllProductEventValues(product, kEventsSubkeyName); | 313 return ClearAllProductEventValues(product, kEventsSubkeyName); |
| 321 } | 314 } |
| 322 | 315 |
| 323 bool RlzValueStoreRegistry::AddStatefulEvent(Product product, | 316 bool RlzValueStoreRegistry::AddStatefulEvent(Product product, |
| 324 const char* event_rlz) { | 317 const char* event_rlz) { |
| 325 base::win::RegKey key; | 318 base::win::RegKey key; |
| 326 std::wstring event_rlz_wide(ASCIIToWide(event_rlz)); | 319 base::string16 event_rlz16(ASCIIToUTF16(event_rlz)); |
| 327 if (!GetEventsRegKey(kStatefulEventsSubkeyName, &product, KEY_WRITE, &key) || | 320 if (!GetEventsRegKey(kStatefulEventsSubkeyName, &product, KEY_WRITE, &key) || |
| 328 key.WriteValue(event_rlz_wide.c_str(), 1) != ERROR_SUCCESS) { | 321 key.WriteValue(event_rlz16.c_str(), 1) != ERROR_SUCCESS) { |
| 329 ASSERT_STRING( | 322 ASSERT_STRING( |
| 330 "AddStatefulEvent: Could not write the new stateful event"); | 323 "AddStatefulEvent: Could not write the new stateful event"); |
| 331 return false; | 324 return false; |
| 332 } | 325 } |
| 333 | 326 |
| 334 return true; | 327 return true; |
| 335 } | 328 } |
| 336 | 329 |
| 337 bool RlzValueStoreRegistry::IsStatefulEvent(Product product, | 330 bool RlzValueStoreRegistry::IsStatefulEvent(Product product, |
| 338 const char* event_rlz) { | 331 const char* event_rlz) { |
| 339 DWORD value; | 332 DWORD value; |
| 340 base::win::RegKey key; | 333 base::win::RegKey key; |
| 341 GetEventsRegKey(kStatefulEventsSubkeyName, &product, KEY_READ, &key); | 334 GetEventsRegKey(kStatefulEventsSubkeyName, &product, KEY_READ, &key); |
| 342 std::wstring event_rlz_wide(ASCIIToWide(event_rlz)); | 335 base::string16 event_rlz16(ASCIIToUTF16(event_rlz)); |
| 343 return key.ReadValueDW(event_rlz_wide.c_str(), &value) == ERROR_SUCCESS; | 336 return key.ReadValueDW(event_rlz16.c_str(), &value) == ERROR_SUCCESS; |
| 344 } | 337 } |
| 345 | 338 |
| 346 bool RlzValueStoreRegistry::ClearAllStatefulEvents(Product product) { | 339 bool RlzValueStoreRegistry::ClearAllStatefulEvents(Product product) { |
| 347 return ClearAllProductEventValues(product, kStatefulEventsSubkeyName); | 340 return ClearAllProductEventValues(product, kStatefulEventsSubkeyName); |
| 348 } | 341 } |
| 349 | 342 |
| 350 void RlzValueStoreRegistry::CollectGarbage() { | 343 void RlzValueStoreRegistry::CollectGarbage() { |
| 351 // Delete each of the known subkeys if empty. | 344 // Delete each of the known subkeys if empty. |
| 352 const char* subkeys[] = { | 345 const char* const subkeys[] = { |
| 353 kRlzsSubkeyName, | 346 kRlzsSubkeyName, |
| 354 kEventsSubkeyName, | 347 kEventsSubkeyName, |
| 355 kStatefulEventsSubkeyName, | 348 kStatefulEventsSubkeyName, |
| 356 kPingTimesSubkeyName | 349 kPingTimesSubkeyName |
| 357 }; | 350 }; |
| 358 | 351 |
| 359 for (int i = 0; i < arraysize(subkeys); i++) { | 352 for (int i = 0; i < arraysize(subkeys); i++) { |
| 360 std::string subkey_name; | 353 std::string subkey_name; |
| 361 base::StringAppendF(&subkey_name, "%s\\%s", kLibKeyName, subkeys[i]); | 354 base::StringAppendF(&subkey_name, "%s\\%s", kLibKeyName, subkeys[i]); |
| 362 AppendBrandToString(&subkey_name); | 355 AppendBrandToString(&subkey_name); |
| 356 base::string16 subkey_name16 = ASCIIToUTF16(subkey_name); |
| 363 | 357 |
| 364 VERIFY(DeleteKeyIfEmpty(HKEY_CURRENT_USER, | 358 VERIFY(DeleteKeyIfEmpty(HKEY_CURRENT_USER, subkey_name16.c_str())); |
| 365 ASCIIToWide(subkey_name).c_str())); | |
| 366 } | 359 } |
| 367 | 360 |
| 368 // Delete the library key and its parents too now if empty. | 361 // Delete the library key and its parents too now if empty. |
| 369 VERIFY(DeleteKeyIfEmpty(HKEY_CURRENT_USER, GetWideLibKeyName().c_str())); | 362 VERIFY(DeleteKeyIfEmpty(HKEY_CURRENT_USER, GetWideLibKeyName().c_str())); |
| 370 VERIFY(DeleteKeyIfEmpty(HKEY_CURRENT_USER, kGoogleCommonKeyName)); | 363 VERIFY(DeleteKeyIfEmpty(HKEY_CURRENT_USER, kGoogleCommonKeyName)); |
| 371 VERIFY(DeleteKeyIfEmpty(HKEY_CURRENT_USER, kGoogleKeyName)); | 364 VERIFY(DeleteKeyIfEmpty(HKEY_CURRENT_USER, kGoogleKeyName)); |
| 372 } | 365 } |
| 373 | 366 |
| 374 ScopedRlzValueStoreLock::ScopedRlzValueStoreLock() { | 367 ScopedRlzValueStoreLock::ScopedRlzValueStoreLock() { |
| 375 if (!lock_.failed()) | 368 if (!lock_.failed()) |
| 376 store_.reset(new RlzValueStoreRegistry); | 369 store_.reset(new RlzValueStoreRegistry); |
| 377 } | 370 } |
| 378 | 371 |
| 379 ScopedRlzValueStoreLock::~ScopedRlzValueStoreLock() { | 372 ScopedRlzValueStoreLock::~ScopedRlzValueStoreLock() { |
| 380 } | 373 } |
| 381 | 374 |
| 382 RlzValueStore* ScopedRlzValueStoreLock::GetStore() { | 375 RlzValueStore* ScopedRlzValueStoreLock::GetStore() { |
| 383 return store_.get(); | 376 return store_.get(); |
| 384 } | 377 } |
| 385 | 378 |
| 386 } // namespace rlz_lib | 379 } // namespace rlz_lib |
| OLD | NEW |