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

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

Issue 15681009: Extract GetResolveFile into DownloadOperation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 7 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 #include "chrome/browser/chromeos/drive/file_system/operations.h" 5 #include "chrome/browser/chromeos/drive/file_system/operations.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "chrome/browser/chromeos/drive/file_system/copy_operation.h" 8 #include "chrome/browser/chromeos/drive/file_system/copy_operation.h"
9 #include "chrome/browser/chromeos/drive/file_system/create_directory_operation.h " 9 #include "chrome/browser/chromeos/drive/file_system/create_directory_operation.h "
10 #include "chrome/browser/chromeos/drive/file_system/create_file_operation.h" 10 #include "chrome/browser/chromeos/drive/file_system/create_file_operation.h"
11 #include "chrome/browser/chromeos/drive/file_system/download_operation.h"
11 #include "chrome/browser/chromeos/drive/file_system/move_operation.h" 12 #include "chrome/browser/chromeos/drive/file_system/move_operation.h"
12 #include "chrome/browser/chromeos/drive/file_system/remove_operation.h" 13 #include "chrome/browser/chromeos/drive/file_system/remove_operation.h"
13 #include "chrome/browser/chromeos/drive/file_system/search_operation.h" 14 #include "chrome/browser/chromeos/drive/file_system/search_operation.h"
14 #include "chrome/browser/chromeos/drive/file_system/touch_operation.h" 15 #include "chrome/browser/chromeos/drive/file_system/touch_operation.h"
15 #include "chrome/browser/chromeos/drive/file_system/update_operation.h" 16 #include "chrome/browser/chromeos/drive/file_system/update_operation.h"
16 #include "content/public/browser/browser_thread.h" 17 #include "content/public/browser/browser_thread.h"
17 18
18 using content::BrowserThread; 19 using content::BrowserThread;
19 20
20 namespace drive { 21 namespace drive {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 observer, 54 observer,
54 scheduler, 55 scheduler,
55 metadata, 56 metadata,
56 cache)); 57 cache));
57 move_operation_.reset( 58 move_operation_.reset(
58 new MoveOperation(observer, scheduler, metadata)); 59 new MoveOperation(observer, scheduler, metadata));
59 remove_operation_.reset( 60 remove_operation_.reset(
60 new RemoveOperation(observer, scheduler, metadata, cache)); 61 new RemoveOperation(observer, scheduler, metadata, cache));
61 touch_operation_.reset( 62 touch_operation_.reset(
62 new TouchOperation(blocking_task_runner, observer, scheduler, metadata)); 63 new TouchOperation(blocking_task_runner, observer, scheduler, metadata));
64 download_operation_.reset(new DownloadOperation(
65 blocking_task_runner, observer, scheduler, metadata, cache));
63 update_operation_.reset( 66 update_operation_.reset(
64 new UpdateOperation(observer, scheduler, metadata, cache)); 67 new UpdateOperation(observer, scheduler, metadata, cache));
65 search_operation_.reset( 68 search_operation_.reset(
66 new SearchOperation(blocking_task_runner, scheduler, metadata)); 69 new SearchOperation(blocking_task_runner, scheduler, metadata));
67 } 70 }
68 71
69 void Operations::Copy(const base::FilePath& src_file_path, 72 void Operations::Copy(const base::FilePath& src_file_path,
70 const base::FilePath& dest_file_path, 73 const base::FilePath& dest_file_path,
71 const FileOperationCallback& callback) { 74 const FileOperationCallback& callback) {
72 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 75 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 const FileOperationCallback& callback) { 146 const FileOperationCallback& callback) {
144 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 147 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
145 DCHECK(!last_access_time.is_null()); 148 DCHECK(!last_access_time.is_null());
146 DCHECK(!last_modified_time.is_null()); 149 DCHECK(!last_modified_time.is_null());
147 DCHECK(!callback.is_null()); 150 DCHECK(!callback.is_null());
148 151
149 touch_operation_->TouchFile( 152 touch_operation_->TouchFile(
150 file_path, last_access_time, last_modified_time, callback); 153 file_path, last_access_time, last_modified_time, callback);
151 } 154 }
152 155
156 void Operations::EnsureFileDownloaded(
157 const base::FilePath& file_path,
158 DriveClientContext context,
159 const GetFileContentInitializedCallback& initialized_callback,
160 const google_apis::GetContentCallback& get_content_callback,
161 const GetFileCallback& completion_callback) {
162 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
163 DCHECK(!completion_callback.is_null());
164
165 download_operation_->EnsureFileDownloaded(
166 file_path, context, initialized_callback, get_content_callback,
167 completion_callback);
168 }
169
153 void Operations::UpdateFileByResourceId( 170 void Operations::UpdateFileByResourceId(
154 const std::string& resource_id, 171 const std::string& resource_id,
155 DriveClientContext context, 172 DriveClientContext context,
156 const FileOperationCallback& callback) { 173 const FileOperationCallback& callback) {
157 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 174 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
158 DCHECK(!callback.is_null()); 175 DCHECK(!callback.is_null());
159 176
160 update_operation_->UpdateFileByResourceId(resource_id, context, callback); 177 update_operation_->UpdateFileByResourceId(resource_id, context, callback);
161 } 178 }
162 179
163 void Operations::Search(const std::string& search_query, 180 void Operations::Search(const std::string& search_query,
164 const GURL& next_feed, 181 const GURL& next_feed,
165 const SearchOperationCallback& callback) { 182 const SearchOperationCallback& callback) {
166 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 183 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
167 DCHECK(!callback.is_null()); 184 DCHECK(!callback.is_null());
168 185
169 search_operation_->Search(search_query, next_feed, callback); 186 search_operation_->Search(search_query, next_feed, callback);
170 } 187 }
171 188
172 } // namespace file_system 189 } // namespace file_system
173 } // namespace drive 190 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/file_system/operations.h ('k') | chrome/chrome_browser_chromeos.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698