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

Side by Side Diff: ppapi/proxy/file_system_resource.cc

Issue 13726024: Refactor FileSystem (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 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/file_system_resource.h"
6
7 #include "base/bind.h"
8 #include "ipc/ipc_message.h"
9 #include "ppapi/c/pp_errors.h"
10 #include "ppapi/proxy/ppapi_messages.h"
11
12 using ppapi::thunk::PPB_FileSystem_API;
13
14 namespace ppapi {
15 namespace proxy {
16
17 FileSystemResource::FileSystemResource(Connection connection,
18 PP_Instance instance,
19 PP_FileSystemType type)
20 : PluginResource(connection, instance),
21 type_(type),
22 called_open_(false) {
23 DCHECK(type_ != PP_FILESYSTEMTYPE_INVALID);
24 SendCreate(RENDERER, PpapiHostMsg_FileSystem_Create(type_));
25 }
26
27 FileSystemResource::~FileSystemResource() {
28 }
29
30 PPB_FileSystem_API* FileSystemResource::AsPPB_FileSystem_API() {
31 return this;
32 }
33
34 int32_t FileSystemResource::Open(int64_t expected_size,
35 scoped_refptr<TrackedCallback> callback) {
36 if (called_open_)
37 return PP_ERROR_FAILED;
38 called_open_ = true;
39
40 Call<PpapiPluginMsg_FileSystem_OpenReply>(RENDERER,
41 PpapiHostMsg_FileSystem_Open(expected_size),
42 base::Bind(&FileSystemResource::OpenComplete,
43 this,
44 callback));
45 return PP_OK_COMPLETIONPENDING;
46 }
47
48 PP_FileSystemType FileSystemResource::GetType() {
49 return type_;
50 }
51
52 void FileSystemResource::OpenComplete(
53 scoped_refptr<TrackedCallback> callback,
54 const ResourceMessageReplyParams& params,
55 const std::string& root_url) {
56 root_url_ = root_url;
57 callback->Run(params.result());
58 }
59
60 } // namespace proxy
61 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698