OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef PPAPI_PROXY_IMAGE_CAPTURE_RESOURCE_H_ | 5 #ifndef PPAPI_PROXY_IMAGE_CAPTURE_RESOURCE_H_ |
6 #define PPAPI_PROXY_IMAGE_CAPTURE_RESOURCE_H_ | 6 #define PPAPI_PROXY_IMAGE_CAPTURE_RESOURCE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "ppapi/c/pp_size.h" | 10 #include "ppapi/c/pp_size.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 // Resource overrides: | 31 // Resource overrides: |
32 virtual thunk::PPB_ImageCapture_API* AsPPB_ImageCapture_API() override { | 32 virtual thunk::PPB_ImageCapture_API* AsPPB_ImageCapture_API() override { |
33 return this; | 33 return this; |
34 } | 34 } |
35 | 35 |
36 // PPB_ImageCapture_API overrides: | 36 // PPB_ImageCapture_API overrides: |
37 virtual int32_t Open(PP_Var camera_source_id, | 37 virtual int32_t Open(PP_Var camera_source_id, |
38 scoped_refptr<TrackedCallback> callback) override; | 38 scoped_refptr<TrackedCallback> callback) override; |
39 virtual void Close() 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( | 40 virtual int32_t GetCameraCapabilities( |
45 PP_Resource* capabilities, | 41 PP_Resource* capabilities, |
46 scoped_refptr<TrackedCallback> callback) override; | 42 scoped_refptr<TrackedCallback> callback) override; |
47 virtual int32_t CaptureStillImage( | |
48 PPB_ImageCapture_Private_ShutterCallback shutter_callback, | |
49 PPB_ImageCapture_Private_PreviewCallback preview_callback, | |
50 PPB_ImageCapture_Private_JpegCallback jpeg_callback, | |
51 int64_t* sequence_id) override; | |
52 | 43 |
53 private: | 44 private: |
54 enum OpenState { BEFORE_OPEN, OPENED, CLOSED }; | 45 enum OpenState { BEFORE_OPEN, OPENED, CLOSED }; |
55 | 46 |
56 // Host -> plugin messages. | 47 // Host -> plugin messages. |
57 void OnPluginMsgGetPreviewSizesReply( | 48 void OnPluginMsgGetPreviewSizesReply( |
58 const ResourceMessageReplyParams& params, | 49 const ResourceMessageReplyParams& params, |
59 const std::vector<PP_Size>& preview_sizes); | 50 const std::vector<PP_Size>& preview_sizes); |
60 | 51 |
61 // reply to open | 52 // reply to open |
62 void OnPluginMsgOpenReply(const ResourceMessageReplyParams& params); | 53 void OnPluginMsgOpenReply(const ResourceMessageReplyParams& params); |
63 | 54 |
64 // other | 55 // other |
65 bool IsOpened() const {return open_state_ == OPENED;} | 56 bool IsOpened() const {return open_state_ == OPENED;} |
66 | 57 |
67 // Holds a reference of the callback so that Close() can cancel it. | 58 // Holds a reference of the callback so that Close() can cancel it. |
68 scoped_refptr<TrackedCallback> open_callback_; | 59 scoped_refptr<TrackedCallback> open_callback_; |
69 OpenState open_state_; | 60 OpenState open_state_; |
70 | 61 |
71 PP_Resource* get_capabilities_output_; | 62 PP_Resource* get_capabilities_output_; |
72 scoped_refptr<TrackedCallback> get_capabilities_callback_; | 63 scoped_refptr<TrackedCallback> get_capabilities_callback_; |
73 scoped_refptr<CameraCapabilitiesResource> camera_capabilities_; | 64 scoped_refptr<CameraCapabilitiesResource> camera_capabilities_; |
74 | 65 |
75 // scoped_refptr<ImageCaptureConfigResource> config_; | |
76 | |
77 DISALLOW_COPY_AND_ASSIGN(ImageCaptureResource); | 66 DISALLOW_COPY_AND_ASSIGN(ImageCaptureResource); |
78 }; | 67 }; |
79 | 68 |
80 } // namespace proxy | 69 } // namespace proxy |
81 } // namespace ppapi | 70 } // namespace ppapi |
82 | 71 |
83 #endif // PPAPI_PROXY_IMAGE_CAPTURE_RESOURCE_H_ | 72 #endif // PPAPI_PROXY_IMAGE_CAPTURE_RESOURCE_H_ |
OLD | NEW |