| 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 "extensions/browser/api/webcam_private/webcam_private_api.h" | 5 #include "extensions/browser/api/webcam_private/webcam_private_api.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/memory/ptr_util.h" |
| 8 #include "content/public/browser/browser_context.h" | 9 #include "content/public/browser/browser_context.h" |
| 9 #include "content/public/browser/media_device_id.h" | 10 #include "content/public/browser/media_device_id.h" |
| 10 #include "content/public/browser/resource_context.h" | 11 #include "content/public/browser/resource_context.h" |
| 11 #include "extensions/browser/api/webcam_private/v4l2_webcam.h" | 12 #include "extensions/browser/api/webcam_private/v4l2_webcam.h" |
| 12 #include "extensions/browser/api/webcam_private/visca_webcam.h" | 13 #include "extensions/browser/api/webcam_private/visca_webcam.h" |
| 13 #include "extensions/browser/process_manager.h" | 14 #include "extensions/browser/process_manager.h" |
| 14 #include "extensions/browser/process_manager_factory.h" | 15 #include "extensions/browser/process_manager_factory.h" |
| 15 #include "extensions/common/api/webcam_private.h" | 16 #include "extensions/common/api/webcam_private.h" |
| 16 #include "url/origin.h" | 17 #include "url/origin.h" |
| 17 | 18 |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 } else { | 198 } else { |
| 198 SetError(kPathInUse); | 199 SetError(kPathInUse); |
| 199 return false; | 200 return false; |
| 200 } | 201 } |
| 201 } | 202 } |
| 202 | 203 |
| 203 void WebcamPrivateOpenSerialWebcamFunction::OnOpenWebcam( | 204 void WebcamPrivateOpenSerialWebcamFunction::OnOpenWebcam( |
| 204 const std::string& webcam_id, | 205 const std::string& webcam_id, |
| 205 bool success) { | 206 bool success) { |
| 206 if (success) { | 207 if (success) { |
| 207 SetResult(new base::StringValue(webcam_id)); | 208 SetResult(base::MakeUnique<base::StringValue>(webcam_id)); |
| 208 SendResponse(true); | 209 SendResponse(true); |
| 209 } else { | 210 } else { |
| 210 SetError(kOpenSerialWebcamError); | 211 SetError(kOpenSerialWebcamError); |
| 211 SendResponse(false); | 212 SendResponse(false); |
| 212 } | 213 } |
| 213 } | 214 } |
| 214 | 215 |
| 215 WebcamPrivateCloseWebcamFunction::WebcamPrivateCloseWebcamFunction() { | 216 WebcamPrivateCloseWebcamFunction::WebcamPrivateCloseWebcamFunction() { |
| 216 } | 217 } |
| 217 | 218 |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 case INQUIRY_ZOOM: | 379 case INQUIRY_ZOOM: |
| 379 zoom_ = value; | 380 zoom_ = value; |
| 380 get_zoom_ = true; | 381 get_zoom_ = true; |
| 381 break; | 382 break; |
| 382 } | 383 } |
| 383 if (get_pan_ && get_tilt_ && get_zoom_) { | 384 if (get_pan_ && get_tilt_ && get_zoom_) { |
| 384 webcam_private::WebcamConfiguration result; | 385 webcam_private::WebcamConfiguration result; |
| 385 result.pan.reset(new double(pan_)); | 386 result.pan.reset(new double(pan_)); |
| 386 result.tilt.reset(new double(tilt_)); | 387 result.tilt.reset(new double(tilt_)); |
| 387 result.zoom.reset(new double(zoom_)); | 388 result.zoom.reset(new double(zoom_)); |
| 388 SetResult(result.ToValue().release()); | 389 SetResult(result.ToValue()); |
| 389 SendResponse(true); | 390 SendResponse(true); |
| 390 } | 391 } |
| 391 } | 392 } |
| 392 } | 393 } |
| 393 | 394 |
| 394 WebcamPrivateResetFunction::WebcamPrivateResetFunction() { | 395 WebcamPrivateResetFunction::WebcamPrivateResetFunction() { |
| 395 } | 396 } |
| 396 | 397 |
| 397 WebcamPrivateResetFunction::~WebcamPrivateResetFunction() { | 398 WebcamPrivateResetFunction::~WebcamPrivateResetFunction() { |
| 398 } | 399 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 } | 432 } |
| 432 | 433 |
| 433 template <> | 434 template <> |
| 434 void BrowserContextKeyedAPIFactory<WebcamPrivateAPI> | 435 void BrowserContextKeyedAPIFactory<WebcamPrivateAPI> |
| 435 ::DeclareFactoryDependencies() { | 436 ::DeclareFactoryDependencies() { |
| 436 DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); | 437 DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); |
| 437 DependsOn(ProcessManagerFactory::GetInstance()); | 438 DependsOn(ProcessManagerFactory::GetInstance()); |
| 438 } | 439 } |
| 439 | 440 |
| 440 } // namespace extensions | 441 } // namespace extensions |
| OLD | NEW |