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

Side by Side Diff: ppapi/cpp/trusted/file_io_trusted.cc

Issue 8965007: Add FileIOTrusted class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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 | Annotate | Revision Log
« no previous file with comments | « ppapi/cpp/trusted/file_io_trusted.h ('k') | ppapi/ppapi_sources.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2011 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/cpp/trusted/file_io_trusted.h"
6
7 #include "ppapi/c/pp_errors.h"
8 #include "ppapi/c/trusted/ppb_file_io_trusted.h"
9 #include "ppapi/cpp/completion_callback.h"
10 #include "ppapi/cpp/file_io.h"
11 #include "ppapi/cpp/module_impl.h"
12
13 namespace pp {
14
15 namespace {
16
17 template <> const char* interface_name<PPB_FileIOTrusted>() {
18 return PPB_FILEIOTRUSTED_INTERFACE_0_4;
19 }
20
21 } // namespace
22
23 FileIO_Trusted::FileIO_Trusted() {
24 }
25
26 int32_t FileIO_Trusted::GetOSFileDescriptor(const FileIO& file_io) {
27 const int32_t kInvalidOSFileDescriptor = -1;
28 if (!has_interface<PPB_FileIOTrusted>())
29 return kInvalidOSFileDescriptor;
30 return get_interface<PPB_FileIOTrusted>()->GetOSFileDescriptor(
31 file_io.pp_resource());
32 }
33
34 int32_t FileIO_Trusted::WillWrite(const FileIO& file_io,
35 int64_t offset,
36 int32_t bytes_to_write,
37 const CompletionCallback& callback) {
38 if (!has_interface<PPB_FileIOTrusted>())
39 return callback.MayForce(PP_ERROR_NOINTERFACE);
40 return get_interface<PPB_FileIOTrusted>()->WillWrite(
41 file_io.pp_resource(), offset, bytes_to_write,
42 callback.pp_completion_callback());
43 }
44
45 int32_t FileIO_Trusted::WillSetLength(const FileIO& file_io,
46 int64_t length,
47 const CompletionCallback& callback) {
48 if (!has_interface<PPB_FileIOTrusted>())
49 return callback.MayForce(PP_ERROR_NOINTERFACE);
50 return get_interface<PPB_FileIOTrusted>()->WillSetLength(
51 file_io.pp_resource(), length, callback.pp_completion_callback());
52 }
53
54 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/cpp/trusted/file_io_trusted.h ('k') | ppapi/ppapi_sources.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698