| 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) {
|
| + 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());
|
| +}
|
| +
|
| +} // namespace proxy
|
| +} // namespace ppapi
|
|
|