OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <assert.h> | 5 #include <assert.h> |
6 #include <string.h> | 6 #include <string.h> |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 void VCDemoInstance::HandleMessage(const pp::Var& message_data) { | 191 void VCDemoInstance::HandleMessage(const pp::Var& message_data) { |
192 if (message_data.is_string()) { | 192 if (message_data.is_string()) { |
193 std::string event = message_data.AsString(); | 193 std::string event = message_data.AsString(); |
194 if (event == "PageInitialized") { | 194 if (event == "PageInitialized") { |
195 pp::CompletionCallbackWithOutput<std::vector<pp::DeviceRef_Dev> > | 195 pp::CompletionCallbackWithOutput<std::vector<pp::DeviceRef_Dev> > |
196 callback = callback_factory_.NewCallbackWithOutput( | 196 callback = callback_factory_.NewCallbackWithOutput( |
197 &VCDemoInstance::EnumerateDevicesFinished); | 197 &VCDemoInstance::EnumerateDevicesFinished); |
198 video_capture_.EnumerateDevices(callback); | 198 video_capture_.EnumerateDevices(callback); |
199 } else if (event == "UseDefault") { | 199 } else if (event == "UseDefault") { |
200 Open(pp::DeviceRef_Dev()); | 200 Open(pp::DeviceRef_Dev()); |
201 } else if (event == "UseDefault(v0.1)") { | |
202 const PPB_VideoCapture_Dev_0_1* video_capture_0_1 = | |
203 static_cast<const PPB_VideoCapture_Dev_0_1*>( | |
204 pp::Module::Get()->GetBrowserInterface( | |
205 PPB_VIDEOCAPTURE_DEV_INTERFACE_0_1)); | |
206 video_capture_0_1->StartCapture(video_capture_.pp_resource(), | |
207 &capture_info_, 4); | |
208 } else if (event == "Stop") { | 201 } else if (event == "Stop") { |
209 video_capture_.StopCapture(); | 202 video_capture_.StopCapture(); |
210 } | 203 } |
211 } else if (message_data.is_number()) { | 204 } else if (message_data.is_number()) { |
212 int index = message_data.AsInt(); | 205 int index = message_data.AsInt(); |
213 if (index >= 0 && index < static_cast<int>(devices_.size())) { | 206 if (index >= 0 && index < static_cast<int>(devices_.size())) { |
214 Open(devices_[index]); | 207 Open(devices_[index]); |
215 } else { | 208 } else { |
216 assert(false); | 209 assert(false); |
217 } | 210 } |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 } | 439 } |
447 | 440 |
448 } // anonymous namespace | 441 } // anonymous namespace |
449 | 442 |
450 namespace pp { | 443 namespace pp { |
451 // Factory function for your specialization of the Module object. | 444 // Factory function for your specialization of the Module object. |
452 Module* CreateModule() { | 445 Module* CreateModule() { |
453 return new VCDemoModule(); | 446 return new VCDemoModule(); |
454 } | 447 } |
455 } // namespace pp | 448 } // namespace pp |
OLD | NEW |