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

Side by Side Diff: chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac.h

Issue 145303002: Convert Media Galleries to use base::File (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months 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
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_MEDIA_GALLERIES_MAC_MTP_DEVICE_DELEGATE_IMPL_MAC_H_ 5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_MAC_MTP_DEVICE_DELEGATE_IMPL_MAC_H_
6 #define CHROME_BROWSER_MEDIA_GALLERIES_MAC_MTP_DEVICE_DELEGATE_IMPL_MAC_H_ 6 #define CHROME_BROWSER_MEDIA_GALLERIES_MAC_MTP_DEVICE_DELEGATE_IMPL_MAC_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/containers/hash_tables.h" 12 #include "base/containers/hash_tables.h"
13 #include "base/files/file.h"
13 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
14 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
15 #include "base/platform_file.h"
16 #include "chrome/browser/media_galleries/fileapi/mtp_device_async_delegate.h" 16 #include "chrome/browser/media_galleries/fileapi/mtp_device_async_delegate.h"
17 17
18 // Delegate for presenting an Image Capture device through the filesystem 18 // Delegate for presenting an Image Capture device through the filesystem
19 // API. The synthetic filesystem will be rooted at the constructed location, 19 // API. The synthetic filesystem will be rooted at the constructed location,
20 // and names of all files notified through the ItemAdded call will be 20 // and names of all files notified through the ItemAdded call will be
21 // all appear as children of that directory. (ItemAdded calls with directories 21 // all appear as children of that directory. (ItemAdded calls with directories
22 // will be ignored.) 22 // will be ignored.)
23 // Note on thread management: This class is thread-compatible: it can be created 23 // Note on thread management: This class is thread-compatible: it can be created
24 // on any thread, but then mutates all state on the UI thread. The async 24 // on any thread, but then mutates all state on the UI thread. The async
25 // delegate interface can be invoked on any thread, as it simply forwards calls 25 // delegate interface can be invoked on any thread, as it simply forwards calls
(...skipping 21 matching lines...) Expand all
47 virtual void CreateSnapshotFile( 47 virtual void CreateSnapshotFile(
48 const base::FilePath& device_file_path, 48 const base::FilePath& device_file_path,
49 const base::FilePath& local_path, 49 const base::FilePath& local_path,
50 const CreateSnapshotFileSuccessCallback& success_callback, 50 const CreateSnapshotFileSuccessCallback& success_callback,
51 const ErrorCallback& error_callback) OVERRIDE; 51 const ErrorCallback& error_callback) OVERRIDE;
52 virtual void CancelPendingTasksAndDeleteDelegate() OVERRIDE; 52 virtual void CancelPendingTasksAndDeleteDelegate() OVERRIDE;
53 53
54 // Forward delegates for ImageCaptureDeviceListener. These are 54 // Forward delegates for ImageCaptureDeviceListener. These are
55 // invoked in callbacks of the ImageCapture library on the UI thread. 55 // invoked in callbacks of the ImageCapture library on the UI thread.
56 virtual void ItemAdded(const std::string& name, 56 virtual void ItemAdded(const std::string& name,
57 const base::PlatformFileInfo& info); 57 const base::File::Info& info);
58 virtual void NoMoreItems(); 58 virtual void NoMoreItems();
59 virtual void DownloadedFile(const std::string& name, 59 virtual void DownloadedFile(const std::string& name,
60 base::PlatformFileError error); 60 base::File::Error error);
61 61
62 // Scheduled when early directory reads are requested. The 62 // Scheduled when early directory reads are requested. The
63 // timeout will signal an ABORT error to the caller if the 63 // timeout will signal an ABORT error to the caller if the
64 // device metadata cannot be read. 64 // device metadata cannot be read.
65 void ReadDirectoryTimeout(const base::FilePath& root); 65 void ReadDirectoryTimeout(const base::FilePath& root);
66 66
67 private: 67 private:
68 class DeviceListener; 68 class DeviceListener;
69 69
70 virtual ~MTPDeviceDelegateImplMac(); 70 virtual ~MTPDeviceDelegateImplMac();
71 71
72 // Delegate for GetFileInfo, called on the UI thread. 72 // Delegate for GetFileInfo, called on the UI thread.
73 void GetFileInfoImpl(const base::FilePath& file_path, 73 void GetFileInfoImpl(const base::FilePath& file_path,
74 base::PlatformFileInfo* file_info, 74 base::File::Info* file_info,
75 base::PlatformFileError* error); 75 base::File::Error* error);
76 76
77 // Delegate for ReadDirectory, called on the UI thread. 77 // Delegate for ReadDirectory, called on the UI thread.
78 void ReadDirectoryImpl( 78 void ReadDirectoryImpl(
79 const base::FilePath& root, 79 const base::FilePath& root,
80 const ReadDirectorySuccessCallback& success_callback, 80 const ReadDirectorySuccessCallback& success_callback,
81 const ErrorCallback& error_callback); 81 const ErrorCallback& error_callback);
82 82
83 // Delegate for CreateSnapshotFile, called on the UI thread. 83 // Delegate for CreateSnapshotFile, called on the UI thread.
84 void DownloadFile( 84 void DownloadFile(
85 const base::FilePath& device_file_path, 85 const base::FilePath& device_file_path,
(...skipping 13 matching lines...) Expand all
99 void NotifyReadDir(); 99 void NotifyReadDir();
100 100
101 std::string device_id_; 101 std::string device_id_;
102 base::FilePath root_path_; 102 base::FilePath root_path_;
103 103
104 // Interface object for the camera underlying this MTP session. 104 // Interface object for the camera underlying this MTP session.
105 scoped_ptr<DeviceListener> camera_interface_; 105 scoped_ptr<DeviceListener> camera_interface_;
106 106
107 // Stores a map from filename to file metadata received from the camera. 107 // Stores a map from filename to file metadata received from the camera.
108 base::hash_map<base::FilePath::StringType, 108 base::hash_map<base::FilePath::StringType,
109 base::PlatformFileInfo> file_info_; 109 base::File::Info> file_info_;
110 110
111 // List of filenames received from the camera. 111 // List of filenames received from the camera.
112 std::vector<base::FilePath> file_paths_; 112 std::vector<base::FilePath> file_paths_;
113 113
114 // Set to true when all file metadata has been received from the camera. 114 // Set to true when all file metadata has been received from the camera.
115 bool received_all_files_; 115 bool received_all_files_;
116 116
117 struct ReadFileRequest { 117 struct ReadFileRequest {
118 ReadFileRequest(); 118 ReadFileRequest();
119 ReadFileRequest(const std::string& request_file, 119 ReadFileRequest(const std::string& request_file,
(...skipping 25 matching lines...) Expand all
145 145
146 ReadFileTransactionList read_file_transactions_; 146 ReadFileTransactionList read_file_transactions_;
147 ReadDirTransactionList read_dir_transactions_; 147 ReadDirTransactionList read_dir_transactions_;
148 148
149 base::WeakPtrFactory<MTPDeviceDelegateImplMac> weak_factory_; 149 base::WeakPtrFactory<MTPDeviceDelegateImplMac> weak_factory_;
150 150
151 DISALLOW_COPY_AND_ASSIGN(MTPDeviceDelegateImplMac); 151 DISALLOW_COPY_AND_ASSIGN(MTPDeviceDelegateImplMac);
152 }; 152 };
153 153
154 #endif // CHROME_BROWSER_MEDIA_GALLERIES_MAC_MTP_DEVICE_DELEGATE_IMPL_MAC_H_ 154 #endif // CHROME_BROWSER_MEDIA_GALLERIES_MAC_MTP_DEVICE_DELEGATE_IMPL_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698