Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(381)

Side by Side Diff: chrome/browser/system_monitor/image_capture_device.h

Issue 11442057: [Media Galleries] Add an ImageCaptureCore listener for Mac. (part 2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add test for downloadFile Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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_H_
6 #define CHROME_BROWSER_SYSTEM_MONITOR_IMAGE_CAPTURE_DEVICE_H_
7
8 #import <Foundation/Foundation.h>
9 #import <ImageCaptureCore/ImageCaptureCore.h>
10
11 #include "base/file_path.h"
12 #include "base/mac/cocoa_protocols.h"
13 #include "base/mac/foundation_util.h"
14 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_nsobject.h"
16 #include "base/memory/weak_ptr.h"
17 #include "base/platform_file.h"
18 #include "base/string_util.h"
19 #include "base/synchronization/lock.h"
20 #include "base/sys_string_conversions.h"
21
22 // Clients use this listener interface to get notifications about
23 // events happening as a particular ImageCapture device is interacted with.
24 // Clients drive the interaction through the ImageCaptureDeviceManager
25 // and the ImageCaptureDevice classes, and get notifications of
26 // events through this interface.
27 class ImageCaptureDeviceListener {
28 public:
29 virtual ~ImageCaptureDeviceListener() {}
30
31 // Get a notification that a particular item has been found on the device.
32 // These calls will come automatically after a new device is initialized.
33 virtual void ItemAdded(const std::string& name,
34 const base::PlatformFileInfo& info) = 0;
35
36 // Called when there are no more items to retrieve.
37 virtual void NoMoreItems() = 0;
38
39 // Called upon completion of a file download request. The |path| is the
40 // requested download file. Note: in NOT_FOUND error case, can be called
41 // inline with the download request.
42 virtual void DownloadedFile(const std::string& name,
43 base::PlatformFileError error) = 0;
44
45 // Called to let the client know the device is removed. The client should
46 // set the ImageCaptureDevice listener to null upon receiving this call.
47 virtual void DeviceRemoved() = 0;
48 };
49
50 // Interface to a camera device found by ImageCaptureCore. This class manages a
51 // session to the camera and provides the backing interactions to present the
52 // media files on it to the filesystem delegate. FilePaths will be artificial,
53 // like "/$device_id/" + name.
54 // Note that all interactions with this class must happen on the UI thread.
55 @interface ImageCaptureDevice
56 : NSObject<ICCameraDeviceDelegate, ICCameraDeviceDownloadDelegate> {
57 @private
58 scoped_nsobject<ICCameraDevice> camera_;
59 base::WeakPtr<ImageCaptureDeviceListener> listener_;
60 }
61
62 - (id)initWithCameraDevice:(ICCameraDevice*)cameraDevice;
63 - (void)setListener:(base::WeakPtr<ImageCaptureDeviceListener>)listener;
64 - (void)open;
65 - (void)close;
66
67 // Download the given |file| to the provided |local_path|. Completion notice
68 // will be sent to the listener's DownloadedFile method.
69 - (void)downloadFile:(const std::string&)name
70 localPath:(const FilePath&)localPath;
71
72 @end
73
74 #endif // CHROME_BROWSER_SYSTEM_MONITOR_IMAGE_CAPTURE_DEVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698