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 "base/test/test_file_util.h" | 5 #include "base/test/test_file_util.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <aclapi.h> | 8 #include <aclapi.h> |
9 #include <shlwapi.h> | 9 #include <shlwapi.h> |
10 | 10 |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 | 234 |
235 return false; | 235 return false; |
236 } | 236 } |
237 | 237 |
238 // Return whether the ZoneIdentifier is correctly set to "Internet" (3) | 238 // Return whether the ZoneIdentifier is correctly set to "Internet" (3) |
239 // Only returns a valid result when called from same process as the | 239 // Only returns a valid result when called from same process as the |
240 // one that (was supposed to have) set the zone identifier. | 240 // one that (was supposed to have) set the zone identifier. |
241 bool HasInternetZoneIdentifier(const base::FilePath& full_path) { | 241 bool HasInternetZoneIdentifier(const base::FilePath& full_path) { |
242 base::FilePath zone_path(full_path.value() + L":Zone.Identifier"); | 242 base::FilePath zone_path(full_path.value() + L":Zone.Identifier"); |
243 std::string zone_path_contents; | 243 std::string zone_path_contents; |
244 if (!file_util::ReadFileToString(zone_path, &zone_path_contents)) | 244 if (!base::ReadFileToString(zone_path, &zone_path_contents)) |
245 return false; | 245 return false; |
246 | 246 |
247 std::vector<std::string> lines; | 247 std::vector<std::string> lines; |
248 // This call also trims whitespaces, including carriage-returns (\r). | 248 // This call also trims whitespaces, including carriage-returns (\r). |
249 base::SplitString(zone_path_contents, '\n', &lines); | 249 base::SplitString(zone_path_contents, '\n', &lines); |
250 | 250 |
251 switch (lines.size()) { | 251 switch (lines.size()) { |
252 case 3: | 252 case 3: |
253 // optional empty line at end of file: | 253 // optional empty line at end of file: |
254 if (lines[2] != "") | 254 if (lines[2] != "") |
(...skipping 27 matching lines...) Expand all Loading... |
282 DCHECK(info_ != NULL); | 282 DCHECK(info_ != NULL); |
283 DCHECK_NE(0u, length_); | 283 DCHECK_NE(0u, length_); |
284 } | 284 } |
285 | 285 |
286 PermissionRestorer::~PermissionRestorer() { | 286 PermissionRestorer::~PermissionRestorer() { |
287 if (!RestorePermissionInfo(path_, info_, length_)) | 287 if (!RestorePermissionInfo(path_, info_, length_)) |
288 NOTREACHED(); | 288 NOTREACHED(); |
289 } | 289 } |
290 | 290 |
291 } // namespace file_util | 291 } // namespace file_util |
OLD | NEW |