Make certificate viewer a tab-modal dialog.
[chromium-blink-merge.git] / ppapi / shared_impl / ppb_file_ref_shared.h
bloba35a35fc069b54d48d8e2d727225daa440ca298a
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.
5 #ifndef PPAPI_SHARED_IMPL_PPB_FILE_REF_SHARED_H_
6 #define PPAPI_SHARED_IMPL_PPB_FILE_REF_SHARED_H_
8 #include <string>
10 #include "base/compiler_specific.h"
11 #include "ppapi/shared_impl/resource.h"
12 #include "ppapi/thunk/ppb_file_ref_api.h"
14 namespace ppapi {
16 class StringVar;
18 // FileRefs are created in a number of places and they include a number of
19 // return values. This struct encapsulates everything in one place.
20 struct PPB_FileRef_CreateInfo {
21 PPB_FileRef_CreateInfo() : file_system_type(PP_FILESYSTEMTYPE_EXTERNAL) {}
23 ppapi::HostResource resource;
24 int file_system_type; // One of PP_FileSystemType values.
25 std::string path;
26 std::string name;
28 // Since FileRef needs to hold a FileSystem reference, we need to pass the
29 // resource in this CreateInfo. Note that this is a plugin resource as
30 // FileSystem is already in new design.
31 PP_Resource file_system_plugin_resource;
34 // This class provides the shared implementation of a FileRef. The functions
35 // that actually "do stuff" like Touch and MakeDirectory are implemented
36 // differently for the proxied and non-proxied derived classes.
37 class PPAPI_SHARED_EXPORT PPB_FileRef_Shared
38 : public Resource,
39 public thunk::PPB_FileRef_API {
40 public:
41 PPB_FileRef_Shared(ResourceObjectType type,
42 const PPB_FileRef_CreateInfo& info);
43 virtual ~PPB_FileRef_Shared();
45 // Resource overrides.
46 virtual thunk::PPB_FileRef_API* AsPPB_FileRef_API() OVERRIDE;
48 // PPB_FileRef_API implementation (partial).
49 virtual PP_FileSystemType GetFileSystemType() const OVERRIDE;
50 virtual PP_Var GetName() const OVERRIDE;
51 virtual PP_Var GetPath() const OVERRIDE;
52 virtual const PPB_FileRef_CreateInfo& GetCreateInfo() const OVERRIDE;
53 virtual PP_Var GetAbsolutePath() = 0;
55 private:
56 PPB_FileRef_CreateInfo create_info_;
58 // Lazily initialized vars created from the create_info_. This is so we can
59 // return the identical string object every time they're requested.
60 mutable scoped_refptr<StringVar> name_var_;
61 mutable scoped_refptr<StringVar> path_var_;
63 DISALLOW_IMPLICIT_CONSTRUCTORS(PPB_FileRef_Shared);
66 } // namespace ppapi
68 #endif // PPAPI_SHARED_IMPL_PPB_FILE_REF_SHARED_H_