OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/proxy/file_ref_resource.h" | 5 #include "ppapi/proxy/file_ref_resource.h" |
6 | 6 |
7 #include "ppapi/c/pp_directory_entry.h" | 7 #include "ppapi/c/pp_directory_entry.h" |
8 #include "ppapi/c/pp_instance.h" | 8 #include "ppapi/c/pp_instance.h" |
9 #include "ppapi/c/pp_resource.h" | 9 #include "ppapi/c/pp_resource.h" |
10 #include "ppapi/proxy/ppapi_messages.h" | 10 #include "ppapi/proxy/ppapi_messages.h" |
(...skipping 11 matching lines...) Expand all Loading... | |
22 FileRefResource::FileRefResource( | 22 FileRefResource::FileRefResource( |
23 Connection connection, | 23 Connection connection, |
24 PP_Instance instance, | 24 PP_Instance instance, |
25 const FileRefCreateInfo& create_info) | 25 const FileRefCreateInfo& create_info) |
26 : PluginResource(connection, instance), | 26 : PluginResource(connection, instance), |
27 create_info_(create_info), | 27 create_info_(create_info), |
28 file_system_resource_(create_info.file_system_plugin_resource) { | 28 file_system_resource_(create_info.file_system_plugin_resource) { |
29 if (uses_internal_paths()) { | 29 if (uses_internal_paths()) { |
30 // If path ends with a slash, then normalize it away unless path is | 30 // If path ends with a slash, then normalize it away unless path is |
31 // the root path. | 31 // the root path. |
32 int path_size = create_info_.internal_path.size(); | 32 int path_size = static_cast<int>(create_info_.internal_path.size()); |
dmichael (off chromium)
2015/02/12 18:56:43
nit: may be a good idea to use checked_cast for ty
| |
33 if (path_size > 1 && create_info_.internal_path.at(path_size - 1) == '/') | 33 if (path_size > 1 && create_info_.internal_path.at(path_size - 1) == '/') |
34 create_info_.internal_path.erase(path_size - 1, 1); | 34 create_info_.internal_path.erase(path_size - 1, 1); |
35 | 35 |
36 path_var_ = new StringVar(create_info_.internal_path); | 36 path_var_ = new StringVar(create_info_.internal_path); |
37 create_info_.display_name = GetNameForInternalFilePath( | 37 create_info_.display_name = GetNameForInternalFilePath( |
38 create_info_.internal_path); | 38 create_info_.internal_path); |
39 } else { | 39 } else { |
40 DCHECK(!create_info_.display_name.empty()); | 40 DCHECK(!create_info_.display_name.empty()); |
41 } | 41 } |
42 name_var_ = new StringVar(create_info_.display_name); | 42 name_var_ = new StringVar(create_info_.display_name); |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
258 callback->Run(params.result()); | 258 callback->Run(params.result()); |
259 } | 259 } |
260 | 260 |
261 bool FileRefResource::uses_internal_paths() const { | 261 bool FileRefResource::uses_internal_paths() const { |
262 return (create_info_.file_system_type != PP_FILESYSTEMTYPE_EXTERNAL) || | 262 return (create_info_.file_system_type != PP_FILESYSTEMTYPE_EXTERNAL) || |
263 !create_info_.internal_path.empty(); | 263 !create_info_.internal_path.empty(); |
264 } | 264 } |
265 | 265 |
266 } // namespace proxy | 266 } // namespace proxy |
267 } // namespace ppapi | 267 } // namespace ppapi |
OLD | NEW |