OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_STORAGE_MONITOR_IMAGE_CAPTURE_DEVICE_H_ | 5 #ifndef CHROME_BROWSER_STORAGE_MONITOR_IMAGE_CAPTURE_DEVICE_H_ |
6 #define CHROME_BROWSER_STORAGE_MONITOR_IMAGE_CAPTURE_DEVICE_H_ | 6 #define CHROME_BROWSER_STORAGE_MONITOR_IMAGE_CAPTURE_DEVICE_H_ |
7 | 7 |
8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
9 #import <ImageCaptureCore/ImageCaptureCore.h> | 9 #import <ImageCaptureCore/ImageCaptureCore.h> |
10 | 10 |
| 11 #include "base/files/file.h" |
11 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
12 #include "base/mac/cocoa_protocols.h" | 13 #include "base/mac/cocoa_protocols.h" |
13 #include "base/mac/foundation_util.h" | 14 #include "base/mac/foundation_util.h" |
14 #include "base/mac/scoped_nsobject.h" | 15 #include "base/mac/scoped_nsobject.h" |
15 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
16 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
17 #include "base/platform_file.h" | |
18 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
19 #include "base/strings/sys_string_conversions.h" | 19 #include "base/strings/sys_string_conversions.h" |
20 #include "base/synchronization/lock.h" | 20 #include "base/synchronization/lock.h" |
21 | 21 |
22 // Clients use this listener interface to get notifications about | 22 // Clients use this listener interface to get notifications about |
23 // events happening as a particular ImageCapture device is interacted with. | 23 // events happening as a particular ImageCapture device is interacted with. |
24 // Clients drive the interaction through the ImageCaptureDeviceManager | 24 // Clients drive the interaction through the ImageCaptureDeviceManager |
25 // and the ImageCaptureDevice classes, and get notifications of | 25 // and the ImageCaptureDevice classes, and get notifications of |
26 // events through this interface. | 26 // events through this interface. |
27 class ImageCaptureDeviceListener { | 27 class ImageCaptureDeviceListener { |
28 public: | 28 public: |
29 virtual ~ImageCaptureDeviceListener() {} | 29 virtual ~ImageCaptureDeviceListener() {} |
30 | 30 |
31 // Get a notification that a particular item has been found on the device. | 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. | 32 // These calls will come automatically after a new device is initialized. |
33 // Names are in relative path form, so subdirectories and files in them will | 33 // Names are in relative path form, so subdirectories and files in them will |
34 // be passed as "dir/subdir/filename". These same relative filenames should | 34 // be passed as "dir/subdir/filename". These same relative filenames should |
35 // be used as keys to download files. | 35 // be used as keys to download files. |
36 virtual void ItemAdded(const std::string& name, | 36 virtual void ItemAdded(const std::string& name, |
37 const base::PlatformFileInfo& info) = 0; | 37 const base::File::Info& info) = 0; |
38 | 38 |
39 // Called when there are no more items to retrieve. | 39 // Called when there are no more items to retrieve. |
40 virtual void NoMoreItems() = 0; | 40 virtual void NoMoreItems() = 0; |
41 | 41 |
42 // Called upon completion of a file download request. | 42 // Called upon completion of a file download request. |
43 // Note: in NOT_FOUND error case, may be called inline with the download | 43 // Note: in NOT_FOUND error case, may be called inline with the download |
44 // request. | 44 // request. |
45 virtual void DownloadedFile(const std::string& name, | 45 virtual void DownloadedFile(const std::string& name, |
46 base::PlatformFileError error) = 0; | 46 base::File::Error error) = 0; |
47 | 47 |
48 // Called to let the client know the device is removed. The client should | 48 // Called to let the client know the device is removed. The client should |
49 // set the ImageCaptureDevice listener to null upon receiving this call. | 49 // set the ImageCaptureDevice listener to null upon receiving this call. |
50 virtual void DeviceRemoved() = 0; | 50 virtual void DeviceRemoved() = 0; |
51 }; | 51 }; |
52 | 52 |
53 // Interface to a camera device found by ImageCaptureCore. This class manages a | 53 // Interface to a camera device found by ImageCaptureCore. This class manages a |
54 // session to the camera and provides the backing interactions to present the | 54 // session to the camera and provides the backing interactions to present the |
55 // media files on it to the filesystem delegate. FilePaths will be artificial, | 55 // media files on it to the filesystem delegate. FilePaths will be artificial, |
56 // like "/$device_id/" + name. | 56 // like "/$device_id/" + name. |
(...skipping 15 matching lines...) Expand all Loading... |
72 | 72 |
73 // Download the given file |name| to the provided |local_path|. Completion | 73 // Download the given file |name| to the provided |local_path|. Completion |
74 // notice will be sent to the listener's DownloadedFile method. The name | 74 // notice will be sent to the listener's DownloadedFile method. The name |
75 // should be of the same form as those sent to the listener's ItemAdded method. | 75 // should be of the same form as those sent to the listener's ItemAdded method. |
76 - (void)downloadFile:(const std::string&)name | 76 - (void)downloadFile:(const std::string&)name |
77 localPath:(const base::FilePath&)localPath; | 77 localPath:(const base::FilePath&)localPath; |
78 | 78 |
79 @end | 79 @end |
80 | 80 |
81 #endif // CHROME_BROWSER_STORAGE_MONITOR_IMAGE_CAPTURE_DEVICE_H_ | 81 #endif // CHROME_BROWSER_STORAGE_MONITOR_IMAGE_CAPTURE_DEVICE_H_ |
OLD | NEW |