| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/registry.h" | 5 #include "base/registry.h" |
| 6 | 6 |
| 7 #include <shlwapi.h> | 7 #include <shlwapi.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 | 10 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 if (rootkey) { | 138 if (rootkey) { |
| 139 if (access & (KEY_SET_VALUE | KEY_CREATE_SUB_KEY | KEY_CREATE_LINK)) | 139 if (access & (KEY_SET_VALUE | KEY_CREATE_SUB_KEY | KEY_CREATE_LINK)) |
| 140 Create(rootkey, subkey, access); | 140 Create(rootkey, subkey, access); |
| 141 else | 141 else |
| 142 Open(rootkey, subkey, access); | 142 Open(rootkey, subkey, access); |
| 143 } else { | 143 } else { |
| 144 DCHECK(!subkey); | 144 DCHECK(!subkey); |
| 145 } | 145 } |
| 146 } | 146 } |
| 147 | 147 |
| 148 RegKey::~RegKey() { |
| 149 Close(); |
| 150 } |
| 151 |
| 148 void RegKey::Close() { | 152 void RegKey::Close() { |
| 149 StopWatching(); | 153 StopWatching(); |
| 150 if (key_) { | 154 if (key_) { |
| 151 ::RegCloseKey(key_); | 155 ::RegCloseKey(key_); |
| 152 key_ = NULL; | 156 key_ = NULL; |
| 153 } | 157 } |
| 154 } | 158 } |
| 155 | 159 |
| 156 bool RegKey::Create(HKEY rootkey, const wchar_t* subkey, REGSAM access) { | 160 bool RegKey::Create(HKEY rootkey, const wchar_t* subkey, REGSAM access) { |
| 157 DWORD disposition_value; | 161 DWORD disposition_value; |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 | 367 |
| 364 bool RegKey::HasChanged() { | 368 bool RegKey::HasChanged() { |
| 365 if (watch_event_) { | 369 if (watch_event_) { |
| 366 if (WaitForSingleObject(watch_event_, 0) == WAIT_OBJECT_0) { | 370 if (WaitForSingleObject(watch_event_, 0) == WAIT_OBJECT_0) { |
| 367 StartWatching(); | 371 StartWatching(); |
| 368 return true; | 372 return true; |
| 369 } | 373 } |
| 370 } | 374 } |
| 371 return false; | 375 return false; |
| 372 } | 376 } |
| OLD | NEW |