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

Side by Side Diff: ppapi/shared_impl/ppb_file_ref_shared.cc

Issue 21966004: Pepper: Move FileRef to the "new" resource proxy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Another rebase Created 7 years, 3 months 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/shared_impl/ppb_file_ref_shared.h ('k') | ppapi/shared_impl/url_request_info_data.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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 #include "ppapi/shared_impl/ppb_file_ref_shared.h"
6
7 #include "base/logging.h"
8 #include "ppapi/shared_impl/var.h"
9
10 namespace ppapi {
11
12 PPB_FileRef_Shared::PPB_FileRef_Shared(ResourceObjectType type,
13 const PPB_FileRef_CreateInfo& info)
14 : Resource(type, info.resource),
15 create_info_(info) {
16 if (type == OBJECT_IS_IMPL) {
17 // Resource's constructor assigned a PP_Resource, so we can fill out our
18 // host resource now.
19 create_info_.resource = host_resource();
20 }
21 }
22
23 PPB_FileRef_Shared::~PPB_FileRef_Shared() {
24 }
25
26 thunk::PPB_FileRef_API* PPB_FileRef_Shared::AsPPB_FileRef_API() {
27 return this;
28 }
29
30 PP_FileSystemType PPB_FileRef_Shared::GetFileSystemType() const {
31 return static_cast<PP_FileSystemType>(create_info_.file_system_type);
32 }
33
34 PP_Var PPB_FileRef_Shared::GetName() const {
35 if (!name_var_.get()) {
36 name_var_ = new StringVar(create_info_.name);
37 }
38 return name_var_->GetPPVar();
39 }
40
41 PP_Var PPB_FileRef_Shared::GetPath() const {
42 if (create_info_.file_system_type == PP_FILESYSTEMTYPE_EXTERNAL)
43 return PP_MakeUndefined();
44 if (!path_var_.get()) {
45 path_var_ = new StringVar(create_info_.path);
46 }
47 return path_var_->GetPPVar();
48 }
49
50 const PPB_FileRef_CreateInfo& PPB_FileRef_Shared::GetCreateInfo() const {
51 return create_info_;
52 }
53
54 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/shared_impl/ppb_file_ref_shared.h ('k') | ppapi/shared_impl/url_request_info_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698