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 PPAPI_PROXY_IMAGE_CAPTURE_RESOURCE_H_ | |
6 #define PPAPI_PROXY_IMAGE_CAPTURE_RESOURCE_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "ppapi/c/pp_size.h" | |
11 #include "ppapi/proxy/connection.h" | |
12 #include "ppapi/proxy/plugin_resource.h" | |
13 #include "ppapi/proxy/ppapi_proxy_export.h" | |
14 #include "ppapi/shared_impl/resource.h" | |
15 #include "ppapi/thunk/ppb_image_capture_api.h" | |
16 | |
17 namespace ppapi { | |
18 namespace proxy { | |
19 | |
20 class CameraCapabilitiesResource; | |
21 class ImageCaptureConfigResource; | |
22 | |
23 class PPAPI_PROXY_EXPORT ImageCaptureResource | |
24 : public PluginResource, | |
25 public thunk::PPB_ImageCapture_API { | |
26 public: | |
27 ImageCaptureResource(Connection connection, PP_Instance instance); | |
28 | |
29 virtual ~ImageCaptureResource(); | |
30 | |
31 // Resource overrides: | |
32 virtual thunk::PPB_ImageCapture_API* AsPPB_ImageCapture_API() override { | |
33 return this; | |
34 } | |
35 | |
36 // PPB_ImageCapture_API overrides: | |
37 virtual int32_t Open(PP_Var camera_source_id, | |
38 scoped_refptr<TrackedCallback> callback) override; | |
39 virtual void Close() override; | |
40 virtual int32_t SetConfig(PP_Resource config, | |
41 scoped_refptr<TrackedCallback> callback) override; | |
42 virtual int32_t GetConfig(PP_Resource* config, | |
43 scoped_refptr<TrackedCallback> callback) override; | |
44 virtual int32_t GetCameraCapabilities( | |
45 PP_Resource* capabilities, | |
46 scoped_refptr<TrackedCallback> callback) override; | |
47 virtual int32_t ReuseBuffers() override; | |
wuchengli
2015/02/02 14:50:08
Forgot to remove.
Justin Chuang
2015/02/03 12:32:09
Done.
| |
48 virtual int32_t CaptureStillImage( | |
49 PPB_ImageCapture_Private_ShutterCallback shutter_callback, | |
50 PPB_ImageCapture_Private_PreviewCallback preview_callback, | |
51 PPB_ImageCapture_Private_JpegCallback jpeg_callback, | |
52 int64_t* sequence_id) override; | |
53 | |
54 private: | |
55 enum OpenState { BEFORE_OPEN, OPENED, CLOSED }; | |
56 | |
57 // Host -> plugin messages. | |
58 void OnPluginMsgGetPreviewSizesReply( | |
59 const ResourceMessageReplyParams& params, | |
60 const std::vector<PP_Size>& preview_sizes); | |
61 | |
62 // reply to open | |
63 void OnPluginMsgOpenReply(const ResourceMessageReplyParams& params); | |
64 | |
65 // other | |
66 bool IsOpened() const {return open_state_ == OPENED;} | |
67 | |
68 // Holds a reference of the callback so that Close() can cancel it. | |
69 scoped_refptr<TrackedCallback> open_callback_; | |
70 OpenState open_state_; | |
71 | |
72 PP_Resource* get_capabilities_output_; | |
73 scoped_refptr<TrackedCallback> get_capabilities_callback_; | |
74 scoped_refptr<CameraCapabilitiesResource> camera_capabilities_; | |
75 | |
76 // scoped_refptr<ImageCaptureConfigResource> config_; | |
77 | |
78 DISALLOW_COPY_AND_ASSIGN(ImageCaptureResource); | |
79 }; | |
80 | |
81 } // namespace proxy | |
82 } // namespace ppapi | |
83 | |
84 #endif // PPAPI_PROXY_IMAGE_CAPTURE_RESOURCE_H_ | |
OLD | NEW |