| 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_system.h" | 5 #include "webkit/glue/plugins/pepper_file_system.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/ref_counted.h" | 8 #include "base/ref_counted.h" |
| 9 #include "base/weak_ptr.h" | 9 #include "base/weak_ptr.h" |
| 10 #include "third_party/ppapi/c/dev/ppb_file_system_dev.h" | 10 #include "third_party/ppapi/c/dev/ppb_file_system_dev.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 } | 47 } |
| 48 | 48 |
| 49 virtual void DidOpenFileSystem(const std::string&, const FilePath&) { | 49 virtual void DidOpenFileSystem(const std::string&, const FilePath&) { |
| 50 NOTREACHED(); | 50 NOTREACHED(); |
| 51 } | 51 } |
| 52 | 52 |
| 53 virtual void DidFail(base::PlatformFileError error_code) { | 53 virtual void DidFail(base::PlatformFileError error_code) { |
| 54 RunCallback(error_code); | 54 RunCallback(error_code); |
| 55 } | 55 } |
| 56 | 56 |
| 57 virtual void DidWrite(int64 bytes, bool complete) { |
| 58 NOTREACHED(); |
| 59 } |
| 60 |
| 57 private: | 61 private: |
| 58 void RunCallback(base::PlatformFileError error_code) { | 62 void RunCallback(base::PlatformFileError error_code) { |
| 59 if (!module_.get() || !callback_.func) | 63 if (!module_.get() || !callback_.func) |
| 60 return; | 64 return; |
| 61 | 65 |
| 62 PP_RunCompletionCallback( | 66 PP_RunCompletionCallback( |
| 63 &callback_, pepper::PlatformFileErrorToPepperError(error_code)); | 67 &callback_, pepper::PlatformFileErrorToPepperError(error_code)); |
| 64 | 68 |
| 65 delete this; | 69 delete this; |
| 66 } | 70 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 } | 102 } |
| 99 | 103 |
| 100 virtual void DidOpenFileSystem(const std::string&, const FilePath&) { | 104 virtual void DidOpenFileSystem(const std::string&, const FilePath&) { |
| 101 NOTREACHED(); | 105 NOTREACHED(); |
| 102 } | 106 } |
| 103 | 107 |
| 104 virtual void DidFail(base::PlatformFileError error_code) { | 108 virtual void DidFail(base::PlatformFileError error_code) { |
| 105 RunCallback(error_code, base::PlatformFileInfo()); | 109 RunCallback(error_code, base::PlatformFileInfo()); |
| 106 } | 110 } |
| 107 | 111 |
| 112 virtual void DidWrite(int64 bytes, bool complete) { |
| 113 NOTREACHED(); |
| 114 } |
| 115 |
| 108 private: | 116 private: |
| 109 void RunCallback(base::PlatformFileError error_code, | 117 void RunCallback(base::PlatformFileError error_code, |
| 110 const base::PlatformFileInfo& file_info) { | 118 const base::PlatformFileInfo& file_info) { |
| 111 if (!module_.get() || !callback_.func) | 119 if (!module_.get() || !callback_.func) |
| 112 return; | 120 return; |
| 113 | 121 |
| 114 if (error_code == base::PLATFORM_FILE_OK) { | 122 if (error_code == base::PLATFORM_FILE_OK) { |
| 115 info_->size = file_info.size; | 123 info_->size = file_info.size; |
| 116 info_->creation_time = file_info.creation_time.ToDoubleT(); | 124 info_->creation_time = file_info.creation_time.ToDoubleT(); |
| 117 info_->last_access_time = file_info.last_accessed.ToDoubleT(); | 125 info_->last_access_time = file_info.last_accessed.ToDoubleT(); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 &Rename | 248 &Rename |
| 241 }; | 249 }; |
| 242 | 250 |
| 243 } // namespace | 251 } // namespace |
| 244 | 252 |
| 245 const PPB_FileSystem_Dev* FileSystem::GetInterface() { | 253 const PPB_FileSystem_Dev* FileSystem::GetInterface() { |
| 246 return &ppb_filesystem; | 254 return &ppb_filesystem; |
| 247 } | 255 } |
| 248 | 256 |
| 249 } // namespace pepper | 257 } // namespace pepper |
| OLD | NEW |