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/ppb_file_ref_shared.h" | 5 #include "ppapi/shared_impl/ppb_file_ref_shared.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 PPB_FileRef_Shared::PPB_FileRef_Shared(const InitAsImpl&, | 12 PPB_FileRef_Shared::PPB_FileRef_Shared(const InitAsImpl&, |
14 const PPB_FileRef_CreateInfo& info) | 13 const PPB_FileRef_CreateInfo& info) |
15 : Resource(info.resource.instance()), | 14 : Resource(info.resource.instance()), |
16 create_info_(info) { | 15 create_info_(info) { |
17 // Should not have been passed a host resource for the trusted constructor. | 16 // Should not have been passed a host resource for the trusted constructor. |
18 DCHECK(info.resource.is_null()); | 17 DCHECK(info.resource.is_null()); |
(...skipping 16 matching lines...) Expand all Loading... |
35 thunk::PPB_FileRef_API* PPB_FileRef_Shared::AsPPB_FileRef_API() { | 34 thunk::PPB_FileRef_API* PPB_FileRef_Shared::AsPPB_FileRef_API() { |
36 return this; | 35 return this; |
37 } | 36 } |
38 | 37 |
39 PP_FileSystemType PPB_FileRef_Shared::GetFileSystemType() const { | 38 PP_FileSystemType PPB_FileRef_Shared::GetFileSystemType() const { |
40 return static_cast<PP_FileSystemType>(create_info_.file_system_type); | 39 return static_cast<PP_FileSystemType>(create_info_.file_system_type); |
41 } | 40 } |
42 | 41 |
43 PP_Var PPB_FileRef_Shared::GetName() const { | 42 PP_Var PPB_FileRef_Shared::GetName() const { |
44 if (!name_var_.get()) { | 43 if (!name_var_.get()) { |
45 name_var_ = new StringVar( | 44 name_var_ = new StringVar(create_info_.name); |
46 PpapiGlobals::Get()->GetModuleForInstance(pp_instance()), | |
47 create_info_.name); | |
48 } | 45 } |
49 return name_var_->GetPPVar(); | 46 return name_var_->GetPPVar(); |
50 } | 47 } |
51 | 48 |
52 PP_Var PPB_FileRef_Shared::GetPath() const { | 49 PP_Var PPB_FileRef_Shared::GetPath() const { |
53 if (create_info_.file_system_type == PP_FILESYSTEMTYPE_EXTERNAL) | 50 if (create_info_.file_system_type == PP_FILESYSTEMTYPE_EXTERNAL) |
54 return PP_MakeUndefined(); | 51 return PP_MakeUndefined(); |
55 if (!path_var_.get()) { | 52 if (!path_var_.get()) { |
56 path_var_ = new StringVar( | 53 path_var_ = new StringVar(create_info_.path); |
57 PpapiGlobals::Get()->GetModuleForInstance(pp_instance()), | |
58 create_info_.path); | |
59 } | 54 } |
60 return path_var_->GetPPVar(); | 55 return path_var_->GetPPVar(); |
61 } | 56 } |
62 | 57 |
63 const PPB_FileRef_CreateInfo& PPB_FileRef_Shared::GetCreateInfo() const { | 58 const PPB_FileRef_CreateInfo& PPB_FileRef_Shared::GetCreateInfo() const { |
64 return create_info_; | 59 return create_info_; |
65 } | 60 } |
66 | 61 |
67 } // namespace ppapi | 62 } // namespace ppapi |
OLD | NEW |