Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
|
dmichael (off chromium)
2015/02/03 19:21:29
Should this file and the .cc not be added?
Justin Chuang
2015/02/04 17:44:24
This file is needed unless we merge PPB_ImageCaptu
| |
| 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 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 | |
| 53 private: | |
| 54 enum OpenState { BEFORE_OPEN, OPENED, CLOSED }; | |
| 55 | |
| 56 // Host -> plugin messages. | |
| 57 void OnPluginMsgGetPreviewSizesReply( | |
| 58 const ResourceMessageReplyParams& params, | |
| 59 const std::vector<PP_Size>& preview_sizes); | |
| 60 | |
| 61 // reply to open | |
| 62 void OnPluginMsgOpenReply(const ResourceMessageReplyParams& params); | |
| 63 | |
| 64 // other | |
| 65 bool IsOpened() const {return open_state_ == OPENED;} | |
| 66 | |
| 67 // Holds a reference of the callback so that Close() can cancel it. | |
| 68 scoped_refptr<TrackedCallback> open_callback_; | |
| 69 OpenState open_state_; | |
| 70 | |
| 71 PP_Resource* get_capabilities_output_; | |
| 72 scoped_refptr<TrackedCallback> get_capabilities_callback_; | |
| 73 scoped_refptr<CameraCapabilitiesResource> camera_capabilities_; | |
| 74 | |
| 75 // scoped_refptr<ImageCaptureConfigResource> config_; | |
| 76 | |
| 77 DISALLOW_COPY_AND_ASSIGN(ImageCaptureResource); | |
| 78 }; | |
| 79 | |
| 80 } // namespace proxy | |
| 81 } // namespace ppapi | |
| 82 | |
| 83 #endif // PPAPI_PROXY_IMAGE_CAPTURE_RESOURCE_H_ | |
| OLD | NEW |