Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_SYSTEM_MONITOR_IMAGE_CAPTURE_CAMERA_H_ | |
| 6 #define CHROME_BROWSER_SYSTEM_MONITOR_IMAGE_CAPTURE_CAMERA_H_ | |
| 7 | |
| 8 #import <Foundation/Foundation.h> | |
| 9 #import <ImageCaptureCore/ImageCaptureCore.h> | |
| 10 | |
| 11 #include "base/file_path.h" | |
| 12 #include "base/mac/foundation_util.h" | |
| 13 #include "base/memory/scoped_nsobject.h" | |
| 14 #include "base/platform_file.h" | |
| 15 #include "base/string_util.h" | |
| 16 #include "base/sys_string_conversions.h" | |
| 17 | |
| 18 // Client's use this listener interface to get notifications about | |
| 19 // events happening as a particular ImageCapture device is interacted with. | |
| 20 // Clients drive the interaction through the ImageCaptureDeviceBrowserMac | |
| 21 // and the ImageCaptureCameraInterface classes, and get notifications of | |
| 22 // events through this interface. | |
| 23 class ImageCaptureDeviceListener { | |
| 24 public: | |
| 25 virtual ~ImageCaptureDeviceListener() {} | |
| 26 | |
| 27 // Get a notification that a particular item has been found on the device. | |
| 28 // These calls will come automatically after a new device is initialized. | |
| 29 virtual void ItemAdded(const std::string& name, | |
| 30 const base::PlatformFileInfo& info) = 0; | |
| 31 | |
| 32 // Called when there are no more items to retrieve. | |
| 33 virtual void NoMoreItems() = 0; | |
| 34 | |
| 35 // Called upon completion of a file download request. The |path| is the | |
| 36 // requested download file. Note: in NOT_FOUND error case, can be called | |
| 37 // inline with the download request. | |
| 38 virtual void DownloadedFile(const std::string& name, | |
| 39 base::PlatformFileError error) = 0; | |
| 40 | |
| 41 // Called to let the client know the device is removed. | |
| 42 virtual void DeviceRemoved() = 0; | |
| 43 }; | |
| 44 | |
| 45 // Interface to a camera device found by ImageCaptureCore. This class manages a | |
| 46 // session to the camera and provides the backing interactions to present the | |
| 47 // media files on it to the filesystem delegate. FilePaths will be artificial, | |
| 48 // like "/$device_id/" + name. | |
| 49 @interface ImageCaptureCameraInterface | |
|
sail
2012/12/14 01:26:32
I think SystemMonitorICDeviceDelegate would be bet
| |
| 50 : NSObject<ICCameraDeviceDelegate, ICCameraDeviceDownloadDelegate> { | |
| 51 @private | |
| 52 scoped_nsobject<ICCameraDevice> camera_; | |
| 53 // Weak pointer to this class' client. | |
|
sail
2012/12/14 01:26:32
would it be possible to use weak_ptr<> ?
| |
| 54 ImageCaptureDeviceListener* listener_; | |
| 55 } | |
| 56 | |
| 57 - (id)initWithCameraDevice:(ICCameraDevice*)camera_device; | |
|
sail
2012/12/14 01:26:32
cameraDevice
Greg Billock
2012/12/14 18:59:11
Done.
| |
| 58 - (void)open; | |
| 59 - (void)close; | |
|
sail
2012/12/14 01:26:32
Add a check in dealloc to ensure that close has be
Greg Billock
2012/12/14 18:59:11
Done.
| |
| 60 - (void)setListener:(ImageCaptureDeviceListener*)listener; | |
| 61 - (void)didRenameDownloadFile:(const std::string&)name | |
| 62 withError:(bool)renameError; | |
| 63 | |
| 64 // Download the given |file| to the provided |local_path|. Completion notice | |
| 65 // will be sent to the listener's DownloadedFile method. | |
| 66 - (void)downloadFile:(const std::string&)name | |
| 67 localPath:(const FilePath&)localPath; | |
| 68 | |
| 69 @end | |
| 70 | |
| 71 #endif // CHROME_BROWSER_SYSTEM_MONITOR_IMAGE_CAPTURE_CAMERA_H_ | |
| OLD | NEW |