Index: base/files/file_path_watcher_browsertest.cc |
diff --git a/base/files/file_path_watcher_browsertest.cc b/base/files/file_path_watcher_browsertest.cc |
index 5ded1e819398b489c8d31669c58d40adb38008b2..14a25a137f2d5f894f859209f299ef65b287a95c 100644 |
--- a/base/files/file_path_watcher_browsertest.cc |
+++ b/base/files/file_path_watcher_browsertest.cc |
@@ -768,8 +768,8 @@ enum Permission { |
Execute |
}; |
+#if defined(OS_MACOSX) |
bool ChangeFilePermissions(const FilePath& path, Permission perm, bool allow) { |
-#if defined(OS_POSIX) |
struct stat stat_buf; |
if (stat(path.value().c_str(), &stat_buf) != 0) |
@@ -796,61 +796,8 @@ bool ChangeFilePermissions(const FilePath& path, Permission perm, bool allow) { |
stat_buf.st_mode &= ~mode; |
} |
return chmod(path.value().c_str(), stat_buf.st_mode) == 0; |
- |
-#elif defined(OS_WIN) |
- PACL old_dacl; |
- PSECURITY_DESCRIPTOR security_descriptor; |
- if (GetNamedSecurityInfo(const_cast<wchar_t*>(path.value().c_str()), |
- SE_FILE_OBJECT, |
- DACL_SECURITY_INFORMATION, NULL, NULL, &old_dacl, |
- NULL, &security_descriptor) != ERROR_SUCCESS) |
- return false; |
- |
- DWORD mode = 0; |
- switch (perm) { |
- case Read: |
- mode = GENERIC_READ; |
- break; |
- case Write: |
- mode = GENERIC_WRITE; |
- break; |
- case Execute: |
- mode = GENERIC_EXECUTE; |
- break; |
- default: |
- ADD_FAILURE() << "unknown perm " << perm; |
- return false; |
- } |
- |
- // Deny Read access for the current user. |
- EXPLICIT_ACCESS change; |
- change.grfAccessPermissions = mode; |
- change.grfAccessMode = allow ? GRANT_ACCESS : DENY_ACCESS; |
- change.grfInheritance = 0; |
- change.Trustee.pMultipleTrustee = NULL; |
- change.Trustee.MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; |
- change.Trustee.TrusteeForm = TRUSTEE_IS_NAME; |
- change.Trustee.TrusteeType = TRUSTEE_IS_USER; |
- change.Trustee.ptstrName = L"CURRENT_USER"; |
- |
- PACL new_dacl; |
- if (SetEntriesInAcl(1, &change, old_dacl, &new_dacl) != ERROR_SUCCESS) { |
- LocalFree(security_descriptor); |
- return false; |
- } |
- |
- DWORD rc = SetNamedSecurityInfo(const_cast<wchar_t*>(path.value().c_str()), |
- SE_FILE_OBJECT, DACL_SECURITY_INFORMATION, |
- NULL, NULL, new_dacl, NULL); |
- LocalFree(security_descriptor); |
- LocalFree(new_dacl); |
- |
- return rc == ERROR_SUCCESS; |
-#else |
- NOTIMPLEMENTED(); |
- return false; |
-#endif |
Nico
2013/11/10 05:07:09
Can you add BUG=78045 to the cl description?
hans
2013/11/11 19:29:51
Done.
|
} |
+#endif // defined(OS_MACOSX) |
#if defined(OS_MACOSX) |
// Linux implementation of FilePathWatcher doesn't catch attribute changes. |