Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: trunk/src/content/browser/renderer_host/pepper/pepper_file_ref_host.cc

Issue 60323002: Revert 232547 "Pepper: Move FileIO host from renderer to browser." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/browser/renderer_host/pepper/pepper_file_ref_host.h" 5 #include "content/browser/renderer_host/pepper/pepper_file_ref_host.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "content/browser/renderer_host/pepper/pepper_external_file_ref_backend. h" 9 #include "content/browser/renderer_host/pepper/pepper_external_file_ref_backend. h"
10 #include "content/browser/renderer_host/pepper/pepper_file_system_browser_host.h " 10 #include "content/browser/renderer_host/pepper/pepper_file_system_browser_host.h "
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 } 46 }
47 47
48 ResourceHost* fs_resource_host = 48 ResourceHost* fs_resource_host =
49 host->GetPpapiHost()->GetResourceHost(file_system); 49 host->GetPpapiHost()->GetResourceHost(file_system);
50 if (fs_resource_host == NULL) { 50 if (fs_resource_host == NULL) {
51 DLOG(ERROR) << "Couldn't find FileSystem host: " << resource 51 DLOG(ERROR) << "Couldn't find FileSystem host: " << resource
52 << " path: " << path; 52 << " path: " << path;
53 return; 53 return;
54 } 54 }
55 55
56 if (!fs_resource_host->IsFileSystemHost()) { 56 PepperFileSystemBrowserHost* fs_host = NULL;
57 if (fs_resource_host->IsFileSystemHost())
58 fs_host = static_cast<PepperFileSystemBrowserHost*>(fs_resource_host);
59 if (fs_host == NULL) {
57 DLOG(ERROR) << "Filesystem PP_Resource is not PepperFileSystemBrowserHost"; 60 DLOG(ERROR) << "Filesystem PP_Resource is not PepperFileSystemBrowserHost";
58 return; 61 return;
59 } 62 }
60 63
61 PepperFileSystemBrowserHost* file_system_host = 64 fs_type_ = fs_host->GetType();
62 static_cast<PepperFileSystemBrowserHost*>(fs_resource_host);
63 fs_type_ = file_system_host->GetType();
64 if ((fs_type_ != PP_FILESYSTEMTYPE_LOCALPERSISTENT) && 65 if ((fs_type_ != PP_FILESYSTEMTYPE_LOCALPERSISTENT) &&
65 (fs_type_ != PP_FILESYSTEMTYPE_LOCALTEMPORARY) && 66 (fs_type_ != PP_FILESYSTEMTYPE_LOCALTEMPORARY) &&
66 (fs_type_ != PP_FILESYSTEMTYPE_ISOLATED)) { 67 (fs_type_ != PP_FILESYSTEMTYPE_ISOLATED)) {
67 DLOG(ERROR) << "Unsupported filesystem type: " << fs_type_; 68 DLOG(ERROR) << "Unsupported filesystem type: " << fs_type_;
68 return; 69 return;
69 } 70 }
70 71
71 backend_.reset(new PepperInternalFileRefBackend( 72 backend_.reset(new PepperInternalFileRefBackend(
72 host->GetPpapiHost(), 73 host->GetPpapiHost(),
73 render_process_id, 74 render_process_id,
74 file_system_host->AsWeakPtr(), 75 base::AsWeakPtr(fs_host),
75 path)); 76 path));
76 } 77 }
77 78
78 PepperFileRefHost::PepperFileRefHost(BrowserPpapiHost* host, 79 PepperFileRefHost::PepperFileRefHost(BrowserPpapiHost* host,
79 PP_Instance instance, 80 PP_Instance instance,
80 PP_Resource resource, 81 PP_Resource resource,
81 const base::FilePath& external_path) 82 const base::FilePath& external_path)
82 : ResourceHost(host->GetPpapiHost(), instance, resource), 83 : ResourceHost(host->GetPpapiHost(), instance, resource),
83 host_(host), 84 host_(host),
84 fs_type_(PP_FILESYSTEMTYPE_EXTERNAL) { 85 fs_type_(PP_FILESYSTEMTYPE_EXTERNAL) {
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 245
245 int32_t PepperFileRefHost::OnGetAbsolutePath( 246 int32_t PepperFileRefHost::OnGetAbsolutePath(
246 ppapi::host::HostMessageContext* context) { 247 ppapi::host::HostMessageContext* context) {
247 if (!host_->GetPpapiHost()->permissions().HasPermission( 248 if (!host_->GetPpapiHost()->permissions().HasPermission(
248 ppapi::PERMISSION_PRIVATE)) 249 ppapi::PERMISSION_PRIVATE))
249 return PP_ERROR_NOACCESS; 250 return PP_ERROR_NOACCESS;
250 return backend_->GetAbsolutePath(context->MakeReplyMessageContext()); 251 return backend_->GetAbsolutePath(context->MakeReplyMessageContext());
251 } 252 }
252 253
253 } // namespace content 254 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698