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 #include "content/renderer/pepper/pepper_file_chooser_host.h" | 5 #include "content/renderer/pepper/pepper_file_chooser_host.h" |
6 | 6 |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "content/public/renderer/renderer_ppapi_host.h" | 9 #include "content/public/renderer/renderer_ppapi_host.h" |
10 #include "content/renderer/render_view_impl.h" | 10 #include "content/renderer/render_view_impl.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FileChooser_Show, OnShow) | 94 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FileChooser_Show, OnShow) |
95 IPC_END_MESSAGE_MAP() | 95 IPC_END_MESSAGE_MAP() |
96 return PP_ERROR_FAILED; | 96 return PP_ERROR_FAILED; |
97 } | 97 } |
98 | 98 |
99 void PepperFileChooserHost::StoreChosenFiles( | 99 void PepperFileChooserHost::StoreChosenFiles( |
100 const std::vector<ChosenFileInfo>& files) { | 100 const std::vector<ChosenFileInfo>& files) { |
101 std::vector<ppapi::PPB_FileRef_CreateInfo> chosen_files; | 101 std::vector<ppapi::PPB_FileRef_CreateInfo> chosen_files; |
102 for (size_t i = 0; i < files.size(); i++) { | 102 for (size_t i = 0; i < files.size(); i++) { |
103 #if defined(OS_WIN) | 103 #if defined(OS_WIN) |
104 FilePath file_path(UTF8ToWide(files[i].path)); | 104 base::FilePath file_path(UTF8ToWide(files[i].path)); |
105 #else | 105 #else |
106 FilePath file_path(files[i].path); | 106 base::FilePath file_path(files[i].path); |
107 #endif | 107 #endif |
108 | 108 |
109 webkit::ppapi::PPB_FileRef_Impl* ref = | 109 webkit::ppapi::PPB_FileRef_Impl* ref = |
110 webkit::ppapi::PPB_FileRef_Impl::CreateExternal( | 110 webkit::ppapi::PPB_FileRef_Impl::CreateExternal( |
111 pp_instance(), file_path, files[i].display_name); | 111 pp_instance(), file_path, files[i].display_name); |
112 ppapi::PPB_FileRef_CreateInfo create_info; | 112 ppapi::PPB_FileRef_CreateInfo create_info; |
113 ppapi::proxy::PPB_FileRef_Proxy::SerializeFileRef(ref->GetReference(), | 113 ppapi::proxy::PPB_FileRef_Proxy::SerializeFileRef(ref->GetReference(), |
114 &create_info); | 114 &create_info); |
115 chosen_files.push_back(create_info); | 115 chosen_files.push_back(create_info); |
116 } | 116 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 handler_ = NULL; | 163 handler_ = NULL; |
164 return PP_ERROR_NOACCESS; | 164 return PP_ERROR_NOACCESS; |
165 } | 165 } |
166 | 166 |
167 reply_context_ = context->MakeReplyMessageContext(); | 167 reply_context_ = context->MakeReplyMessageContext(); |
168 return PP_OK_COMPLETIONPENDING; | 168 return PP_OK_COMPLETIONPENDING; |
169 } | 169 } |
170 | 170 |
171 } // namespace content | 171 } // namespace content |
172 | 172 |
OLD | NEW |