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/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/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/pepper/pepper_file_ref_renderer_host.h" | 10 #include "content/renderer/pepper/pepper_file_ref_renderer_host.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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<IPC::Message> create_msgs; | 101 std::vector<IPC::Message> create_msgs; |
102 std::vector<base::FilePath> file_paths; | 102 std::vector<base::FilePath> file_paths; |
103 std::vector<std::string> display_names; | 103 std::vector<std::string> display_names; |
104 for (size_t i = 0; i < files.size(); i++) { | 104 for (size_t i = 0; i < files.size(); i++) { |
105 #if defined(OS_WIN) | 105 #if defined(OS_WIN) |
106 base::FilePath file_path(UTF8ToWide(files[i].path)); | 106 base::FilePath file_path(base::UTF8ToWide(files[i].path)); |
107 #else | 107 #else |
108 base::FilePath file_path(files[i].path); | 108 base::FilePath file_path(files[i].path); |
109 #endif | 109 #endif |
110 file_paths.push_back(file_path); | 110 file_paths.push_back(file_path); |
111 create_msgs.push_back(PpapiHostMsg_FileRef_CreateExternal(file_path)); | 111 create_msgs.push_back(PpapiHostMsg_FileRef_CreateExternal(file_path)); |
112 display_names.push_back(files[i].display_name); | 112 display_names.push_back(files[i].display_name); |
113 } | 113 } |
114 | 114 |
115 if (!files.empty()) { | 115 if (!files.empty()) { |
116 renderer_ppapi_host_->CreateBrowserResourceHosts( | 116 renderer_ppapi_host_->CreateBrowserResourceHosts( |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 | 198 |
199 reply_context_.params.set_result(PP_OK); | 199 reply_context_.params.set_result(PP_OK); |
200 host()->SendReply(reply_context_, | 200 host()->SendReply(reply_context_, |
201 PpapiPluginMsg_FileChooser_ShowReply(chosen_files)); | 201 PpapiPluginMsg_FileChooser_ShowReply(chosen_files)); |
202 reply_context_ = ppapi::host::ReplyMessageContext(); | 202 reply_context_ = ppapi::host::ReplyMessageContext(); |
203 handler_ = NULL; // Handler deletes itself. | 203 handler_ = NULL; // Handler deletes itself. |
204 } | 204 } |
205 | 205 |
206 } // namespace content | 206 } // namespace content |
207 | 207 |
OLD | NEW |