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 media { | |
20 class VideoFrame; | |
wuchengli
2015/01/19 14:05:02
Remove. Not used in this file.
Justin Chuang
2015/01/26 15:00:50
Done.
| |
21 } // namespace media | |
22 | |
23 namespace content { | |
24 class PepperPlatformImageCapture; | |
25 class RendererPpapiHostImpl; | |
26 | |
27 class PepperImageCaptureHost : public ppapi::host::ResourceHost { | |
28 public: | |
29 PepperImageCaptureHost(RendererPpapiHostImpl* host, | |
30 PP_Instance instance, | |
31 PP_Resource resource); | |
32 | |
33 ~PepperImageCaptureHost() override; | |
34 | |
35 bool Init(); | |
36 | |
37 int32_t OnResourceMessageReceived( | |
38 const IPC::Message& msg, | |
39 ppapi::host::HostMessageContext* context) override; | |
40 | |
41 // These methods are called by PepperPlatformImageCapture only. | |
42 | |
43 // Called when image capture is initialized. We can start | |
44 // image capture if |succeeded| is true. | |
45 void OnPlatformInitialized(bool succeeded); | |
46 | |
47 // Called when the preview frame sizes are enumerated. | |
48 void OnPlatformPreviewSizesEnumerated(const std::vector<PP_Size>& sizes); | |
49 | |
50 private: | |
51 // Plugin -> host message handlers. | |
52 | |
53 int32_t OnOpen(ppapi::host::HostMessageContext* context, | |
54 const std::string& device_id); | |
55 int32_t OnClose(ppapi::host::HostMessageContext* context); | |
56 int32_t OnGetPreviewSizes(ppapi::host::HostMessageContext* context); | |
57 | |
58 // Utility methods. | |
59 | |
60 int32_t Close(); | |
61 | |
62 void DetachPlatformImageCapture(); | |
63 | |
64 scoped_ptr<PepperPlatformImageCapture> platform_image_capture_; | |
65 | |
66 RendererPpapiHostImpl* renderer_ppapi_host_; | |
67 | |
68 ppapi::host::ReplyMessageContext open_reply_context_; | |
69 | |
70 ppapi::host::ReplyMessageContext preview_sizes_reply_context_; | |
71 | |
72 DISALLOW_COPY_AND_ASSIGN(PepperImageCaptureHost); | |
73 }; | |
74 | |
75 } // namespace content | |
76 | |
77 #endif // CONTENT_RENDERER_PEPPER_PEPPER_IMAGE_CAPTURE_HOST_H_ | |
OLD | NEW |