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