[M120 Migration][VD] Enable direct rendering for TVPlus
[platform/framework/web/chromium-efl.git] / components / storage_monitor / image_capture_device.h
1 // Copyright 2014 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_STORAGE_MONITOR_IMAGE_CAPTURE_DEVICE_H_
6 #define COMPONENTS_STORAGE_MONITOR_IMAGE_CAPTURE_DEVICE_H_
7
8 #import <Foundation/Foundation.h>
9 #import <ImageCaptureCore/ImageCaptureCore.h>
10
11 #include "base/apple/foundation_util.h"
12 #include "base/files/file.h"
13 #include "base/files/file_path.h"
14 #include "base/memory/weak_ptr.h"
15 #include "base/strings/string_util.h"
16 #include "base/strings/sys_string_conversions.h"
17 #include "base/synchronization/lock.h"
18
19 namespace storage_monitor {
20
21 // Clients use this listener interface to get notifications about
22 // events happening as a particular ImageCapture device is interacted with.
23 // Clients drive the interaction through the ImageCaptureDeviceManager
24 // and the ImageCaptureDevice classes, and get notifications of
25 // events through this interface.
26 class ImageCaptureDeviceListener {
27  public:
28   virtual ~ImageCaptureDeviceListener() = default;
29
30   // Get a notification that a particular item has been found on the device.
31   // These calls will come automatically after a new device is initialized.
32   // Names are in relative path form, so subdirectories and files in them will
33   // be passed as "dir/subdir/filename". These same relative filenames should
34   // be used as keys to download files.
35   virtual void ItemAdded(const std::string& name,
36                          const base::File::Info& info) = 0;
37
38   // Called when there are no more items to retrieve.
39   virtual void NoMoreItems() = 0;
40
41   // Called upon completion of a file download request.
42   // Note: in NOT_FOUND error case, may be called inline with the download
43   // request.
44   virtual void DownloadedFile(const std::string& name,
45                               base::File::Error error) = 0;
46
47   // Called to let the client know the device is removed. The client should
48   // set the ImageCaptureDevice listener to null upon receiving this call.
49   virtual void DeviceRemoved() = 0;
50 };
51
52 }  // namespace storage_monitor
53
54 // Interface to a camera device found by ImageCaptureCore. This class manages a
55 // session to the camera and provides the backing interactions to present the
56 // media files on it to the filesystem delegate. FilePaths will be artificial,
57 // like "/$device_id/" + name.
58 // Note that all interactions with this class must happen on the UI thread.
59 @interface ImageCaptureDevice
60     : NSObject <ICCameraDeviceDelegate, ICCameraDeviceDownloadDelegate>
61
62 - (instancetype)initWithCameraDevice:(ICCameraDevice*)cameraDevice;
63 - (void)setListener:
64         (base::WeakPtr<storage_monitor::ImageCaptureDeviceListener>)listener;
65 - (void)open;
66 - (void)close;
67
68 - (void)eject;
69
70 // Download the given file |name| to the provided |local_path|. Completion
71 // notice will be sent to the listener's DownloadedFile method. The name
72 // should be of the same form as those sent to the listener's ItemAdded method.
73 - (void)downloadFile:(const std::string&)name
74            localPath:(const base::FilePath&)localPath;
75
76 @end
77
78 #endif  // COMPONENTS_STORAGE_MONITOR_IMAGE_CAPTURE_DEVICE_H_