Chromium Code Reviews| 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 "ppapi/proxy/file_system_resource.h" | 5 #include "ppapi/proxy/file_system_resource.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "ipc/ipc_message.h" | 8 #include "ipc/ipc_message.h" |
| 9 #include "ppapi/c/pp_errors.h" | 9 #include "ppapi/c/pp_errors.h" |
| 10 #include "ppapi/proxy/ppapi_messages.h" | 10 #include "ppapi/proxy/ppapi_messages.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 87 this, | 87 this, |
| 88 callback)); | 88 callback)); |
| 89 Call<PpapiPluginMsg_FileSystem_InitIsolatedFileSystemReply>(BROWSER, | 89 Call<PpapiPluginMsg_FileSystem_InitIsolatedFileSystemReply>(BROWSER, |
| 90 PpapiHostMsg_FileSystem_InitIsolatedFileSystem(fsid), | 90 PpapiHostMsg_FileSystem_InitIsolatedFileSystem(fsid), |
| 91 base::Bind(&FileSystemResource::InitIsolatedFileSystemComplete, | 91 base::Bind(&FileSystemResource::InitIsolatedFileSystemComplete, |
| 92 this, | 92 this, |
| 93 callback)); | 93 callback)); |
| 94 return PP_OK_COMPLETIONPENDING; | 94 return PP_OK_COMPLETIONPENDING; |
| 95 } | 95 } |
| 96 | 96 |
| 97 int32_t FileSystemResource::OpenPluginPrivateFileSystem( | |
| 98 const base::Callback<void(int32_t)>& callback) { | |
| 99 // This call is mutually exclusive with Open() above, so we can reuse the | |
| 100 // called_open state. | |
| 101 DCHECK(type_ == PP_FILESYSTEMTYPE_ISOLATED); | |
| 102 if (called_open_) | |
| 103 return PP_ERROR_FAILED; | |
| 104 called_open_ = true; | |
| 105 | |
| 106 Call<PpapiPluginMsg_FileSystem_OpenPluginPrivateFileSystemReply>(BROWSER, | |
| 107 PpapiHostMsg_FileSystem_OpenPluginPrivateFileSystem(), | |
| 108 base::Bind(&FileSystemResource::OpenPluginPrivateFileSystemComplete, | |
| 109 this, | |
| 110 callback)); | |
| 111 | |
| 112 return PP_OK_COMPLETIONPENDING; | |
| 113 } | |
| 114 | |
| 97 void FileSystemResource::OpenComplete( | 115 void FileSystemResource::OpenComplete( |
| 98 scoped_refptr<TrackedCallback> callback, | 116 scoped_refptr<TrackedCallback> callback, |
| 99 const ResourceMessageReplyParams& params) { | 117 const ResourceMessageReplyParams& params) { |
| 100 ++callback_count_; | 118 ++callback_count_; |
| 101 // Received callback from browser and renderer. | 119 // Received callback from browser and renderer. |
| 102 if (callback_count_ == 2) | 120 if (callback_count_ == 2) |
| 103 callback->Run(params.result()); | 121 callback->Run(params.result()); |
| 104 } | 122 } |
| 105 | 123 |
| 106 void FileSystemResource::InitIsolatedFileSystemComplete( | 124 void FileSystemResource::InitIsolatedFileSystemComplete( |
| 107 const base::Callback<void(int32_t)>& callback, | 125 const base::Callback<void(int32_t)>& callback, |
| 108 const ResourceMessageReplyParams& params) { | 126 const ResourceMessageReplyParams& params) { |
| 109 ++callback_count_; | 127 ++callback_count_; |
| 110 // Received callback from browser and renderer. | 128 // Received callback from browser and renderer. |
| 111 if (callback_count_ == 2) | 129 if (callback_count_ == 2) |
| 112 callback.Run(params.result()); | 130 callback.Run(params.result()); |
| 113 } | 131 } |
| 114 | 132 |
| 133 void FileSystemResource::OpenPluginPrivateFileSystemComplete( | |
| 134 const base::Callback<void(int32_t)>& callback, | |
| 135 const ResourceMessageReplyParams& params, | |
| 136 const std::string& fsid) { | |
| 137 Call<PpapiPluginMsg_FileSystem_InitPluginPrivateFileSystemReply>(RENDERER, | |
|
teravest
2013/10/29 17:14:11
Why doesn't this call go to the BROWSER as well?
| |
| 138 PpapiHostMsg_FileSystem_InitPluginPrivateFileSystem(fsid), | |
| 139 base::Bind(&FileSystemResource::InitPluginPrivateFileSystemComplete, | |
| 140 this, | |
| 141 callback)); | |
| 142 } | |
| 143 | |
| 144 void FileSystemResource::InitPluginPrivateFileSystemComplete( | |
| 145 const base::Callback<void(int32_t)>& callback, | |
| 146 const ResourceMessageReplyParams& params) { | |
| 147 callback.Run(params.result()); | |
| 148 } | |
| 149 | |
| 115 } // namespace proxy | 150 } // namespace proxy |
| 116 } // namespace ppapi | 151 } // namespace ppapi |
| OLD | NEW |