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
3 // found in the LICENSE file.
5 #ifndef EXTENSIONS_BROWSER_API_WEBCAM_PRIVATE_WEBCAM_H_
6 #define EXTENSIONS_BROWSER_API_WEBCAM_PRIVATE_WEBCAM_H_
11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h"
13 #include "content/public/browser/browser_thread.h"
14 #include "extensions/browser/api/api_resource.h"
16 namespace extensions
{
18 class Webcam
: public base::RefCounted
<Webcam
> {
34 using GetPTZCompleteCallback
= base::Callback
<void(bool, int)>;
35 using SetPTZCompleteCallback
= base::Callback
<void(bool)>;
37 virtual void GetPan(const GetPTZCompleteCallback
& callback
) = 0;
38 virtual void GetTilt(const GetPTZCompleteCallback
& callback
) = 0;
39 virtual void GetZoom(const GetPTZCompleteCallback
& callback
) = 0;
40 virtual void SetPan(int value
,
42 const SetPTZCompleteCallback
& callback
) = 0;
43 virtual void SetTilt(int value
,
45 const SetPTZCompleteCallback
& callback
) = 0;
46 virtual void SetZoom(int value
, const SetPTZCompleteCallback
& callback
) = 0;
47 virtual void SetPanDirection(PanDirection direction
,
49 const SetPTZCompleteCallback
& callback
) = 0;
50 virtual void SetTiltDirection(TiltDirection direction
,
52 const SetPTZCompleteCallback
& callback
) = 0;
53 virtual void Reset(bool pan
,
56 const SetPTZCompleteCallback
& callback
) = 0;
59 friend class base::RefCounted
<Webcam
>;
63 DISALLOW_COPY_AND_ASSIGN(Webcam
);
66 class WebcamResource
: public ApiResource
{
68 WebcamResource(const std::string
& owner_extension_id
,
70 const std::string
& webcam_id
);
71 ~WebcamResource() override
;
73 static const content::BrowserThread::ID kThreadId
=
74 content::BrowserThread::UI
;
76 Webcam
* GetWebcam() const;
77 const std::string
GetWebcamId() const;
79 // ApiResource overrides.
80 bool IsPersistent() const override
;
83 scoped_refptr
<Webcam
> webcam_
;
84 std::string webcam_id_
;
86 DISALLOW_COPY_AND_ASSIGN(WebcamResource
);
89 } // namespace extensions
91 #endif // EXTENSIONS_BROWSER_API_WEBCAM_PRIVATE_WEBCAM_H_