OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ppapi/shared_impl/file_ref_impl.h" | 5 #include "ppapi/shared_impl/file_ref_impl.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ppapi/shared_impl/ppapi_globals.h" | |
9 #include "ppapi/shared_impl/var.h" | 8 #include "ppapi/shared_impl/var.h" |
10 | 9 |
11 namespace ppapi { | 10 namespace ppapi { |
12 | 11 |
13 FileRefImpl::FileRefImpl(const InitAsImpl&, const PPB_FileRef_CreateInfo& info) | 12 FileRefImpl::FileRefImpl(const InitAsImpl&, const PPB_FileRef_CreateInfo& info) |
14 : Resource(info.resource.instance()), | 13 : Resource(info.resource.instance()), |
15 create_info_(info) { | 14 create_info_(info) { |
16 // Should not have been passed a host resource for the trusted constructor. | 15 // Should not have been passed a host resource for the trusted constructor. |
17 DCHECK(info.resource.is_null()); | 16 DCHECK(info.resource.is_null()); |
18 | 17 |
(...skipping 14 matching lines...) Expand all Loading... |
33 thunk::PPB_FileRef_API* FileRefImpl::AsPPB_FileRef_API() { | 32 thunk::PPB_FileRef_API* FileRefImpl::AsPPB_FileRef_API() { |
34 return this; | 33 return this; |
35 } | 34 } |
36 | 35 |
37 PP_FileSystemType FileRefImpl::GetFileSystemType() const { | 36 PP_FileSystemType FileRefImpl::GetFileSystemType() const { |
38 return static_cast<PP_FileSystemType>(create_info_.file_system_type); | 37 return static_cast<PP_FileSystemType>(create_info_.file_system_type); |
39 } | 38 } |
40 | 39 |
41 PP_Var FileRefImpl::GetName() const { | 40 PP_Var FileRefImpl::GetName() const { |
42 if (!name_var_.get()) { | 41 if (!name_var_.get()) { |
43 name_var_ = new StringVar( | 42 name_var_ = new StringVar(create_info_.name); |
44 PpapiGlobals::Get()->GetModuleForInstance(pp_instance()), | |
45 create_info_.name); | |
46 } | 43 } |
47 return name_var_->GetPPVar(); | 44 return name_var_->GetPPVar(); |
48 } | 45 } |
49 | 46 |
50 PP_Var FileRefImpl::GetPath() const { | 47 PP_Var FileRefImpl::GetPath() const { |
51 if (create_info_.file_system_type == PP_FILESYSTEMTYPE_EXTERNAL) | 48 if (create_info_.file_system_type == PP_FILESYSTEMTYPE_EXTERNAL) |
52 return PP_MakeUndefined(); | 49 return PP_MakeUndefined(); |
53 if (!path_var_.get()) { | 50 if (!path_var_.get()) { |
54 path_var_ = new StringVar( | 51 path_var_ = new StringVar(create_info_.path); |
55 PpapiGlobals::Get()->GetModuleForInstance(pp_instance()), | |
56 create_info_.path); | |
57 } | 52 } |
58 return path_var_->GetPPVar(); | 53 return path_var_->GetPPVar(); |
59 } | 54 } |
60 | 55 |
61 const PPB_FileRef_CreateInfo& FileRefImpl::GetCreateInfo() const { | 56 const PPB_FileRef_CreateInfo& FileRefImpl::GetCreateInfo() const { |
62 return create_info_; | 57 return create_info_; |
63 } | 58 } |
64 | 59 |
65 } // namespace ppapi | 60 } // namespace ppapi |
OLD | NEW |