Chromium Code Reviews| 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" | |
|
wuchengli
2015/02/03 14:34:45
not used?
Justin Chuang
2015/02/04 17:44:24
Done.
| |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "content/common/media/video_capture.h" | |
|
wuchengli
2015/02/03 14:34:45
not used?
Justin Chuang
2015/02/04 17:44:24
Done.
| |
| 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" | |
|
wuchengli
2015/02/03 14:34:45
not used?
Justin Chuang
2015/02/04 17:44:24
Done.
| |
| 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. | |
| 40 void OnInitialized(bool succeeded); | |
| 41 | |
| 42 // Called when the preview frame sizes are enumerated. | |
| 43 void OnPreviewSizesEnumerated(const std::vector<PP_Size>& sizes); | |
| 44 | |
| 45 private: | |
| 46 // Plugin -> host message handlers. | |
| 47 | |
| 48 int32_t OnOpen(ppapi::host::HostMessageContext* context, | |
| 49 const std::string& device_id); | |
| 50 int32_t OnClose(ppapi::host::HostMessageContext* context); | |
| 51 int32_t OnGetPreviewSizes(ppapi::host::HostMessageContext* context); | |
| 52 | |
| 53 // Utility methods. | |
| 54 | |
| 55 void DetachPlatformImageCapture(); | |
| 56 | |
| 57 scoped_ptr<PepperPlatformImageCapture> platform_image_capture_; | |
| 58 | |
| 59 RendererPpapiHostImpl* renderer_ppapi_host_; | |
| 60 | |
| 61 ppapi::host::ReplyMessageContext open_reply_context_; | |
| 62 | |
| 63 ppapi::host::ReplyMessageContext preview_sizes_reply_context_; | |
| 64 | |
| 65 DISALLOW_COPY_AND_ASSIGN(PepperImageCaptureHost); | |
| 66 }; | |
| 67 | |
| 68 } // namespace content | |
| 69 | |
| 70 #endif // CONTENT_RENDERER_PEPPER_PEPPER_IMAGE_CAPTURE_HOST_H_ | |
| OLD | NEW |