| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 for (size_t i = 0; i < accept_mime_types.size(); i++) { | 147 for (size_t i = 0; i < accept_mime_types.size(); i++) { |
| 148 mime_types[i] = blink::WebString::fromUTF8(accept_mime_types[i].data(), | 148 mime_types[i] = blink::WebString::fromUTF8(accept_mime_types[i].data(), |
| 149 accept_mime_types[i].size()); | 149 accept_mime_types[i].size()); |
| 150 } | 150 } |
| 151 params.acceptTypes = mime_types; | 151 params.acceptTypes = mime_types; |
| 152 params.directory = false; | 152 params.directory = false; |
| 153 params.needLocalPath = true; | 153 params.needLocalPath = true; |
| 154 params.requestor = renderer_ppapi_host_->GetDocumentURL(pp_instance()); | 154 params.requestor = renderer_ppapi_host_->GetDocumentURL(pp_instance()); |
| 155 | 155 |
| 156 handler_ = new CompletionHandler(AsWeakPtr()); | 156 handler_ = new CompletionHandler(AsWeakPtr()); |
| 157 RenderViewImpl* render_view = static_cast<RenderViewImpl*>( | 157 RenderFrameImpl* render_frame = static_cast<RenderFrameImpl*>( |
| 158 renderer_ppapi_host_->GetRenderViewForInstance(pp_instance())); | 158 renderer_ppapi_host_->GetRenderFrameForInstance(pp_instance())); |
| 159 if (!render_view || !render_view->runFileChooser(params, handler_)) { | 159 |
| 160 if (!render_frame || !render_frame->runFileChooser(params, handler_)) { |
| 160 delete handler_; | 161 delete handler_; |
| 161 handler_ = NULL; | 162 handler_ = NULL; |
| 162 return PP_ERROR_NOACCESS; | 163 return PP_ERROR_NOACCESS; |
| 163 } | 164 } |
| 164 | 165 |
| 165 reply_context_ = context->MakeReplyMessageContext(); | 166 reply_context_ = context->MakeReplyMessageContext(); |
| 166 return PP_OK_COMPLETIONPENDING; | 167 return PP_OK_COMPLETIONPENDING; |
| 167 } | 168 } |
| 168 | 169 |
| 169 void PepperFileChooserHost::DidCreateResourceHosts( | 170 void PepperFileChooserHost::DidCreateResourceHosts( |
| (...skipping 16 matching lines...) Expand all Loading... |
| 186 } | 187 } |
| 187 | 188 |
| 188 reply_context_.params.set_result(PP_OK); | 189 reply_context_.params.set_result(PP_OK); |
| 189 host()->SendReply(reply_context_, | 190 host()->SendReply(reply_context_, |
| 190 PpapiPluginMsg_FileChooser_ShowReply(chosen_files)); | 191 PpapiPluginMsg_FileChooser_ShowReply(chosen_files)); |
| 191 reply_context_ = ppapi::host::ReplyMessageContext(); | 192 reply_context_ = ppapi::host::ReplyMessageContext(); |
| 192 handler_ = NULL; // Handler deletes itself. | 193 handler_ = NULL; // Handler deletes itself. |
| 193 } | 194 } |
| 194 | 195 |
| 195 } // namespace content | 196 } // namespace content |
| OLD | NEW |