OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/renderer/pepper/pepper_camera_device_host.h" | 5 #include "content/renderer/pepper/pepper_camera_device_host.h" |
6 | 6 |
7 #include "content/renderer/pepper/pepper_platform_camera_device.h" | 7 #include "content/renderer/pepper/pepper_platform_camera_device.h" |
8 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" | 8 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" |
9 #include "content/renderer/render_frame_impl.h" | 9 #include "content/renderer/render_frame_impl.h" |
10 #include "ppapi/host/dispatch_host_message.h" | 10 #include "ppapi/host/dispatch_host_message.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 if (platform_camera_device_.get()) | 83 if (platform_camera_device_.get()) |
84 return PP_ERROR_FAILED; | 84 return PP_ERROR_FAILED; |
85 | 85 |
86 GURL document_url = renderer_ppapi_host_->GetDocumentURL(pp_instance()); | 86 GURL document_url = renderer_ppapi_host_->GetDocumentURL(pp_instance()); |
87 if (!document_url.is_valid()) | 87 if (!document_url.is_valid()) |
88 return PP_ERROR_FAILED; | 88 return PP_ERROR_FAILED; |
89 | 89 |
90 platform_camera_device_.reset(new PepperPlatformCameraDevice( | 90 platform_camera_device_.reset(new PepperPlatformCameraDevice( |
91 renderer_ppapi_host_->GetRenderFrameForInstance(pp_instance()) | 91 renderer_ppapi_host_->GetRenderFrameForInstance(pp_instance()) |
92 ->GetRoutingID(), | 92 ->GetRoutingID(), |
93 device_id, document_url, this)); | 93 device_id, this)); |
94 | 94 |
95 open_reply_context_ = context->MakeReplyMessageContext(); | 95 open_reply_context_ = context->MakeReplyMessageContext(); |
96 | 96 |
97 return PP_OK_COMPLETIONPENDING; | 97 return PP_OK_COMPLETIONPENDING; |
98 } | 98 } |
99 | 99 |
100 int32_t PepperCameraDeviceHost::OnClose( | 100 int32_t PepperCameraDeviceHost::OnClose( |
101 ppapi::host::HostMessageContext* context) { | 101 ppapi::host::HostMessageContext* context) { |
102 DetachPlatformCameraDevice(); | 102 DetachPlatformCameraDevice(); |
103 return PP_OK; | 103 return PP_OK; |
(...skipping 13 matching lines...) Expand all Loading... |
117 } | 117 } |
118 | 118 |
119 void PepperCameraDeviceHost::DetachPlatformCameraDevice() { | 119 void PepperCameraDeviceHost::DetachPlatformCameraDevice() { |
120 if (platform_camera_device_) { | 120 if (platform_camera_device_) { |
121 platform_camera_device_->DetachEventHandler(); | 121 platform_camera_device_->DetachEventHandler(); |
122 platform_camera_device_.reset(); | 122 platform_camera_device_.reset(); |
123 } | 123 } |
124 } | 124 } |
125 | 125 |
126 } // namespace content | 126 } // namespace content |
OLD | NEW |