| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef PPAPI_CPP_OUTPUT_TRAITS_H_ | 5 #ifndef PPAPI_CPP_OUTPUT_TRAITS_H_ |
| 6 #define PPAPI_CPP_OUTPUT_TRAITS_H_ | 6 #define PPAPI_CPP_OUTPUT_TRAITS_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ppapi/c/pp_resource.h" | 10 #include "ppapi/c/pp_resource.h" |
| 11 #include "ppapi/cpp/array_output.h" | 11 #include "ppapi/cpp/array_output.h" |
| 12 #include "ppapi/cpp/dev/directory_entry_dev.h" | 12 #include "ppapi/cpp/directory_entry.h" |
| 13 #include "ppapi/cpp/extensions/ext_output_traits.h" | 13 #include "ppapi/cpp/extensions/ext_output_traits.h" |
| 14 #include "ppapi/cpp/resource.h" | 14 #include "ppapi/cpp/resource.h" |
| 15 | 15 |
| 16 /// @file | 16 /// @file |
| 17 /// This file defines internal templates for defining how data is passed to the | 17 /// This file defines internal templates for defining how data is passed to the |
| 18 /// browser via output parameters and how to convert that data to the | 18 /// browser via output parameters and how to convert that data to the |
| 19 /// corresponding C++ object types. | 19 /// corresponding C++ object types. |
| 20 /// | 20 /// |
| 21 /// It is used by the callback system, it should not be necessary for end-users | 21 /// It is used by the callback system, it should not be necessary for end-users |
| 22 /// to use these templates directly. | 22 /// to use these templates directly. |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 return t.pp_array_output(); | 239 return t.pp_array_output(); |
| 240 } | 240 } |
| 241 | 241 |
| 242 // Retrieves the underlying vector that can be passed to the plugin. | 242 // Retrieves the underlying vector that can be passed to the plugin. |
| 243 static inline std::vector<pp::Var>& StorageToPluginArg(StorageType& t) { | 243 static inline std::vector<pp::Var>& StorageToPluginArg(StorageType& t) { |
| 244 return t.output(); | 244 return t.output(); |
| 245 } | 245 } |
| 246 }; | 246 }; |
| 247 | 247 |
| 248 // A specialization of CallbackOutputTraits to provide the callback system the | 248 // A specialization of CallbackOutputTraits to provide the callback system the |
| 249 // information on how to handle vectors of pp::DirectoryEntry_Dev. This converts | 249 // information on how to handle vectors of pp::DirectoryEntry. This converts |
| 250 // PP_DirectoryEntry_Dev to pp::DirectoryEntry_Dev when passing to the plugin. | 250 // PP_DirectoryEntry to pp::DirectoryEntry when passing to the plugin. |
| 251 template<> | 251 template<> |
| 252 struct CallbackOutputTraits< std::vector<pp::DirectoryEntry_Dev> > { | 252 struct CallbackOutputTraits< std::vector<pp::DirectoryEntry> > { |
| 253 typedef PP_ArrayOutput APIArgType; | 253 typedef PP_ArrayOutput APIArgType; |
| 254 typedef DirectoryEntryArrayOutputAdapterWithStorage StorageType; | 254 typedef DirectoryEntryArrayOutputAdapterWithStorage StorageType; |
| 255 | 255 |
| 256 static inline APIArgType StorageToAPIArg(StorageType& t) { | 256 static inline APIArgType StorageToAPIArg(StorageType& t) { |
| 257 return t.pp_array_output(); | 257 return t.pp_array_output(); |
| 258 } | 258 } |
| 259 | 259 |
| 260 static inline std::vector<pp::DirectoryEntry_Dev>& StorageToPluginArg( | 260 static inline std::vector<pp::DirectoryEntry>& StorageToPluginArg( |
| 261 StorageType& t) { | 261 StorageType& t) { |
| 262 return t.output(); | 262 return t.output(); |
| 263 } | 263 } |
| 264 }; | 264 }; |
| 265 | 265 |
| 266 } // namespace internal | 266 } // namespace internal |
| 267 } // namespace pp | 267 } // namespace pp |
| 268 | 268 |
| 269 #endif // PPAPI_CPP_OUTPUT_TRAITS_H_ | 269 #endif // PPAPI_CPP_OUTPUT_TRAITS_H_ |
| OLD | NEW |