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_DEVICE_MAC_H_ | |
| 6 #define CHROME_BROWSER_SYSTEM_MONITOR_IMAGE_CAPTURE_DEVICE_MAC_H_ | |
| 7 | |
| 8 #import <Foundation/Foundation.h> | |
| 9 #import <ImageCaptureCore/ImageCaptureCore.h> | |
| 10 | |
| 11 #include "base/file_path.h" | |
| 12 #include "base/platform_file.h" | |
| 13 #include "base/string_util.h" | |
| 14 #include "base/sys_string_conversions.h" | |
| 15 | |
| 16 // Client's use this listener interface to get notifications about | |
| 17 // events happening as a particular ImageCapture device is interacted with. | |
| 18 // Clients drive the interaction through the ImageCaptureDeviceBrowserMac | |
| 19 // and the ImageCaptureCameraInterface classes, and get notifications of | |
| 20 // events through this interface. | |
| 21 class ImageCaptureDeviceListener { | |
|
sail
2012/12/12 20:53:20
This isn't used anywhere in this patch. It's hard
Greg Billock
2012/12/13 00:31:58
There's ImageCaptureCameraInterface:setListener, a
| |
| 22 public: | |
| 23 virtual ~ImageCaptureDeviceListener() {} | |
| 24 | |
| 25 // Get a notification that a particular item has been found on the device. | |
| 26 // These calls will come automatically after a new device is initialized. | |
| 27 virtual void ItemAdded(const std::string& name, | |
| 28 const base::PlatformFileInfo& info) = 0; | |
| 29 | |
| 30 // Called when there are no more items to retrieve. | |
| 31 virtual void NoMoreItems() = 0; | |
| 32 | |
| 33 // Called upon completion of a file download request. The |path| is the | |
| 34 // requested download file. Note: in NOT_FOUND error case, can be called | |
| 35 // inline with the download request. | |
| 36 virtual void DownloadedFile(const std::string& name, | |
| 37 base::PlatformFileError error) = 0; | |
| 38 | |
| 39 // Called to let the client know the device is removed. | |
| 40 virtual void DeviceRemoved() = 0; | |
| 41 }; | |
| 42 | |
| 43 @class ImageCaptureCameraInterface; | |
| 44 | |
| 45 // This class is the surface for the Mac ICDeviceBrowser ImageCaptureCore API. | |
| 46 // Owned by the ChromeBrowserParts and has browser process lifetime. Upon | |
| 47 // creation, it gets a list of attached media volumes (asynchronously) which | |
| 48 // it will eventually forward to the SystemMonitor as removable storage | |
| 49 // notifications. It will also set up an ImageCaptureCore listener to be | |
| 50 // told when new devices/volumes are discovered and existing ones are removed. | |
| 51 @interface ImageCaptureDeviceBrowserMac : | |
|
sail
2012/12/12 20:53:20
name isn't very descriptive. colon on the next lin
Greg Billock
2012/12/13 00:31:58
Suggestion? The ImageCapture API calls this the De
sail
2012/12/13 02:14:00
How about:
ImageCaptureCameraInterface -> System
| |
| 52 NSObject<ICDeviceBrowserDelegate> { | |
| 53 @private | |
| 54 ICDeviceBrowser* device_browser_; | |
|
sail
2012/12/12 20:53:20
Objective-C classes should use camel case variable
Greg Billock
2012/12/13 00:31:58
OK. Do I need to make a scoped_nsobject for my cam
sail
2012/12/13 02:14:00
Everything should be scoped_nsobject or a scoped_p
| |
| 55 NSMutableArray* cameras_; | |
| 56 } | |
| 57 @property(retain) NSMutableArray* cameras; | |
|
sail
2012/12/12 20:53:20
should be (nonatomic, retain)
newline before and a
Greg Billock
2012/12/13 00:31:58
Done.
| |
| 58 - (id)init; | |
|
sail
2012/12/12 20:53:20
doesn't need to be public (since this derives from
Greg Billock
2012/12/13 00:31:58
Done.
| |
| 59 - (void)close; | |
| 60 - (ImageCaptureCameraInterface*)openDeviceByUUID:(std::string&)uuid; | |
| 61 + (ImageCaptureDeviceBrowserMac*)Get; | |
|
sail
2012/12/12 20:53:20
Objective-C method names should start with lower c
Greg Billock
2012/12/13 00:31:58
Done.
| |
| 62 @end | |
|
sail
2012/12/12 20:53:20
newline before this
Greg Billock
2012/12/13 00:31:58
Done.
| |
| 63 | |
| 64 // Interface to a camera device found by ImageCaptureCore. This class manages a | |
| 65 // session to the camera and provides the backing interactions to present the | |
| 66 // media files on it to the filesystem delegate. FilePaths will be artificial, | |
| 67 // like "/$device_id/" + name. | |
| 68 @interface ImageCaptureCameraInterface : | |
|
sail
2012/12/12 20:53:20
name isn't very descriptive
Greg Billock
2012/12/13 00:31:58
The idea is this class is what you use to get imag
sail
2012/12/13 02:14:00
ImageCaptureDeviceListener -> SystemMonitorICDevic
| |
| 69 NSObject<ICCameraDeviceDelegate, ICCameraDeviceDownloadDelegate> { | |
| 70 @private | |
| 71 ICCameraDevice* camera_; | |
| 72 ImageCaptureDeviceListener* listener_; | |
| 73 } | |
| 74 - (id)init:(ICCameraDevice*)camera_device; | |
|
sail
2012/12/12 20:53:20
new line before this
Greg Billock
2012/12/13 00:31:58
Done.
| |
| 75 - (void)open; | |
| 76 - (void)close; | |
| 77 - (void)setListener:(ImageCaptureDeviceListener*)listener; | |
| 78 - (void)DidRenameDownloadFile:(const std::string&)name | |
| 79 withError:(bool)rename_error; | |
|
sail
2012/12/12 20:53:20
colons should line up, same below
Greg Billock
2012/12/13 00:31:58
Done.
| |
| 80 | |
| 81 // Download the given |file| to the provided |local_path|. Completion notice | |
| 82 // will be sent to the listener's DownloadedFile method. | |
| 83 - (void)DownloadFile:(const std::string&)name | |
| 84 localPath:(const FilePath&)local_path; | |
| 85 @end | |
|
sail
2012/12/12 20:53:20
new line before this
Greg Billock
2012/12/13 00:31:58
Done.
| |
| 86 | |
| 87 #endif // CHROME_BROWSER_SYSTEM_MONITOR_IMAGE_CAPTURE_DEVICE_MAC_H_ | |
| OLD | NEW |