| OLD | NEW |
| 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 |
| 5 #include <windows.h> | 5 #include <windows.h> |
| 6 #include <shlobj.h> | 6 #include <shlobj.h> |
| 7 | 7 |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 HKEY_LOCAL_MACHINE, kSessionManagerKey, | 46 HKEY_LOCAL_MACHINE, kSessionManagerKey, |
| 47 KEY_CREATE_SUB_KEY | KEY_SET_VALUE); | 47 KEY_CREATE_SUB_KEY | KEY_SET_VALUE); |
| 48 if (!session_manager_key.Handle()) { | 48 if (!session_manager_key.Handle()) { |
| 49 // Couldn't open / create the key. | 49 // Couldn't open / create the key. |
| 50 DLOG(ERROR) << "Failed to open session manager key for writing."; | 50 DLOG(ERROR) << "Failed to open session manager key for writing."; |
| 51 } | 51 } |
| 52 | 52 |
| 53 std::vector<char> buffer; | 53 std::vector<char> buffer; |
| 54 StringArrayToMultiSZBytes(original_pending_moves_, &buffer); | 54 StringArrayToMultiSZBytes(original_pending_moves_, &buffer); |
| 55 session_manager_key.WriteValue(kPendingFileRenameOps, &buffer[0], | 55 session_manager_key.WriteValue(kPendingFileRenameOps, &buffer[0], |
| 56 buffer.size(), REG_MULTI_SZ); | 56 static_cast<int>(buffer.size()), |
| 57 REG_MULTI_SZ); |
| 57 } | 58 } |
| 58 } | 59 } |
| 59 | 60 |
| 60 // Compares two buffers of size len. Returns true if they are equal, | 61 // Compares two buffers of size len. Returns true if they are equal, |
| 61 // false otherwise. Standard warnings about making sure the buffers | 62 // false otherwise. Standard warnings about making sure the buffers |
| 62 // are at least len chars long apply. | 63 // are at least len chars long apply. |
| 63 template<class Type> | 64 template<class Type> |
| 64 bool CompareBuffers(Type* buf1, Type* buf2, int len) { | 65 bool CompareBuffers(Type* buf1, Type* buf2, int len) { |
| 65 Type* comp1 = buf1; | 66 Type* comp1 = buf1; |
| 66 Type* comp2 = buf2; | 67 Type* comp2 = buf2; |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 | 244 |
| 244 EXPECT_EQ(initial_pending_moves_size, pending_moves.size()); | 245 EXPECT_EQ(initial_pending_moves_size, pending_moves.size()); |
| 245 | 246 |
| 246 std::vector<PendingMove>::const_iterator check_iter(pending_moves.begin()); | 247 std::vector<PendingMove>::const_iterator check_iter(pending_moves.begin()); |
| 247 for (; check_iter != pending_moves.end(); ++check_iter) { | 248 for (; check_iter != pending_moves.end(); ++check_iter) { |
| 248 base::FilePath move_path(check_iter->first); | 249 base::FilePath move_path(check_iter->first); |
| 249 EXPECT_FALSE(MatchPendingDeletePath(short_temp_file, move_path)); | 250 EXPECT_FALSE(MatchPendingDeletePath(short_temp_file, move_path)); |
| 250 } | 251 } |
| 251 } | 252 } |
| 252 | 253 |
| OLD | NEW |