OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/glue/plugins/pepper_file_io.h" | 5 #include "webkit/glue/plugins/pepper_file_io.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/file_util_proxy.h" | 9 #include "base/file_util_proxy.h" |
10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 // static | 203 // static |
204 const PPB_FileIO_Dev* FileIO::GetInterface() { | 204 const PPB_FileIO_Dev* FileIO::GetInterface() { |
205 return &ppb_fileio; | 205 return &ppb_fileio; |
206 } | 206 } |
207 | 207 |
208 // static | 208 // static |
209 const PPB_FileIOTrusted_Dev* FileIO::GetTrustedInterface() { | 209 const PPB_FileIOTrusted_Dev* FileIO::GetTrustedInterface() { |
210 return &ppb_fileiotrusted; | 210 return &ppb_fileiotrusted; |
211 } | 211 } |
212 | 212 |
| 213 FileIO* FileIO::AsFileIO() { |
| 214 return this; |
| 215 } |
| 216 |
213 int32_t FileIO::Open(FileRef* file_ref, | 217 int32_t FileIO::Open(FileRef* file_ref, |
214 int32_t open_flags, | 218 int32_t open_flags, |
215 PP_CompletionCallback callback) { | 219 PP_CompletionCallback callback) { |
216 if (file_ != base::kInvalidPlatformFileValue) | 220 if (file_ != base::kInvalidPlatformFileValue) |
217 return PP_ERROR_FAILED; | 221 return PP_ERROR_FAILED; |
218 | 222 |
219 DCHECK(!callback_.func); | 223 DCHECK(!callback_.func); |
220 callback_ = callback; | 224 callback_ = callback; |
221 | 225 |
222 int flags = 0; | 226 int flags = 0; |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 | 428 |
425 void FileIO::ReadWriteCallback(base::PlatformFileError error_code, | 429 void FileIO::ReadWriteCallback(base::PlatformFileError error_code, |
426 int bytes_read_or_written) { | 430 int bytes_read_or_written) { |
427 if (error_code != base::PLATFORM_FILE_OK) | 431 if (error_code != base::PLATFORM_FILE_OK) |
428 RunPendingCallback(PlatformFileErrorToPepperError(error_code)); | 432 RunPendingCallback(PlatformFileErrorToPepperError(error_code)); |
429 else | 433 else |
430 RunPendingCallback(bytes_read_or_written); | 434 RunPendingCallback(bytes_read_or_written); |
431 } | 435 } |
432 | 436 |
433 } // namespace pepper | 437 } // namespace pepper |
OLD | NEW |