OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_video_source_host.h" | 5 #include "content/renderer/pepper/pepper_video_source_host.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/numerics/safe_conversions.h" | 8 #include "base/numerics/safe_conversions.h" |
9 #include "content/public/renderer/renderer_ppapi_host.h" | 9 #include "content/public/renderer/renderer_ppapi_host.h" |
10 #include "content/renderer/pepper/ppb_image_data_impl.h" | 10 #include "content/renderer/pepper/ppb_image_data_impl.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 get_frame_pending_(false), | 62 get_frame_pending_(false), |
63 weak_factory_(this) { | 63 weak_factory_(this) { |
64 frame_receiver_ = new FrameReceiver(weak_factory_.GetWeakPtr()); | 64 frame_receiver_ = new FrameReceiver(weak_factory_.GetWeakPtr()); |
65 } | 65 } |
66 | 66 |
67 PepperVideoSourceHost::~PepperVideoSourceHost() { Close(); } | 67 PepperVideoSourceHost::~PepperVideoSourceHost() { Close(); } |
68 | 68 |
69 int32_t PepperVideoSourceHost::OnResourceMessageReceived( | 69 int32_t PepperVideoSourceHost::OnResourceMessageReceived( |
70 const IPC::Message& msg, | 70 const IPC::Message& msg, |
71 HostMessageContext* context) { | 71 HostMessageContext* context) { |
72 IPC_BEGIN_MESSAGE_MAP(PepperVideoSourceHost, msg) | 72 PPAPI_BEGIN_MESSAGE_MAP(PepperVideoSourceHost, msg) |
73 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_VideoSource_Open, | 73 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_VideoSource_Open, |
74 OnHostMsgOpen) | 74 OnHostMsgOpen) |
75 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_VideoSource_GetFrame, | 75 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_VideoSource_GetFrame, |
76 OnHostMsgGetFrame) | 76 OnHostMsgGetFrame) |
77 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_VideoSource_Close, | 77 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_VideoSource_Close, |
78 OnHostMsgClose) | 78 OnHostMsgClose) |
79 IPC_END_MESSAGE_MAP() | 79 PPAPI_END_MESSAGE_MAP() |
80 return PP_ERROR_FAILED; | 80 return PP_ERROR_FAILED; |
81 } | 81 } |
82 | 82 |
83 int32_t PepperVideoSourceHost::OnHostMsgOpen(HostMessageContext* context, | 83 int32_t PepperVideoSourceHost::OnHostMsgOpen(HostMessageContext* context, |
84 const std::string& stream_url) { | 84 const std::string& stream_url) { |
85 GURL gurl(stream_url); | 85 GURL gurl(stream_url); |
86 if (!gurl.is_valid()) | 86 if (!gurl.is_valid()) |
87 return PP_ERROR_BADARGUMENT; | 87 return PP_ERROR_BADARGUMENT; |
88 | 88 |
89 if (!source_handler_->Open(gurl.spec(), frame_receiver_.get())) | 89 if (!source_handler_->Open(gurl.spec(), frame_receiver_.get())) |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 | 234 |
235 void PepperVideoSourceHost::Close() { | 235 void PepperVideoSourceHost::Close() { |
236 if (source_handler_.get() && !stream_url_.empty()) | 236 if (source_handler_.get() && !stream_url_.empty()) |
237 source_handler_->Close(frame_receiver_.get()); | 237 source_handler_->Close(frame_receiver_.get()); |
238 | 238 |
239 source_handler_.reset(NULL); | 239 source_handler_.reset(NULL); |
240 stream_url_.clear(); | 240 stream_url_.clear(); |
241 } | 241 } |
242 | 242 |
243 } // namespace content | 243 } // namespace content |
OLD | NEW |