OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_FILE_CHOOSER_HOST_H_ |
| 6 #define CONTENT_RENDERER_PEPPER_PEPPER_FILE_CHOOSER_HOST_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/basictypes.h" |
| 12 #include "base/memory/weak_ptr.h" |
| 13 #include "content/common/content_export.h" |
| 14 #include "ppapi/host/resource_host.h" |
| 15 #include "ppapi/proxy/resource_message_params.h" |
| 16 |
| 17 class RenderViewImpl; |
| 18 |
| 19 namespace content { |
| 20 |
| 21 class PepperInstanceStateAccessor; |
| 22 |
| 23 class CONTENT_EXPORT PepperFileChooserHost |
| 24 : public ppapi::host::ResourceHost, |
| 25 public base::SupportsWeakPtr<PepperFileChooserHost> { |
| 26 public: |
| 27 // Structure to store the information about chosen files. |
| 28 struct ChosenFileInfo { |
| 29 ChosenFileInfo(const std::string& path, const std::string& display_name); |
| 30 std::string path; |
| 31 std::string display_name; // May be empty. |
| 32 }; |
| 33 |
| 34 PepperFileChooserHost(ppapi::host::PpapiHost* host, |
| 35 PP_Instance instance, |
| 36 PP_Resource resource, |
| 37 RenderViewImpl* render_view, |
| 38 PepperInstanceStateAccessor* state); |
| 39 virtual ~PepperFileChooserHost(); |
| 40 |
| 41 virtual int32_t OnResourceMessageReceived( |
| 42 const IPC::Message& msg, |
| 43 ppapi::host::HostMessageContext* context) OVERRIDE; |
| 44 |
| 45 void StoreChosenFiles(const std::vector<ChosenFileInfo>& files); |
| 46 |
| 47 private: |
| 48 class CompletionHandler; |
| 49 |
| 50 int32_t OnMsgShow(ppapi::host::HostMessageContext* context, |
| 51 bool save_as, |
| 52 bool open_multiple, |
| 53 const std::string& suggested_file_name, |
| 54 const std::vector<std::string>& accept_mime_types); |
| 55 |
| 56 // Non-owning pointers. |
| 57 RenderViewImpl* render_view_; |
| 58 PepperInstanceStateAccessor* instance_state_; |
| 59 |
| 60 ppapi::proxy::ResourceMessageReplyParams reply_params_; |
| 61 CompletionHandler* handler_; |
| 62 |
| 63 DISALLOW_COPY_AND_ASSIGN(PepperFileChooserHost); |
| 64 }; |
| 65 |
| 66 } // namespace ppapi |
| 67 |
| 68 #endif // CONTENT_RENDERER_PEPPER_PEPPER_FILE_CHOOSER_HOST_H_ |
OLD | NEW |