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

Side by Side Diff: chrome/browser/chromeos/drive/file_system/operations.h

Issue 15737031: Remove drive::file_system::Operations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 6 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
(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_CHROMEOS_DRIVE_FILE_SYSTEM_OPERATIONS_H_
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_OPERATIONS_H_
7
8 #include "base/memory/scoped_ptr.h"
9 #include "chrome/browser/chromeos/drive/file_system_interface.h"
10
11 namespace base {
12 class FilePath;
13 class SequencedTaskRunner;
14 class Time;
15 } // namespace base
16
17 namespace google_apis {
18 class DriveServiceInterface;
19 } // namespace google_apis
20
21 namespace drive {
22
23 class JobScheduler;
24
25 namespace internal {
26 class FileCache;
27 class ResourceMetadata;
28 } // namespace internal
29
30 namespace file_system {
31
32 class CopyOperation;
33 class CreateDirectoryOperation;
34 class CreateFileOperation;
35 class DownloadOperation;
36 class MoveOperation;
37 class OperationObserver;
38 class RemoveOperation;
39 class SearchOperation;
40 class TouchOperation;
41 class UpdateOperation;
42
43 // Callback for Operations::Search.
44 // On success, |error| is FILE_ERROR_OK, and remaining arguments are valid to
45 // use.
46 // |next_feed| is the URL to fetch the remaining result from the server. Maybe
47 // empty if there is no more results.
48 // On error, |error| is set to other than FILE_ERROR_OK, and the caller
49 // shouldn't use remaining arguments.
50 typedef base::Callback<void(FileError error,
51 const GURL& next_feed,
52 scoped_ptr<std::vector<SearchResultInfo> > result)>
53 SearchOperationCallback;
54
55 // This class is just a bundle of file system operation handlers which
56 // perform the actual operations. The class is introduced to make it easy to
57 // initialize the operation handlers.
58 class Operations {
59 public:
60 Operations();
61 ~Operations();
62
63 // Allocates the operation objects and initializes the operation pointers.
64 void Init(OperationObserver* observer,
65 JobScheduler* scheduler,
66 internal::ResourceMetadata* metadata,
67 internal::FileCache* cache,
68 FileSystemInterface* file_system,
69 google_apis::DriveServiceInterface* drive_service,
70 base::SequencedTaskRunner* blocking_task_runner);
71
72 // Wrapper function for create_directory_operation_.
73 // |callback| must not be null.
74 void CreateDirectory(const base::FilePath& directory_path,
75 bool is_exclusive,
76 bool is_recursive,
77 const FileOperationCallback& callback);
78
79 // Wrapper function for create_file_operation_.
80 // |callback| must not be null.
81 void CreateFile(const base::FilePath& remote_file_path,
82 bool is_exclusive,
83 const FileOperationCallback& callback);
84
85 // Wrapper function for copy_operation_.
86 // |callback| must not be null.
87 void Copy(const base::FilePath& src_file_path,
88 const base::FilePath& dest_file_path,
89 const FileOperationCallback& callback);
90
91 // Wrapper function for copy_operation_.
92 // |callback| must not be null.
93 void TransferFileFromRemoteToLocal(const base::FilePath& remote_src_file_path,
94 const base::FilePath& local_dest_file_path,
95 const FileOperationCallback& callback);
96
97 // Wrapper function for copy_operation_.
98 // |callback| must not be null.
99 void TransferFileFromLocalToRemote(
100 const base::FilePath& local_src_file_path,
101 const base::FilePath& remote_dest_file_path,
102 const FileOperationCallback& callback);
103
104 // Wrapper function for move_operation_.
105 // |callback| must not be null.
106 void Move(const base::FilePath& src_file_path,
107 const base::FilePath& dest_file_path,
108 const FileOperationCallback& callback);
109
110 // Wrapper function for remove_operation_.
111 // |callback| must not be null.
112 void Remove(const base::FilePath& file_path,
113 bool is_recursive,
114 const FileOperationCallback& callback);
115
116 // Wrapper function for touch_operation_.
117 // |callback| must not be null.
118 void TouchFile(const base::FilePath& file_path,
119 const base::Time& last_access_time,
120 const base::Time& last_modified_time,
121 const FileOperationCallback& callback);
122
123 // Wrapper function for download_operation_.
124 // |completion_callback| must not be null.
125 void EnsureFileDownloadedByResourceId(
126 const std::string& resource_id,
127 const ClientContext& context,
128 const GetFileContentInitializedCallback& initialized_callback,
129 const google_apis::GetContentCallback& get_content_callback,
130 const GetFileCallback& completion_callback);
131
132 // Wrapper function for download_operation_.
133 // |completion_callback| must not be null.
134 void EnsureFileDownloadedByPath(
135 const base::FilePath& file_path,
136 const ClientContext& context,
137 const GetFileContentInitializedCallback& initialized_callback,
138 const google_apis::GetContentCallback& get_content_callback,
139 const GetFileCallback& completion_callback);
140
141 // Wrapper function for update_operation_.
142 // |callback| must not be null.
143 void UpdateFileByResourceId(const std::string& resource_id,
144 const ClientContext& context,
145 const FileOperationCallback& callback);
146
147 // Wrapper function for search_operation_.
148 // |callback| must not be null.
149 void Search(const std::string& search_query,
150 const GURL& next_feed,
151 const SearchOperationCallback& callback);
152
153 private:
154 scoped_ptr<CopyOperation> copy_operation_;
155 scoped_ptr<CreateDirectoryOperation> create_directory_operation_;
156 scoped_ptr<CreateFileOperation> create_file_operation_;
157 scoped_ptr<MoveOperation> move_operation_;
158 scoped_ptr<RemoveOperation> remove_operation_;
159 scoped_ptr<TouchOperation> touch_operation_;
160 scoped_ptr<DownloadOperation> download_operation_;
161 scoped_ptr<UpdateOperation> update_operation_;
162 scoped_ptr<SearchOperation> search_operation_;
163 };
164
165 } // namespace file_system
166 } // namespace drive
167
168 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_OPERATIONS_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/file_system.cc ('k') | chrome/browser/chromeos/drive/file_system/operations.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698