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" |
11 #include "ppapi/c/pp_errors.h" | 11 #include "ppapi/c/pp_errors.h" |
12 #include "ppapi/host/dispatch_host_message.h" | 12 #include "ppapi/host/dispatch_host_message.h" |
13 #include "ppapi/host/ppapi_host.h" | 13 #include "ppapi/host/ppapi_host.h" |
14 #include "ppapi/proxy/ppapi_messages.h" | 14 #include "ppapi/proxy/ppapi_messages.h" |
15 #include "ppapi/proxy/ppb_file_ref_proxy.h" | 15 #include "ppapi/proxy/ppb_file_ref_proxy.h" |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h
" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h
" |
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserComplet
ion.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserComplet
ion.h" |
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserParams.
h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserParams.
h" |
19 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
20 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" |
21 #include "webkit/plugins/ppapi/ppb_file_ref_impl.h" | 21 #include "webkit/plugins/ppapi/ppb_file_ref_impl.h" |
22 | 22 |
23 namespace content { | 23 namespace content { |
24 | 24 |
25 class PepperFileChooserHost::CompletionHandler | 25 class PepperFileChooserHost::CompletionHandler |
26 : public WebKit::WebFileChooserCompletion { | 26 : public WebKit::WebFileChooserCompletion { |
27 public: | 27 public: |
28 CompletionHandler(const base::WeakPtr<PepperFileChooserHost>& host) | 28 explicit CompletionHandler(const base::WeakPtr<PepperFileChooserHost>& host) |
29 : host_(host) { | 29 : host_(host) { |
30 } | 30 } |
31 | 31 |
32 virtual ~CompletionHandler() {} | 32 virtual ~CompletionHandler() {} |
33 | 33 |
34 virtual void didChooseFile( | 34 virtual void didChooseFile( |
35 const WebKit::WebVector<WebKit::WebString>& file_names) { | 35 const WebKit::WebVector<WebKit::WebString>& file_names) { |
36 if (host_) { | 36 if (host_) { |
37 std::vector<PepperFileChooserHost::ChosenFileInfo> files; | 37 std::vector<PepperFileChooserHost::ChosenFileInfo> files; |
38 for (size_t i = 0; i < file_names.size(); i++) { | 38 for (size_t i = 0; i < file_names.size(); i++) { |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 delete handler_; | 162 delete handler_; |
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 | |
OLD | NEW |