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 CONTENT_EXPORT PepperFileChooserHost | |
22 : public ppapi::host::ResourceHost, | |
23 public base::SupportsWeakPtr<PepperFileChooserHost> { | |
24 public: | |
25 // Structure to store the information of chosen files. | |
bbudge
2012/07/02 20:06:06
s/the information of/information about
| |
26 struct ChosenFileInfo { | |
27 ChosenFileInfo(const std::string& path, const std::string& display_name); | |
28 std::string path; | |
29 std::string display_name; // May be empty. | |
30 }; | |
31 | |
32 PepperFileChooserHost(ppapi::host::PpapiHost* host, | |
33 PP_Instance instance, | |
34 PP_Resource resource, | |
35 RenderViewImpl* render_view); | |
36 virtual ~PepperFileChooserHost(); | |
37 | |
38 virtual int32_t OnResourceMessageReceived( | |
39 const IPC::Message& msg, | |
40 ppapi::host::HostMessageContext* context) OVERRIDE; | |
41 | |
42 void StoreChosenFiles(const std::vector<ChosenFileInfo>& files); | |
43 | |
44 private: | |
45 class CompletionHandler; | |
46 | |
47 int32_t OnMsgShow(ppapi::host::HostMessageContext* context, | |
48 bool save_as, | |
49 bool open_multiple, | |
50 const std::string& suggested_file_name, | |
51 const std::vector<std::string>& accept_mime_types); | |
52 | |
53 RenderViewImpl* render_view_; | |
54 | |
55 ppapi::proxy::ResourceMessageReplyParams reply_params_; | |
56 CompletionHandler* handler_; | |
57 | |
58 DISALLOW_COPY_AND_ASSIGN(PepperFileChooserHost); | |
59 }; | |
60 | |
61 } // namespace ppapi | |
62 | |
63 #endif // CONTENT_RENDERER_PEPPER_PEPPER_FILE_CHOOSER_HOST_H_ | |
OLD | NEW |