Pepper_31_C++_interfaces
file_system.h
Go to the documentation of this file.
1 // Copyright (c) 2012 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 #ifndef PPAPI_CPP_FILE_SYSTEM_H_
6 #define PPAPI_CPP_FILE_SYSTEM_H_
7 
8 #include "ppapi/c/pp_file_info.h"
9 #include "ppapi/c/pp_instance.h"
10 #include "ppapi/c/pp_stdint.h"
11 #include "ppapi/c/pp_time.h"
12 #include "ppapi/cpp/instance.h"
13 #include "ppapi/cpp/resource.h"
14 
15 /// @file
16 /// This file defines the API to create a file system associated with a file.
17 
18 namespace pp {
19 
20 class CompletionCallback;
21 
22 /// The <code>FileSystem</code> class identifies the file system type
23 /// associated with a file.
24 class FileSystem : public Resource {
25  public:
26  /// Constructs an is_null() filesystem resource. If you use this constructor,
27  /// you will have to assign it to a "real" FileSystem object before you can
28  /// use it.
29  FileSystem();
30 
31  /// The copy constructor for <code>FileSystem</code>.
32  ///
33  /// @param[in] other A reference to a <code>FileSystem</code>.
34  FileSystem(const FileSystem& other);
35 
36  /// A constructor used when you have received a PP_Resource as a return
37  /// value that has already been reference counted.
38  ///
39  /// @param[in] resource A PP_Resource corresponding to a PPB_FileSystem.
40  FileSystem(PassRef, PP_Resource resource);
41 
42  /// This constructor creates a file system object of the given type.
43  ///
44  /// @param[in] instance The instance with which this resource will be
45  /// associated.
46  ///
47  /// @param[in] type A file system type as defined by
48  /// <code>PP_FileSystemType</code> enum.
49  FileSystem(const InstanceHandle& instance, PP_FileSystemType type);
50 
51  /**
52  * Determines if the interface is supported by the browser.
53  *
54  * @return A <code>bool</code> containing <code>true</code> if the given
55  * resource is available, otherwise <code>false</code>.
56  */
57  static bool IsAvailable();
58 
59  /// Open() opens the file system. A file system must be opened before running
60  /// any other operation on it.
61  ///
62  /// @param[in] expected_size The expected size of the file system. Note that
63  /// this does not request quota; to do that, you must either invoke
64  /// requestQuota from JavaScript:
65  /// http://www.html5rocks.com/en/tutorials/file/filesystem/#toc-requesting-quota
66  /// or set the unlimitedStorage permission for Chrome Web Store apps:
67  /// http://code.google.com/chrome/extensions/manifest.html#permissions
68  ///
69  /// @param[in] cc A <code>PP_CompletionCallback</code> to be called upon
70  /// completion of Open().
71  ///
72  /// @return An int32_t containing an error code from <code>pp_errors.h</code>.
73  int32_t Open(int64_t expected_size, const CompletionCallback& cc);
74 };
75 
76 } // namespace pp
77 
78 #endif // PPAPI_CPP_FILE_SYSTEM_H_
static bool IsAvailable()
PassRef
Definition: pass_ref.h:17
A reference counted module resource.
Definition: resource.h:18
int32_t Open(int64_t expected_size, const CompletionCallback &cc)