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

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

Issue 21966004: Pepper: Move FileRef to the "new" resource proxy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Another rebase Created 7 years, 3 months 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 PepperFileSystemBrowserHost* fs_host = NULL; 56 PepperFileSystemBrowserHost* fs_host = NULL;
57 if (fs_resource_host->IsFileSystemHost()) 57 if (fs_resource_host->IsFileSystemHost())
58 fs_host = static_cast<PepperFileSystemBrowserHost*>(fs_resource_host); 58 fs_host = static_cast<PepperFileSystemBrowserHost*>(fs_resource_host);
59 if (fs_host == NULL) { 59 if (fs_host == NULL) {
60 DLOG(ERROR) << "Filesystem PP_Resource is not PepperFileSystemBrowserHost"; 60 DLOG(ERROR) << "Filesystem PP_Resource is not PepperFileSystemBrowserHost";
61 return; 61 return;
62 } 62 }
63 63
64 fs_type_ = fs_host->GetType(); 64 fs_type_ = fs_host->GetType();
65 // TODO(teravest): Add support for isolated filesystems.
66 if ((fs_type_ != PP_FILESYSTEMTYPE_LOCALPERSISTENT) && 65 if ((fs_type_ != PP_FILESYSTEMTYPE_LOCALPERSISTENT) &&
67 (fs_type_ != PP_FILESYSTEMTYPE_LOCALTEMPORARY)) { 66 (fs_type_ != PP_FILESYSTEMTYPE_LOCALTEMPORARY) &&
67 (fs_type_ != PP_FILESYSTEMTYPE_ISOLATED)) {
68 DLOG(ERROR) << "Unsupported filesystem type: " << fs_type_; 68 DLOG(ERROR) << "Unsupported filesystem type: " << fs_type_;
69 return; 69 return;
70 } 70 }
71 71
72 backend_.reset(new PepperInternalFileRefBackend( 72 backend_.reset(new PepperInternalFileRefBackend(
73 host->GetPpapiHost(), 73 host->GetPpapiHost(),
74 render_process_id, 74 render_process_id,
75 base::AsWeakPtr(fs_host), 75 base::AsWeakPtr(fs_host),
76 path)); 76 path));
77 } 77 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 PP_FileSystemType PepperFileRefHost::GetFileSystemType() const { 109 PP_FileSystemType PepperFileRefHost::GetFileSystemType() const {
110 return fs_type_; 110 return fs_type_;
111 } 111 }
112 112
113 fileapi::FileSystemURL PepperFileRefHost::GetFileSystemURL() const { 113 fileapi::FileSystemURL PepperFileRefHost::GetFileSystemURL() const {
114 if (backend_) 114 if (backend_)
115 return backend_->GetFileSystemURL(); 115 return backend_->GetFileSystemURL();
116 return fileapi::FileSystemURL(); 116 return fileapi::FileSystemURL();
117 } 117 }
118 118
119 std::string PepperFileRefHost::GetFileSystemURLSpec() const {
120 if (backend_)
121 return backend_->GetFileSystemURLSpec();
122 return std::string();
123 }
124
125 base::FilePath PepperFileRefHost::GetExternalPath() const {
126 if (backend_)
127 return backend_->GetExternalPath();
128 return base::FilePath();
129 }
130
131 int32_t PepperFileRefHost::CanRead() const { 119 int32_t PepperFileRefHost::CanRead() const {
132 if (backend_) 120 if (backend_)
133 return backend_->CanRead(); 121 return backend_->CanRead();
134 return PP_ERROR_FAILED; 122 return PP_ERROR_FAILED;
135 } 123 }
136 124
137 int32_t PepperFileRefHost::CanWrite() const { 125 int32_t PepperFileRefHost::CanWrite() const {
138 if (backend_) 126 if (backend_)
139 return backend_->CanWrite(); 127 return backend_->CanWrite();
140 return PP_ERROR_FAILED; 128 return PP_ERROR_FAILED;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 239
252 int32_t PepperFileRefHost::OnGetAbsolutePath( 240 int32_t PepperFileRefHost::OnGetAbsolutePath(
253 ppapi::host::HostMessageContext* context) { 241 ppapi::host::HostMessageContext* context) {
254 if (!host_->GetPpapiHost()->permissions().HasPermission( 242 if (!host_->GetPpapiHost()->permissions().HasPermission(
255 ppapi::PERMISSION_PRIVATE)) 243 ppapi::PERMISSION_PRIVATE))
256 return PP_ERROR_NOACCESS; 244 return PP_ERROR_NOACCESS;
257 return backend_->GetAbsolutePath(context->MakeReplyMessageContext()); 245 return backend_->GetAbsolutePath(context->MakeReplyMessageContext());
258 } 246 }
259 247
260 } // namespace content 248 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698