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

Side by Side Diff: chrome/installer/util/copy_reg_key_work_item.cc

Issue 7946003: C++ Readability for grt. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Trimmed down Created 9 years, 3 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 | Annotate | Revision Log
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
Yash 2011/10/03 02:17:37 Please include a brief file comment, describing wh
grt (UTC plus 2) 2011/10/03 15:35:26 Done.
5 #include "chrome/installer/util/copy_reg_key_work_item.h" 5 #include "chrome/installer/util/copy_reg_key_work_item.h"
6 6
7 #include <shlwapi.h> 7 #include <shlwapi.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/win/registry.h" 10 #include "base/win/registry.h"
11 11
12 using base::win::RegKey; 12 using base::win::RegKey;
13 13
14 CopyRegKeyWorkItem::~CopyRegKeyWorkItem() { 14 CopyRegKeyWorkItem::~CopyRegKeyWorkItem() {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 } else { 60 } else {
61 result = SHCopyKey(predefined_root_, source_key_path_.c_str(), 61 result = SHCopyKey(predefined_root_, source_key_path_.c_str(),
62 dest_key.Handle(), 0); 62 dest_key.Handle(), 0);
63 switch (result) { 63 switch (result) {
64 case ERROR_FILE_NOT_FOUND: 64 case ERROR_FILE_NOT_FOUND:
65 // The source didn't exist, so neither should the destination. 65 // The source didn't exist, so neither should the destination.
66 dest_key.Close(); 66 dest_key.Close();
67 SHDeleteKey(predefined_root_, dest_key_path_.c_str()); 67 SHDeleteKey(predefined_root_, dest_key_path_.c_str());
68 // Handle like a success. 68 // Handle like a success.
69 result = ERROR_SUCCESS; 69 result = ERROR_SUCCESS;
70 // -- FALL THROUGH TO SUCCESS CASE -- 70 // -- FALL THROUGH TO SUCCESS CASE --
Yash 2011/10/03 02:17:37 No need to have this comment in all caps
grt (UTC plus 2) 2011/10/03 15:35:26 Done.
71 case ERROR_SUCCESS: 71 case ERROR_SUCCESS:
72 break; 72 break;
73 default: 73 default:
74 LOG(ERROR) << "Failed to copy key from " << source_key_path_ << " to " 74 LOG(ERROR) << "Failed to copy key from " << source_key_path_ << " to "
75 << dest_key_path_ << ", result: " << result; 75 << dest_key_path_ << ", result: " << result;
76 break; 76 break;
77 } 77 }
78 } 78 }
79 } 79 }
80 80
(...skipping 10 matching lines...) Expand all
91 if (result != ERROR_SUCCESS && result != ERROR_FILE_NOT_FOUND) { 91 if (result != ERROR_SUCCESS && result != ERROR_FILE_NOT_FOUND) {
92 LOG(ERROR) << "Failed to delete key at " << dest_key_path_ 92 LOG(ERROR) << "Failed to delete key at " << dest_key_path_
93 << " in rollback, result: " << result; 93 << " in rollback, result: " << result;
94 } 94 }
95 95
96 // Restore the old contents. The restoration takes on its default security 96 // Restore the old contents. The restoration takes on its default security
97 // attributes; any custom attributes are lost. 97 // attributes; any custom attributes are lost.
98 if (!backup_.WriteTo(predefined_root_, dest_key_path_.c_str())) 98 if (!backup_.WriteTo(predefined_root_, dest_key_path_.c_str()))
99 LOG(ERROR) << "Failed to restore key in rollback."; 99 LOG(ERROR) << "Failed to restore key in rollback.";
100 } 100 }
101
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698