| 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 "content/renderer/pepper/pepper_file_system_host.h" | 5 #include "content/renderer/pepper/pepper_file_system_host.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "content/child/child_thread.h" | 9 #include "content/child/child_thread.h" |
| 10 #include "content/child/fileapi/file_system_dispatcher.h" | 10 #include "content/child/fileapi/file_system_dispatcher.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 PepperFileSystemHost::PepperFileSystemHost(RendererPpapiHost* host, | 27 PepperFileSystemHost::PepperFileSystemHost(RendererPpapiHost* host, |
| 28 PP_Instance instance, | 28 PP_Instance instance, |
| 29 PP_Resource resource, | 29 PP_Resource resource, |
| 30 PP_FileSystemType type) | 30 PP_FileSystemType type) |
| 31 : ResourceHost(host->GetPpapiHost(), instance, resource), | 31 : ResourceHost(host->GetPpapiHost(), instance, resource), |
| 32 renderer_ppapi_host_(host), | 32 renderer_ppapi_host_(host), |
| 33 type_(type), | 33 type_(type), |
| 34 opened_(false), | 34 opened_(false), |
| 35 called_open_(false), | 35 called_open_(false), |
| 36 weak_factory_(this) { | 36 weak_factory_(this) {} |
| 37 } | |
| 38 | 37 |
| 39 PepperFileSystemHost::PepperFileSystemHost(RendererPpapiHost* host, | 38 PepperFileSystemHost::PepperFileSystemHost(RendererPpapiHost* host, |
| 40 PP_Instance instance, | 39 PP_Instance instance, |
| 41 PP_Resource resource, | 40 PP_Resource resource, |
| 42 const GURL& root_url, | 41 const GURL& root_url, |
| 43 PP_FileSystemType type) | 42 PP_FileSystemType type) |
| 44 : ResourceHost(host->GetPpapiHost(), instance, resource), | 43 : ResourceHost(host->GetPpapiHost(), instance, resource), |
| 45 renderer_ppapi_host_(host), | 44 renderer_ppapi_host_(host), |
| 46 type_(type), | 45 type_(type), |
| 47 opened_(true), | 46 opened_(true), |
| 48 root_url_(root_url), | 47 root_url_(root_url), |
| 49 called_open_(true), | 48 called_open_(true), |
| 50 weak_factory_(this) { | 49 weak_factory_(this) {} |
| 51 } | |
| 52 | 50 |
| 53 PepperFileSystemHost::~PepperFileSystemHost() { | 51 PepperFileSystemHost::~PepperFileSystemHost() {} |
| 54 } | |
| 55 | 52 |
| 56 int32_t PepperFileSystemHost::OnResourceMessageReceived( | 53 int32_t PepperFileSystemHost::OnResourceMessageReceived( |
| 57 const IPC::Message& msg, | 54 const IPC::Message& msg, |
| 58 ppapi::host::HostMessageContext* context) { | 55 ppapi::host::HostMessageContext* context) { |
| 59 IPC_BEGIN_MESSAGE_MAP(PepperFileSystemHost, msg) | 56 IPC_BEGIN_MESSAGE_MAP(PepperFileSystemHost, msg) |
| 60 PPAPI_DISPATCH_HOST_RESOURCE_CALL( | 57 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FileSystem_Open, OnHostMsgOpen) |
| 61 PpapiHostMsg_FileSystem_Open, | 58 PPAPI_DISPATCH_HOST_RESOURCE_CALL( |
| 62 OnHostMsgOpen) | 59 PpapiHostMsg_FileSystem_InitIsolatedFileSystem, |
| 63 PPAPI_DISPATCH_HOST_RESOURCE_CALL( | 60 OnHostMsgInitIsolatedFileSystem) |
| 64 PpapiHostMsg_FileSystem_InitIsolatedFileSystem, | |
| 65 OnHostMsgInitIsolatedFileSystem) | |
| 66 IPC_END_MESSAGE_MAP() | 61 IPC_END_MESSAGE_MAP() |
| 67 return PP_ERROR_FAILED; | 62 return PP_ERROR_FAILED; |
| 68 } | 63 } |
| 69 | 64 |
| 70 bool PepperFileSystemHost::IsFileSystemHost() { | 65 bool PepperFileSystemHost::IsFileSystemHost() { return true; } |
| 71 return true; | |
| 72 } | |
| 73 | 66 |
| 74 void PepperFileSystemHost::DidOpenFileSystem( | 67 void PepperFileSystemHost::DidOpenFileSystem( |
| 75 const std::string& /* name_unused */, | 68 const std::string& /* name_unused */, |
| 76 const GURL& root) { | 69 const GURL& root) { |
| 77 opened_ = true; | 70 opened_ = true; |
| 78 root_url_ = root; | 71 root_url_ = root; |
| 79 reply_context_.params.set_result(PP_OK); | 72 reply_context_.params.set_result(PP_OK); |
| 80 host()->SendReply(reply_context_, PpapiPluginMsg_FileSystem_OpenReply()); | 73 host()->SendReply(reply_context_, PpapiPluginMsg_FileSystem_OpenReply()); |
| 81 reply_context_ = ppapi::host::ReplyMessageContext(); | 74 reply_context_ = ppapi::host::ReplyMessageContext(); |
| 82 } | 75 } |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 const std::string root_name = ppapi::IsolatedFileSystemTypeToRootName(type); | 134 const std::string root_name = ppapi::IsolatedFileSystemTypeToRootName(type); |
| 142 if (root_name.empty()) | 135 if (root_name.empty()) |
| 143 return PP_ERROR_BADARGUMENT; | 136 return PP_ERROR_BADARGUMENT; |
| 144 root_url_ = GURL(fileapi::GetIsolatedFileSystemRootURIString( | 137 root_url_ = GURL(fileapi::GetIsolatedFileSystemRootURIString( |
| 145 url.GetOrigin(), fsid, root_name)); | 138 url.GetOrigin(), fsid, root_name)); |
| 146 opened_ = true; | 139 opened_ = true; |
| 147 return PP_OK; | 140 return PP_OK; |
| 148 } | 141 } |
| 149 | 142 |
| 150 } // namespace content | 143 } // namespace content |
| OLD | NEW |