| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_CAMERA_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_CAMERA_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_CAMERA_CONTROLLER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_CAMERA_CONTROLLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" |
| 9 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/threading/thread.h" | 11 #include "base/threading/thread.h" |
| 11 #include "chrome/browser/chromeos/login/camera.h" | 12 #include "chrome/browser/chromeos/login/camera.h" |
| 12 #include "third_party/skia/include/core/SkBitmap.h" | 13 #include "third_party/skia/include/core/SkBitmap.h" |
| 13 | 14 |
| 14 namespace chromeos { | 15 namespace chromeos { |
| 15 | 16 |
| 16 class CameraController: public Camera::Delegate { | 17 class CameraController: public Camera::Delegate { |
| 17 public: | 18 public: |
| 18 class Delegate { | 19 class Delegate { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 38 // Initializes camera and starts video capturing. | 39 // Initializes camera and starts video capturing. |
| 39 void Start(); | 40 void Start(); |
| 40 | 41 |
| 41 // Stops video capturing and deinitializes camera. | 42 // Stops video capturing and deinitializes camera. |
| 42 void Stop(); | 43 void Stop(); |
| 43 | 44 |
| 44 // Returns the last captured frame from the camera. | 45 // Returns the last captured frame from the camera. |
| 45 void GetFrame(SkBitmap* frame) const; | 46 void GetFrame(SkBitmap* frame) const; |
| 46 | 47 |
| 47 // Camera::Delegate implementation: | 48 // Camera::Delegate implementation: |
| 48 virtual void OnInitializeSuccess(); | 49 virtual void OnInitializeSuccess() OVERRIDE; |
| 49 virtual void OnInitializeFailure(); | 50 virtual void OnInitializeFailure() OVERRIDE; |
| 50 virtual void OnStartCapturingSuccess(); | 51 virtual void OnStartCapturingSuccess() OVERRIDE; |
| 51 virtual void OnStartCapturingFailure(); | 52 virtual void OnStartCapturingFailure() OVERRIDE; |
| 52 virtual void OnCaptureSuccess(); | 53 virtual void OnCaptureSuccess() OVERRIDE; |
| 53 virtual void OnCaptureFailure(); | 54 virtual void OnCaptureFailure() OVERRIDE; |
| 54 | 55 |
| 55 private: | 56 private: |
| 56 // Size of frame we want to receive. | 57 // Size of frame we want to receive. |
| 57 int frame_width_; | 58 int frame_width_; |
| 58 int frame_height_; | 59 int frame_height_; |
| 59 | 60 |
| 60 // Object that handles video capturing. | 61 // Object that handles video capturing. |
| 61 scoped_refptr<Camera> camera_; | 62 scoped_refptr<Camera> camera_; |
| 62 | 63 |
| 63 // Counts how many times in a row capture failed. | 64 // Counts how many times in a row capture failed. |
| 64 int capture_failure_counter_; | 65 int capture_failure_counter_; |
| 65 | 66 |
| 66 // Counts how many times camera initialization failed. | 67 // Counts how many times camera initialization failed. |
| 67 int camera_init_failure_counter_; | 68 int camera_init_failure_counter_; |
| 68 | 69 |
| 69 // Thread for camera to work on. | 70 // Thread for camera to work on. |
| 70 scoped_ptr<base::Thread> camera_thread_; | 71 scoped_ptr<base::Thread> camera_thread_; |
| 71 | 72 |
| 72 Delegate* delegate_; | 73 Delegate* delegate_; |
| 73 | 74 |
| 74 DISALLOW_COPY_AND_ASSIGN(CameraController); | 75 DISALLOW_COPY_AND_ASSIGN(CameraController); |
| 75 }; | 76 }; |
| 76 | 77 |
| 77 } // namespace chromeos | 78 } // namespace chromeos |
| 78 | 79 |
| 79 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_CAMERA_CONTROLLER_H_ | 80 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_CAMERA_CONTROLLER_H_ |
| OLD | NEW |