| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/plugins/ppapi/file_callbacks.h" | 5 #include "webkit/plugins/ppapi/file_callbacks.h" |
| 6 | 6 |
| 7 #include "base/file_path.h" | |
| 8 #include "base/logging.h" | 7 #include "base/logging.h" |
| 9 #include "ppapi/c/dev/ppb_file_system_dev.h" | 8 #include "ppapi/c/dev/ppb_file_system_dev.h" |
| 10 #include "ppapi/c/dev/pp_file_info_dev.h" | 9 #include "ppapi/c/dev/pp_file_info_dev.h" |
| 11 #include "ppapi/c/pp_errors.h" | 10 #include "ppapi/c/pp_errors.h" |
| 12 #include "webkit/plugins/ppapi/callbacks.h" | 11 #include "webkit/plugins/ppapi/callbacks.h" |
| 13 #include "webkit/plugins/ppapi/error_util.h" | 12 #include "webkit/plugins/ppapi/error_util.h" |
| 14 #include "webkit/plugins/ppapi/plugin_module.h" | 13 #include "webkit/plugins/ppapi/plugin_module.h" |
| 15 #include "webkit/plugins/ppapi/ppb_directory_reader_impl.h" | 14 #include "webkit/plugins/ppapi/ppb_directory_reader_impl.h" |
| 16 #include "webkit/plugins/ppapi/ppb_file_system_impl.h" | 15 #include "webkit/plugins/ppapi/ppb_file_system_impl.h" |
| 17 #include "webkit/fileapi/file_system_types.h" | 16 #include "webkit/fileapi/file_system_types.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 if (callback_->completed()) | 68 if (callback_->completed()) |
| 70 return; | 69 return; |
| 71 | 70 |
| 72 DCHECK(directory_reader_); | 71 DCHECK(directory_reader_); |
| 73 directory_reader_->AddNewEntries(entries, has_more); | 72 directory_reader_->AddNewEntries(entries, has_more); |
| 74 | 73 |
| 75 callback_->Run(PP_OK); | 74 callback_->Run(PP_OK); |
| 76 } | 75 } |
| 77 | 76 |
| 78 void FileCallbacks::DidOpenFileSystem(const std::string&, | 77 void FileCallbacks::DidOpenFileSystem(const std::string&, |
| 79 const FilePath& root_path) { | 78 const GURL& root_url) { |
| 80 if (callback_->completed()) | 79 if (callback_->completed()) |
| 81 return; | 80 return; |
| 82 | 81 |
| 83 DCHECK(file_system_); | 82 DCHECK(file_system_); |
| 84 file_system_->set_root_path(root_path); | 83 file_system_->set_root_url(root_url); |
| 85 file_system_->set_opened(true); | 84 file_system_->set_opened(true); |
| 86 | 85 |
| 87 callback_->Run(PP_OK); | 86 callback_->Run(PP_OK); |
| 88 } | 87 } |
| 89 | 88 |
| 90 void FileCallbacks::DidFail(base::PlatformFileError error_code) { | 89 void FileCallbacks::DidFail(base::PlatformFileError error_code) { |
| 91 RunCallback(error_code); | 90 RunCallback(error_code); |
| 92 } | 91 } |
| 93 | 92 |
| 94 void FileCallbacks::DidWrite(int64 bytes, bool complete) { | 93 void FileCallbacks::DidWrite(int64 bytes, bool complete) { |
| 95 NOTREACHED(); | 94 NOTREACHED(); |
| 96 } | 95 } |
| 97 | 96 |
| 98 void FileCallbacks::RunCallback(base::PlatformFileError error_code) { | 97 void FileCallbacks::RunCallback(base::PlatformFileError error_code) { |
| 99 if (callback_->completed()) | 98 if (callback_->completed()) |
| 100 return; | 99 return; |
| 101 | 100 |
| 102 callback_->Run(PlatformFileErrorToPepperError(error_code)); | 101 callback_->Run(PlatformFileErrorToPepperError(error_code)); |
| 103 } | 102 } |
| 104 | 103 |
| 105 } // namespace ppapi | 104 } // namespace ppapi |
| 106 } // namespace webkit | 105 } // namespace webkit |
| OLD | NEW |