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

Unified Diff: ppapi/proxy/ext_crx_file_system_private_resource.cc

Issue 14188019: CRX FileSystem Pepper private API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
Index: ppapi/proxy/ext_crx_file_system_private_resource.cc
diff --git a/ppapi/proxy/ext_crx_file_system_private_resource.cc b/ppapi/proxy/ext_crx_file_system_private_resource.cc
new file mode 100644
index 0000000000000000000000000000000000000000..9958768a0c691cb8d66fb020fe84e7d51f60b50c
--- /dev/null
+++ b/ppapi/proxy/ext_crx_file_system_private_resource.cc
@@ -0,0 +1,63 @@
+// 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/ext_crx_file_system_private_resource.h"
+
+#include "base/bind.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/proxy/resource_message_params.h"
+#include "ppapi/shared_impl/host_resource.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+
+namespace ppapi {
+namespace proxy {
+
+ExtCrxFileSystemPrivateResource::ExtCrxFileSystemPrivateResource(
+ Connection connection, PP_Instance instance)
+ : PluginResource(connection, instance) {
+ SendCreate(BROWSER, PpapiHostMsg_Ext_CrxFileSystem_Create());
+ SendCreate(RENDERER, PpapiHostMsg_Ext_CrxFileSystem_Create());
+}
+
+ExtCrxFileSystemPrivateResource::~ExtCrxFileSystemPrivateResource() {
+}
+
+thunk::PPB_Ext_CrxFileSystem_Private_API*
+ExtCrxFileSystemPrivateResource::AsPPB_Ext_CrxFileSystem_Private_API() {
+ return this;
+}
+
+int32_t ExtCrxFileSystemPrivateResource::Open(
+ scoped_refptr<TrackedCallback> callback) {
+ Call<PpapiPluginMsg_Ext_CrxFileSystem_BrowserOpenReply>(BROWSER,
+ PpapiBrowserHostMsg_Ext_CrxFileSystem_Open(),
+ base::Bind(&ExtCrxFileSystemPrivateResource::OnBrowserOpenComplete, this,
+ callback));
+ return PP_OK_COMPLETIONPENDING;
+}
+
+void ExtCrxFileSystemPrivateResource::OnBrowserOpenComplete(
+ scoped_refptr<TrackedCallback> callback,
+ const ResourceMessageReplyParams& params,
+ const std::string& origin,
+ const std::string& fsid) {
yzshen1 2013/04/30 19:31:19 Test whether callback is still pending before doin
victorhsieh 2013/04/30 22:04:32 Done.
+ if (params.result() != PP_OK) {
+ callback->Run(params.result());
+ return;
+ }
+ Call<PpapiPluginMsg_Ext_CrxFileSystem_RendererOpenReply>(RENDERER,
+ PpapiRendererHostMsg_Ext_CrxFileSystem_Open(origin, fsid),
+ base::Bind(&ExtCrxFileSystemPrivateResource::OnRendererOpenComplete, this,
+ callback));
+}
+
+void ExtCrxFileSystemPrivateResource::OnRendererOpenComplete(
+ scoped_refptr<TrackedCallback> callback,
+ const ResourceMessageReplyParams& params) {
+ callback->Run(params.result());
yzshen1 2013/04/30 19:31:19 ditto.
victorhsieh 2013/04/30 22:04:32 Done.
+}
+
+} // namespace proxy
+} // namespace ppapi

Powered by Google App Engine
This is Rietveld 408576698