| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 : ResourceHost(host->GetPpapiHost(), instance, resource), | 75 : ResourceHost(host->GetPpapiHost(), instance, resource), |
| 76 renderer_ppapi_host_(host), | 76 renderer_ppapi_host_(host), |
| 77 handler_(NULL), | 77 handler_(NULL), |
| 78 weak_factory_(this) {} | 78 weak_factory_(this) {} |
| 79 | 79 |
| 80 PepperFileChooserHost::~PepperFileChooserHost() {} | 80 PepperFileChooserHost::~PepperFileChooserHost() {} |
| 81 | 81 |
| 82 int32_t PepperFileChooserHost::OnResourceMessageReceived( | 82 int32_t PepperFileChooserHost::OnResourceMessageReceived( |
| 83 const IPC::Message& msg, | 83 const IPC::Message& msg, |
| 84 ppapi::host::HostMessageContext* context) { | 84 ppapi::host::HostMessageContext* context) { |
| 85 IPC_BEGIN_MESSAGE_MAP(PepperFileChooserHost, msg) | 85 PPAPI_BEGIN_MESSAGE_MAP(PepperFileChooserHost, msg) |
| 86 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FileChooser_Show, OnShow) | 86 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FileChooser_Show, OnShow) |
| 87 IPC_END_MESSAGE_MAP() | 87 PPAPI_END_MESSAGE_MAP() |
| 88 return PP_ERROR_FAILED; | 88 return PP_ERROR_FAILED; |
| 89 } | 89 } |
| 90 | 90 |
| 91 void PepperFileChooserHost::StoreChosenFiles( | 91 void PepperFileChooserHost::StoreChosenFiles( |
| 92 const std::vector<ChosenFileInfo>& files) { | 92 const std::vector<ChosenFileInfo>& files) { |
| 93 std::vector<IPC::Message> create_msgs; | 93 std::vector<IPC::Message> create_msgs; |
| 94 std::vector<base::FilePath> file_paths; | 94 std::vector<base::FilePath> file_paths; |
| 95 std::vector<std::string> display_names; | 95 std::vector<std::string> display_names; |
| 96 for (size_t i = 0; i < files.size(); i++) { | 96 for (size_t i = 0; i < files.size(); i++) { |
| 97 #if defined(OS_WIN) | 97 #if defined(OS_WIN) |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 } | 186 } |
| 187 | 187 |
| 188 reply_context_.params.set_result(PP_OK); | 188 reply_context_.params.set_result(PP_OK); |
| 189 host()->SendReply(reply_context_, | 189 host()->SendReply(reply_context_, |
| 190 PpapiPluginMsg_FileChooser_ShowReply(chosen_files)); | 190 PpapiPluginMsg_FileChooser_ShowReply(chosen_files)); |
| 191 reply_context_ = ppapi::host::ReplyMessageContext(); | 191 reply_context_ = ppapi::host::ReplyMessageContext(); |
| 192 handler_ = NULL; // Handler deletes itself. | 192 handler_ = NULL; // Handler deletes itself. |
| 193 } | 193 } |
| 194 | 194 |
| 195 } // namespace content | 195 } // namespace content |
| OLD | NEW |