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