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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
74 int32_t PepperFileSystemHost::OnResourceMessageReceived( | 74 int32_t PepperFileSystemHost::OnResourceMessageReceived( |
75 const IPC::Message& msg, | 75 const IPC::Message& msg, |
76 ppapi::host::HostMessageContext* context) { | 76 ppapi::host::HostMessageContext* context) { |
77 IPC_BEGIN_MESSAGE_MAP(PepperFileSystemHost, msg) | 77 IPC_BEGIN_MESSAGE_MAP(PepperFileSystemHost, msg) |
78 PPAPI_DISPATCH_HOST_RESOURCE_CALL( | 78 PPAPI_DISPATCH_HOST_RESOURCE_CALL( |
79 PpapiHostMsg_FileSystem_Open, | 79 PpapiHostMsg_FileSystem_Open, |
80 OnHostMsgOpen) | 80 OnHostMsgOpen) |
81 PPAPI_DISPATCH_HOST_RESOURCE_CALL( | 81 PPAPI_DISPATCH_HOST_RESOURCE_CALL( |
82 PpapiHostMsg_FileSystem_InitIsolatedFileSystem, | 82 PpapiHostMsg_FileSystem_InitIsolatedFileSystem, |
83 OnHostMsgInitIsolatedFileSystem) | 83 OnHostMsgInitIsolatedFileSystem) |
84 PPAPI_DISPATCH_HOST_RESOURCE_CALL( | |
85 PpapiHostMsg_FileSystem_InitPluginPrivateFileSystem, | |
86 OnHostMsgInitPluginPrivateFileSystem) | |
84 IPC_END_MESSAGE_MAP() | 87 IPC_END_MESSAGE_MAP() |
85 return PP_ERROR_FAILED; | 88 return PP_ERROR_FAILED; |
86 } | 89 } |
87 | 90 |
88 bool PepperFileSystemHost::IsFileSystemHost() { | 91 bool PepperFileSystemHost::IsFileSystemHost() { |
89 return true; | 92 return true; |
90 } | 93 } |
91 | 94 |
92 void PepperFileSystemHost::DidOpenFileSystem( | 95 void PepperFileSystemHost::DidOpenFileSystem( |
93 const std::string& /* name_unused */, | 96 const std::string& /* name_unused */, |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
164 renderer_ppapi_host_->GetRenderViewForInstance(pp_instance()); | 167 renderer_ppapi_host_->GetRenderViewForInstance(pp_instance()); |
165 if (!view) | 168 if (!view) |
166 return PP_ERROR_FAILED; | 169 return PP_ERROR_FAILED; |
167 const GURL& url = view->GetWebView()->mainFrame()->document().url(); | 170 const GURL& url = view->GetWebView()->mainFrame()->document().url(); |
168 root_url_ = GURL(fileapi::GetIsolatedFileSystemRootURIString( | 171 root_url_ = GURL(fileapi::GetIsolatedFileSystemRootURIString( |
169 url.GetOrigin(), fsid, "crxfs")); | 172 url.GetOrigin(), fsid, "crxfs")); |
170 opened_ = true; | 173 opened_ = true; |
171 return PP_OK; | 174 return PP_OK; |
172 } | 175 } |
173 | 176 |
177 int32_t PepperFileSystemHost::OnHostMsgInitPluginPrivateFileSystem( | |
178 ppapi::host::HostMessageContext* context, | |
179 const std::string& fsid) { | |
180 // Do not allow multiple opens. | |
181 if (called_open_) | |
182 return PP_ERROR_INPROGRESS; | |
183 called_open_ = true; | |
184 | |
185 // Do a sanity check. | |
186 if (!LooksLikeAGuid(fsid)) | |
187 return PP_ERROR_BADARGUMENT; | |
188 | |
189 RenderView* view = | |
190 renderer_ppapi_host_->GetRenderViewForInstance(pp_instance()); | |
191 if (!view) | |
192 return PP_ERROR_FAILED; | |
193 const GURL& url = view->GetWebView()->mainFrame()->document().url(); | |
194 root_url_ = GURL(fileapi::GetIsolatedFileSystemRootURIString( | |
teravest
2013/10/29 17:14:11
There's a lot of duplication here with OnHostMsgIn
nhiroki
2013/11/12 13:36:15
Done.
| |
195 url.GetOrigin(), fsid, "PluginPrivate")); | |
196 opened_ = true; | |
197 return PP_OK; | |
198 } | |
199 | |
174 } // namespace content | 200 } // namespace content |
OLD | NEW |