OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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_IMAGE_CAPTURE_HOST_H_ |
| 6 #define CONTENT_RENDERER_PEPPER_PEPPER_IMAGE_CAPTURE_HOST_H_ |
| 7 |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "content/public/renderer/renderer_ppapi_host.h" |
| 10 #include "content/renderer/pepper/ppb_buffer_impl.h" |
| 11 #include "ppapi/c/pp_size.h" |
| 12 #include "ppapi/host/host_message_context.h" |
| 13 #include "ppapi/host/resource_host.h" |
| 14 |
| 15 namespace content { |
| 16 class PepperPlatformImageCapture; |
| 17 class RendererPpapiHostImpl; |
| 18 |
| 19 class PepperImageCaptureHost : public ppapi::host::ResourceHost { |
| 20 public: |
| 21 PepperImageCaptureHost(RendererPpapiHostImpl* host, |
| 22 PP_Instance instance, |
| 23 PP_Resource resource); |
| 24 |
| 25 ~PepperImageCaptureHost() override; |
| 26 |
| 27 bool Init(); |
| 28 |
| 29 int32_t OnResourceMessageReceived( |
| 30 const IPC::Message& msg, |
| 31 ppapi::host::HostMessageContext* context) override; |
| 32 |
| 33 // These methods are called by PepperPlatformImageCapture only. |
| 34 |
| 35 // Called when image capture is initialized. |
| 36 void OnInitialized(bool succeeded); |
| 37 |
| 38 // Called when the preview frame sizes are enumerated. |
| 39 void OnPreviewSizesEnumerated(const std::vector<PP_Size>& sizes); |
| 40 |
| 41 private: |
| 42 // Plugin -> host message handlers. |
| 43 int32_t OnOpen(ppapi::host::HostMessageContext* context, |
| 44 const std::string& device_id); |
| 45 int32_t OnClose(ppapi::host::HostMessageContext* context); |
| 46 int32_t OnGetSupportedPreviewSizes(ppapi::host::HostMessageContext* context); |
| 47 |
| 48 // Utility methods. |
| 49 void DetachPlatformImageCapture(); |
| 50 |
| 51 scoped_ptr<PepperPlatformImageCapture> platform_image_capture_; |
| 52 |
| 53 RendererPpapiHostImpl* renderer_ppapi_host_; |
| 54 |
| 55 ppapi::host::ReplyMessageContext open_reply_context_; |
| 56 |
| 57 ppapi::host::ReplyMessageContext preview_sizes_reply_context_; |
| 58 |
| 59 DISALLOW_COPY_AND_ASSIGN(PepperImageCaptureHost); |
| 60 }; |
| 61 |
| 62 } // namespace content |
| 63 |
| 64 #endif // CONTENT_RENDERER_PEPPER_PEPPER_IMAGE_CAPTURE_HOST_H_ |
OLD | NEW |