| 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 #include "ppapi/proxy/image_capture_resource.h" | 5 #include "ppapi/proxy/image_capture_resource.h" |
| 6 | 6 |
| 7 #include "ppapi/proxy/camera_capabilities_resource.h" | 7 #include "ppapi/proxy/camera_capabilities_resource.h" |
| 8 #include "ppapi/proxy/plugin_globals.h" | 8 #include "ppapi/proxy/plugin_globals.h" |
| 9 #include "ppapi/proxy/plugin_resource_tracker.h" | 9 #include "ppapi/proxy/plugin_resource_tracker.h" |
| 10 #include "ppapi/proxy/ppapi_messages.h" | 10 #include "ppapi/proxy/ppapi_messages.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 get_capabilities_callback_->PostAbort(); | 63 get_capabilities_callback_->PostAbort(); |
| 64 get_capabilities_callback_ = NULL; | 64 get_capabilities_callback_ = NULL; |
| 65 get_capabilities_output_ = NULL; | 65 get_capabilities_output_ = NULL; |
| 66 } | 66 } |
| 67 | 67 |
| 68 Post(RENDERER, PpapiHostMsg_ImageCapture_Close()); | 68 Post(RENDERER, PpapiHostMsg_ImageCapture_Close()); |
| 69 | 69 |
| 70 open_state_ = CLOSED; | 70 open_state_ = CLOSED; |
| 71 } | 71 } |
| 72 | 72 |
| 73 int32_t ImageCaptureResource::SetConfig( | |
| 74 PP_Resource config, | |
| 75 scoped_refptr<TrackedCallback> callback) { | |
| 76 return PP_ERROR_NOTSUPPORTED; | |
| 77 } | |
| 78 | |
| 79 int32_t ImageCaptureResource::GetConfig( | |
| 80 PP_Resource* config, | |
| 81 scoped_refptr<TrackedCallback> callback) { | |
| 82 return PP_ERROR_NOTSUPPORTED; | |
| 83 } | |
| 84 | |
| 85 int32_t ImageCaptureResource::GetCameraCapabilities( | 73 int32_t ImageCaptureResource::GetCameraCapabilities( |
| 86 PP_Resource* capabilities, | 74 PP_Resource* capabilities, |
| 87 scoped_refptr<TrackedCallback> callback) { | 75 scoped_refptr<TrackedCallback> callback) { |
| 88 if (!IsOpened()) | 76 if (!IsOpened()) |
| 89 return PP_ERROR_FAILED; | 77 return PP_ERROR_FAILED; |
| 90 | 78 |
| 91 if (TrackedCallback::IsPending(get_capabilities_callback_)) | 79 if (TrackedCallback::IsPending(get_capabilities_callback_)) |
| 92 return PP_ERROR_INPROGRESS; | 80 return PP_ERROR_INPROGRESS; |
| 93 | 81 |
| 94 if (camera_capabilities_.get()) { | 82 if (camera_capabilities_.get()) { |
| 95 *capabilities = camera_capabilities_->GetReference(); | 83 *capabilities = camera_capabilities_->GetReference(); |
| 96 return PP_OK; | 84 return PP_OK; |
| 97 } | 85 } |
| 98 | 86 |
| 99 get_capabilities_output_ = capabilities; | 87 get_capabilities_output_ = capabilities; |
| 100 get_capabilities_callback_ = callback; | 88 get_capabilities_callback_ = callback; |
| 101 Call<PpapiPluginMsg_ImageCapture_GetSupportedPreviewSizesReply>( | 89 Call<PpapiPluginMsg_ImageCapture_GetSupportedPreviewSizesReply>( |
| 102 RENDERER, | 90 RENDERER, |
| 103 PpapiPluginMsg_ImageCapture_GetSupportedPreviewSizes(), | 91 PpapiPluginMsg_ImageCapture_GetSupportedPreviewSizes(), |
| 104 base::Bind(&ImageCaptureResource::OnPluginMsgGetPreviewSizesReply, | 92 base::Bind(&ImageCaptureResource::OnPluginMsgGetPreviewSizesReply, |
| 105 base::Unretained(this))); | 93 base::Unretained(this))); |
| 106 return PP_OK_COMPLETIONPENDING; | 94 return PP_OK_COMPLETIONPENDING; |
| 107 } | 95 } |
| 108 | 96 |
| 109 int32_t ImageCaptureResource::CaptureStillImage( | |
| 110 PPB_ImageCapture_Private_ShutterCallback shutter_callback, | |
| 111 PPB_ImageCapture_Private_PreviewCallback preview_callback, | |
| 112 PPB_ImageCapture_Private_JpegCallback jpeg_callback, | |
| 113 int64_t* sequence_id) { | |
| 114 return PP_ERROR_NOTSUPPORTED; | |
| 115 } | |
| 116 | |
| 117 void ImageCaptureResource::OnPluginMsgOpenReply( | 97 void ImageCaptureResource::OnPluginMsgOpenReply( |
| 118 const ResourceMessageReplyParams& params) { | 98 const ResourceMessageReplyParams& params) { |
| 119 if (open_state_ == BEFORE_OPEN && params.result() == PP_OK) | 99 if (open_state_ == BEFORE_OPEN && params.result() == PP_OK) |
| 120 open_state_ = OPENED; | 100 open_state_ = OPENED; |
| 121 | 101 |
| 122 // The callback may have been aborted by Close(). | 102 // The callback may have been aborted by Close(). |
| 123 if (TrackedCallback::IsPending(open_callback_)) | 103 if (TrackedCallback::IsPending(open_callback_)) |
| 124 open_callback_->Run(params.result()); | 104 open_callback_->Run(params.result()); |
| 125 } | 105 } |
| 126 | 106 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 138 camera_capabilities_ = new CameraCapabilitiesResource( | 118 camera_capabilities_ = new CameraCapabilitiesResource( |
| 139 pp_instance(), preview_sizes); | 119 pp_instance(), preview_sizes); |
| 140 *get_capabilities_output_ = camera_capabilities_->GetReference(); | 120 *get_capabilities_output_ = camera_capabilities_->GetReference(); |
| 141 } | 121 } |
| 142 get_capabilities_output_ = NULL; | 122 get_capabilities_output_ = NULL; |
| 143 callback->Run(result == PP_OK ? PP_OK : PP_ERROR_FAILED); | 123 callback->Run(result == PP_OK ? PP_OK : PP_ERROR_FAILED); |
| 144 } | 124 } |
| 145 | 125 |
| 146 } // namespace proxy | 126 } // namespace proxy |
| 147 } // namespace ppapi | 127 } // namespace ppapi |
| OLD | NEW |