OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "webkit/browser/fileapi/remove_operation_delegate.h" | 5 #include "webkit/browser/fileapi/remove_operation_delegate.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "webkit/browser/fileapi/file_system_context.h" | 8 #include "webkit/browser/fileapi/file_system_context.h" |
9 #include "webkit/browser/fileapi/file_system_operation_runner.h" | 9 #include "webkit/browser/fileapi/file_system_operation_runner.h" |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 void RemoveOperationDelegate::ProcessFile(const FileSystemURL& url, | 34 void RemoveOperationDelegate::ProcessFile(const FileSystemURL& url, |
35 const StatusCallback& callback) { | 35 const StatusCallback& callback) { |
36 operation_runner()->RemoveFile( | 36 operation_runner()->RemoveFile( |
37 url, | 37 url, |
38 base::Bind(&RemoveOperationDelegate::DidRemoveFile, | 38 base::Bind(&RemoveOperationDelegate::DidRemoveFile, |
39 weak_factory_.GetWeakPtr(), callback)); | 39 weak_factory_.GetWeakPtr(), callback)); |
40 } | 40 } |
41 | 41 |
42 void RemoveOperationDelegate::ProcessDirectory(const FileSystemURL& url, | 42 void RemoveOperationDelegate::ProcessDirectory(const FileSystemURL& url, |
43 const StatusCallback& callback) { | 43 const StatusCallback& callback) { |
44 callback.Run(base::PLATFORM_FILE_OK); | 44 callback.Run(base::File::FILE_OK); |
45 } | 45 } |
46 | 46 |
47 void RemoveOperationDelegate::PostProcessDirectory( | 47 void RemoveOperationDelegate::PostProcessDirectory( |
48 const FileSystemURL& url, const StatusCallback& callback) { | 48 const FileSystemURL& url, const StatusCallback& callback) { |
49 operation_runner()->RemoveDirectory(url, callback); | 49 operation_runner()->RemoveDirectory(url, callback); |
50 } | 50 } |
51 | 51 |
52 void RemoveOperationDelegate::DidTryRemoveFile( | 52 void RemoveOperationDelegate::DidTryRemoveFile(base::File::Error error) { |
53 base::PlatformFileError error) { | 53 if (error != base::File::FILE_ERROR_NOT_A_FILE && |
54 if (error != base::PLATFORM_FILE_ERROR_NOT_A_FILE && | 54 error != base::File::FILE_ERROR_SECURITY) { |
55 error != base::PLATFORM_FILE_ERROR_SECURITY) { | |
56 callback_.Run(error); | 55 callback_.Run(error); |
57 return; | 56 return; |
58 } | 57 } |
59 operation_runner()->RemoveDirectory( | 58 operation_runner()->RemoveDirectory( |
60 url_, | 59 url_, |
61 base::Bind(&RemoveOperationDelegate::DidTryRemoveDirectory, | 60 base::Bind(&RemoveOperationDelegate::DidTryRemoveDirectory, |
62 weak_factory_.GetWeakPtr(), error)); | 61 weak_factory_.GetWeakPtr(), error)); |
63 } | 62 } |
64 | 63 |
65 void RemoveOperationDelegate::DidTryRemoveDirectory( | 64 void RemoveOperationDelegate::DidTryRemoveDirectory( |
66 base::PlatformFileError remove_file_error, | 65 base::File::Error remove_file_error, |
67 base::PlatformFileError remove_directory_error) { | 66 base::File::Error remove_directory_error) { |
68 callback_.Run( | 67 callback_.Run( |
69 remove_directory_error == base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY ? | 68 remove_directory_error == base::File::FILE_ERROR_NOT_A_DIRECTORY ? |
70 remove_file_error : | 69 remove_file_error : |
71 remove_directory_error); | 70 remove_directory_error); |
72 } | 71 } |
73 | 72 |
74 void RemoveOperationDelegate::DidRemoveFile(const StatusCallback& callback, | 73 void RemoveOperationDelegate::DidRemoveFile(const StatusCallback& callback, |
75 base::PlatformFileError error) { | 74 base::File::Error error) { |
76 if (error == base::PLATFORM_FILE_ERROR_NOT_FOUND) { | 75 if (error == base::File::FILE_ERROR_NOT_FOUND) { |
77 callback.Run(base::PLATFORM_FILE_OK); | 76 callback.Run(base::File::FILE_OK); |
78 return; | 77 return; |
79 } | 78 } |
80 callback.Run(error); | 79 callback.Run(error); |
81 } | 80 } |
82 | 81 |
83 } // namespace fileapi | 82 } // namespace fileapi |
OLD | NEW |