Chromium Code Reviews| Index: services/files/directory_impl.cc |
| diff --git a/services/files/directory_impl.cc b/services/files/directory_impl.cc |
| index 279c3bd3558714efb9d6dad408cf91a66eb92204..b049de6493cae66e5918b0c0784b8fc9c75bdddc 100644 |
| --- a/services/files/directory_impl.cc |
| +++ b/services/files/directory_impl.cc |
| @@ -187,17 +187,18 @@ void DirectoryImpl::OpenFile(const String& path, |
| InterfaceRequest<File> file, |
| uint32_t open_flags, |
| const OpenFileCallback& callback) { |
| + Error error; |
| DCHECK(!path.is_null()); |
| DCHECK(dir_fd_.is_valid()); |
| - if (Error error = IsPathValid(path)) { |
| + if ((error = IsPathValid(path)) != ERROR_OK) { |
|
viettrungluu
2015/09/22 22:04:58
I think I'd prefer if you just did:
Error error =
johngro
2015/09/22 22:24:12
Done.
|
| callback.Run(error); |
| return; |
| } |
| // TODO(vtl): Make sure the path doesn't exit this directory (if appropriate). |
| // TODO(vtl): Maybe allow absolute paths? |
| - if (Error error = ValidateOpenFlags(open_flags, false)) { |
| + if ((error = ValidateOpenFlags(open_flags, false)) != ERROR_OK) { |
| callback.Run(error); |
| return; |
| } |
| @@ -232,17 +233,18 @@ void DirectoryImpl::OpenDirectory(const String& path, |
| InterfaceRequest<Directory> directory, |
| uint32_t open_flags, |
| const OpenDirectoryCallback& callback) { |
| + Error error; |
| DCHECK(!path.is_null()); |
| DCHECK(dir_fd_.is_valid()); |
| - if (Error error = IsPathValid(path)) { |
| + if ((error = IsPathValid(path)) != ERROR_OK) { |
| callback.Run(error); |
| return; |
| } |
| // TODO(vtl): Make sure the path doesn't exit this directory (if appropriate). |
| // TODO(vtl): Maybe allow absolute paths? |
| - if (Error error = ValidateOpenFlags(open_flags, false)) { |
| + if ((error = ValidateOpenFlags(open_flags, false)) != ERROR_OK) { |
| callback.Run(error); |
| return; |
| } |
| @@ -280,15 +282,16 @@ void DirectoryImpl::OpenDirectory(const String& path, |
| void DirectoryImpl::Rename(const String& path, |
| const String& new_path, |
| const RenameCallback& callback) { |
| + Error error; |
| DCHECK(!path.is_null()); |
| DCHECK(!new_path.is_null()); |
| DCHECK(dir_fd_.is_valid()); |
| - if (Error error = IsPathValid(path)) { |
| + if ((error = IsPathValid(path)) != ERROR_OK) { |
| callback.Run(error); |
| return; |
| } |
| - if (Error error = IsPathValid(new_path)) { |
| + if ((error = IsPathValid(new_path)) != ERROR_OK) { |
| callback.Run(error); |
| return; |
| } |
| @@ -306,16 +309,17 @@ void DirectoryImpl::Rename(const String& path, |
| void DirectoryImpl::Delete(const String& path, |
| uint32_t delete_flags, |
| const DeleteCallback& callback) { |
| + Error error; |
| DCHECK(!path.is_null()); |
| DCHECK(dir_fd_.is_valid()); |
| - if (Error error = IsPathValid(path)) { |
| + if ((error = IsPathValid(path)) != ERROR_OK) { |
| callback.Run(error); |
| return; |
| } |
| // TODO(vtl): See TODOs about |path| in OpenFile(). |
| - if (Error error = ValidateDeleteFlags(delete_flags)) { |
| + if ((error = ValidateDeleteFlags(delete_flags)) != ERROR_OK) { |
| callback.Run(error); |
| return; |
| } |