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

Unified Diff: ppapi/proxy/file_system_resource.cc

Issue 13726024: Refactor FileSystem (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: NON_EXPORTED_BASE Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/proxy/file_system_resource.h ('k') | ppapi/proxy/interface_list.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/file_system_resource.cc
diff --git a/ppapi/proxy/file_system_resource.cc b/ppapi/proxy/file_system_resource.cc
new file mode 100644
index 0000000000000000000000000000000000000000..6d8e641733c74b55597fc8fa882a898112060254
--- /dev/null
+++ b/ppapi/proxy/file_system_resource.cc
@@ -0,0 +1,60 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/proxy/file_system_resource.h"
+
+#include "base/bind.h"
+#include "ipc/ipc_message.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+
+using ppapi::thunk::PPB_FileSystem_API;
+
+namespace ppapi {
+namespace proxy {
+
+FileSystemResource::FileSystemResource(Connection connection,
+ PP_Instance instance,
+ PP_FileSystemType type)
+ : PluginResource(connection, instance),
+ type_(type),
+ called_open_(false) {
+ DCHECK(type_ != PP_FILESYSTEMTYPE_INVALID);
+ SendCreate(RENDERER, PpapiHostMsg_FileSystem_Create(type_));
+}
+
+FileSystemResource::~FileSystemResource() {
+}
+
+PPB_FileSystem_API* FileSystemResource::AsPPB_FileSystem_API() {
+ return this;
+}
+
+int32_t FileSystemResource::Open(int64_t expected_size,
+ scoped_refptr<TrackedCallback> callback) {
+ if (called_open_)
+ return PP_ERROR_FAILED;
+ called_open_ = true;
+
+ Call<PpapiPluginMsg_FileSystem_OpenReply>(RENDERER,
+ PpapiHostMsg_FileSystem_Open(expected_size),
+ base::Bind(&FileSystemResource::OpenComplete,
+ this,
+ callback));
+ return PP_OK_COMPLETIONPENDING;
+}
+
+PP_FileSystemType FileSystemResource::GetType() {
+ return type_;
+}
+
+void FileSystemResource::OpenComplete(
+ scoped_refptr<TrackedCallback> callback,
+ const ResourceMessageReplyParams& params) {
+ callback->Run(params.result());
+}
+
+} // namespace proxy
+} // namespace ppapi
« no previous file with comments | « ppapi/proxy/file_system_resource.h ('k') | ppapi/proxy/interface_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698