Index: content/renderer/pepper/pepper_image_capture_host.h |
diff --git a/content/renderer/pepper/pepper_image_capture_host.h b/content/renderer/pepper/pepper_image_capture_host.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..126e4620f8a47eed8d37411a171c812f1e0add65 |
--- /dev/null |
+++ b/content/renderer/pepper/pepper_image_capture_host.h |
@@ -0,0 +1,64 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_RENDERER_PEPPER_PEPPER_IMAGE_CAPTURE_HOST_H_ |
+#define CONTENT_RENDERER_PEPPER_PEPPER_IMAGE_CAPTURE_HOST_H_ |
+ |
+#include "base/memory/scoped_ptr.h" |
+#include "content/public/renderer/renderer_ppapi_host.h" |
+#include "content/renderer/pepper/ppb_buffer_impl.h" |
+#include "ppapi/c/pp_size.h" |
+#include "ppapi/host/host_message_context.h" |
+#include "ppapi/host/resource_host.h" |
+ |
+namespace content { |
+class PepperPlatformImageCapture; |
+class RendererPpapiHostImpl; |
+ |
+class PepperImageCaptureHost : public ppapi::host::ResourceHost { |
+ public: |
+ PepperImageCaptureHost(RendererPpapiHostImpl* host, |
+ PP_Instance instance, |
+ PP_Resource resource); |
+ |
+ ~PepperImageCaptureHost() override; |
+ |
+ bool Init(); |
+ |
+ int32_t OnResourceMessageReceived( |
+ const IPC::Message& msg, |
+ ppapi::host::HostMessageContext* context) override; |
+ |
+ // These methods are called by PepperPlatformImageCapture only. |
+ |
+ // Called when image capture is initialized. |
+ void OnInitialized(bool succeeded); |
+ |
+ // Called when the preview frame sizes are enumerated. |
+ void OnPreviewSizesEnumerated(const std::vector<PP_Size>& sizes); |
+ |
+ private: |
+ // Plugin -> host message handlers. |
+ int32_t OnOpen(ppapi::host::HostMessageContext* context, |
+ const std::string& device_id); |
+ int32_t OnClose(ppapi::host::HostMessageContext* context); |
+ int32_t OnGetSupportedPreviewSizes(ppapi::host::HostMessageContext* context); |
+ |
+ // Utility methods. |
+ void DetachPlatformImageCapture(); |
+ |
+ scoped_ptr<PepperPlatformImageCapture> platform_image_capture_; |
+ |
+ RendererPpapiHostImpl* renderer_ppapi_host_; |
+ |
+ ppapi::host::ReplyMessageContext open_reply_context_; |
+ |
+ ppapi::host::ReplyMessageContext preview_sizes_reply_context_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(PepperImageCaptureHost); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_RENDERER_PEPPER_PEPPER_IMAGE_CAPTURE_HOST_H_ |