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

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

Powered by Google App Engine
This is Rietveld 408576698