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

Side by Side 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: traits 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ppapi/proxy/ext_crx_file_system_private_resource.h"
6
7 #include "base/bind.h"
8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/proxy/ppapi_messages.h"
10 #include "ppapi/proxy/resource_message_params.h"
11 #include "ppapi/shared_impl/host_resource.h"
12 #include "ppapi/shared_impl/tracked_callback.h"
13
14 namespace ppapi {
15 namespace proxy {
16
17 ExtCrxFileSystemPrivateResource::ExtCrxFileSystemPrivateResource(
18 Connection connection, PP_Instance instance)
19 : PluginResource(connection, instance) {
20 SendCreate(BROWSER, PpapiHostMsg_Ext_CrxFileSystem_Create());
21 SendCreate(RENDERER, PpapiHostMsg_Ext_CrxFileSystem_Create());
22 }
23
24 ExtCrxFileSystemPrivateResource::~ExtCrxFileSystemPrivateResource() {
25 }
26
27 thunk::PPB_Ext_CrxFileSystem_Private_API*
28 ExtCrxFileSystemPrivateResource::AsPPB_Ext_CrxFileSystem_Private_API() {
29 return this;
30 }
31
32 int32_t ExtCrxFileSystemPrivateResource::Open(
33 scoped_refptr<TrackedCallback> callback) {
34 Call<PpapiPluginMsg_Ext_CrxFileSystem_BrowserOpenReply>(BROWSER,
35 PpapiBrowserHostMsg_Ext_CrxFileSystem_Open(),
36 base::Bind(&ExtCrxFileSystemPrivateResource::OnBrowserOpenComplete, this,
37 callback));
38 return PP_OK_COMPLETIONPENDING;
39 }
40
41 void ExtCrxFileSystemPrivateResource::OnBrowserOpenComplete(
42 scoped_refptr<TrackedCallback> callback,
43 const ResourceMessageReplyParams& params,
44 const std::string& origin,
45 const std::string& fsid) {
46 if (params.result() != PP_OK) {
47 callback->Run(params.result());
48 return;
49 }
50 Call<PpapiPluginMsg_Ext_CrxFileSystem_RendererOpenReply>(RENDERER,
51 PpapiRendererHostMsg_Ext_CrxFileSystem_Open(origin, fsid),
52 base::Bind(&ExtCrxFileSystemPrivateResource::OnRendererOpenComplete, this,
53 callback));
54 }
55
56 void ExtCrxFileSystemPrivateResource::OnRendererOpenComplete(
57 scoped_refptr<TrackedCallback> callback,
58 const ResourceMessageReplyParams& params) {
59 callback->Run(params.result());
60 }
61
62 } // namespace proxy
63 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698