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

Unified 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: Better ObjC 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/system_monitor/image_capture_camera.h
diff --git a/chrome/browser/system_monitor/image_capture_camera.h b/chrome/browser/system_monitor/image_capture_camera.h
new file mode 100644
index 0000000000000000000000000000000000000000..a32b4e21ee035e664b50ad462b7465afd7e19969
--- /dev/null
+++ b/chrome/browser/system_monitor/image_capture_camera.h
@@ -0,0 +1,68 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_SYSTEM_MONITOR_IMAGE_CAPTURE_CAMERA_H_
+#define CHROME_BROWSER_SYSTEM_MONITOR_IMAGE_CAPTURE_CAMERA_H_
+
+#import <Foundation/Foundation.h>
+#import <ImageCaptureCore/ImageCaptureCore.h>
+
+#include "base/file_path.h"
+#include "base/platform_file.h"
+#include "base/string_util.h"
+#include "base/sys_string_conversions.h"
+
+// Client's use this listener interface to get notifications about
+// events happening as a particular ImageCapture device is interacted with.
+// Clients drive the interaction through the ImageCaptureDeviceBrowserMac
+// and the ImageCaptureCameraInterface classes, and get notifications of
+// events through this interface.
+class ImageCaptureDeviceListener {
sail 2012/12/13 02:14:00 this should probably be moved to a separate header
Greg Billock 2012/12/14 00:39:59 Is that just to isolate the ObjC? I thought about
+ public:
+ virtual ~ImageCaptureDeviceListener() {}
+
+ // Get a notification that a particular item has been found on the device.
+ // These calls will come automatically after a new device is initialized.
+ virtual void ItemAdded(const std::string& name,
+ const base::PlatformFileInfo& info) = 0;
+
+ // Called when there are no more items to retrieve.
+ virtual void NoMoreItems() = 0;
+
+ // Called upon completion of a file download request. The |path| is the
+ // requested download file. Note: in NOT_FOUND error case, can be called
+ // inline with the download request.
+ virtual void DownloadedFile(const std::string& name,
+ base::PlatformFileError error) = 0;
+
+ // Called to let the client know the device is removed.
+ virtual void DeviceRemoved() = 0;
+};
+
+// Interface to a camera device found by ImageCaptureCore. This class manages a
+// session to the camera and provides the backing interactions to present the
+// media files on it to the filesystem delegate. FilePaths will be artificial,
+// like "/$device_id/" + name.
+@interface ImageCaptureCameraInterface
+ : NSObject<ICCameraDeviceDelegate, ICCameraDeviceDownloadDelegate> {
+ @private
+ ICCameraDevice* camera_;
sail 2012/12/13 02:14:00 scoped_nsobject
Greg Billock 2012/12/14 00:39:59 Done.
+ ImageCaptureDeviceListener* listener_;
sail 2012/12/13 02:14:00 // weak
Greg Billock 2012/12/14 00:39:59 Done.
+}
+
+- (id)init:(ICCameraDevice*)camera_device;
sail 2012/12/13 02:14:00 maybe initWithCameraDevice:
Greg Billock 2012/12/14 00:39:59 Done.
+- (void)open;
+- (void)close;
+- (void)setListener:(ImageCaptureDeviceListener*)listener;
+- (void)DidRenameDownloadFile:(const std::string&)name
sail 2012/12/13 02:14:00 lowercase D
Greg Billock 2012/12/14 00:39:59 This isn't public; should it even be here?
+ withError:(bool)rename_error;
sail 2012/12/13 02:14:00 renameError
Greg Billock 2012/12/14 00:39:59 Done.
+
+// Download the given |file| to the provided |local_path|. Completion notice
+// will be sent to the listener's DownloadedFile method.
+- (void)DownloadFile:(const std::string&)name
sail 2012/12/13 02:14:00 lowercase D
Greg Billock 2012/12/14 00:39:59 Done.
+ localPath:(const FilePath&)local_path;
sail 2012/12/13 02:14:00 localPath
Greg Billock 2012/12/14 00:39:59 Done.
+
+@end
+
+#endif // CHROME_BROWSER_SYSTEM_MONITOR_IMAGE_CAPTURE_CAMERA_H_

Powered by Google App Engine
This is Rietveld 408576698