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

Side by Side Diff: chrome/browser/system_monitor/image_capture_camera.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 accessor for device browser 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_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/memory/weak_ptr.h"
15 #include "base/platform_file.h"
16 #include "base/string_util.h"
17 #include "base/sys_string_conversions.h"
18
19 // Client's use this listener interface to get notifications about
20 // events happening as a particular ImageCapture device is interacted with.
21 // Clients drive the interaction through the ImageCaptureDeviceBrowserMac
22 // and the ImageCaptureCameraInterface classes, and get notifications of
23 // events through this interface.
24 class ImageCaptureDeviceListener {
25 public:
26 virtual ~ImageCaptureDeviceListener() {}
27
28 // Get a notification that a particular item has been found on the device.
29 // These calls will come automatically after a new device is initialized.
30 virtual void ItemAdded(const std::string& name,
31 const base::PlatformFileInfo& info) = 0;
32
33 // Called when there are no more items to retrieve.
34 virtual void NoMoreItems() = 0;
35
36 // Called upon completion of a file download request. The |path| is the
37 // requested download file. Note: in NOT_FOUND error case, can be called
38 // inline with the download request.
39 virtual void DownloadedFile(const std::string& name,
40 base::PlatformFileError error) = 0;
41
42 // Called to let the client know the device is removed.
43 virtual void DeviceRemoved() = 0;
44 };
45
46 // Interface to a camera device found by ImageCaptureCore. This class manages a
47 // session to the camera and provides the backing interactions to present the
48 // media files on it to the filesystem delegate. FilePaths will be artificial,
49 // like "/$device_id/" + name.
50 // Note on thread-safety. This class ends up involving three different threads.
51 // The client is expected to interact with setting up and tearing down the
52 // implementation within a single thread context which allows blocking
53 // (likely the browser blocking pool). The class is thread-compatible with that
54 // usage. It receives events from the ImageCaptureCore library on the UI thread,
55 // and will forward callbacks to the listener on that thread. It also uses the
56 // File thread for renaming files when necessary.
57 // In other words, setup and teardown need to be threaded, and for other
58 // interactions the caller needs to be thread-safe.
59 @interface ImageCaptureCameraInterface
60 : NSObject<ICCameraDeviceDelegate, ICCameraDeviceDownloadDelegate> {
61 @private
62 scoped_nsobject<ICCameraDevice> camera_;
63 base::WeakPtr<ImageCaptureDeviceListener> listener_;
64 }
65
66 - (id)initWithCameraDevice:(ICCameraDevice*)cameraDevice;
67 - (void)open;
68 - (void)close;
69 - (void)setListener:(base::WeakPtr<ImageCaptureDeviceListener>)listener;
70
71 // Download the given |file| to the provided |local_path|. Completion notice
72 // will be sent to the listener's DownloadedFile method.
73 - (void)downloadFile:(const std::string&)name
74 localPath:(const FilePath&)localPath;
75
76 @end
77
78 #endif // CHROME_BROWSER_SYSTEM_MONITOR_IMAGE_CAPTURE_CAMERA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698