| 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 #include "chrome/browser/chromeos/drive/drive_task_executor.h" | 5 #include "chrome/browser/chromeos/drive/drive_task_executor.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 DriveTaskExecutor::~DriveTaskExecutor() { | 43 DriveTaskExecutor::~DriveTaskExecutor() { |
| 44 } | 44 } |
| 45 | 45 |
| 46 bool DriveTaskExecutor::ExecuteAndNotify( | 46 bool DriveTaskExecutor::ExecuteAndNotify( |
| 47 const std::vector<FileSystemURL>& file_urls, | 47 const std::vector<FileSystemURL>& file_urls, |
| 48 const file_handler_util::FileTaskFinishedCallback& done) { | 48 const file_handler_util::FileTaskFinishedCallback& done) { |
| 49 std::vector<base::FilePath> raw_paths; | 49 std::vector<base::FilePath> raw_paths; |
| 50 for (std::vector<FileSystemURL>::const_iterator url = file_urls.begin(); | 50 for (std::vector<FileSystemURL>::const_iterator url = file_urls.begin(); |
| 51 url != file_urls.end(); ++url) { | 51 url != file_urls.end(); ++url) { |
| 52 if (!url->is_valid() || url->type() != fileapi::kFileSystemTypeDrive) | 52 base::FilePath path = util::ExtractDrivePathFromFileSystemUrl(*url); |
| 53 if (path.empty()) |
| 53 return false; | 54 return false; |
| 54 raw_paths.push_back(url->virtual_path()); | 55 raw_paths.push_back(path); |
| 55 } | 56 } |
| 56 | 57 |
| 57 DriveSystemService* system_service = | 58 DriveSystemService* system_service = |
| 58 DriveSystemServiceFactory::GetForProfile(profile()); | 59 DriveSystemServiceFactory::GetForProfile(profile()); |
| 59 DCHECK(current_index_ == 0); | 60 DCHECK(current_index_ == 0); |
| 60 if (!system_service || !system_service->file_system()) | 61 if (!system_service || !system_service->file_system()) |
| 61 return false; | 62 return false; |
| 62 DriveFileSystemInterface* file_system = system_service->file_system(); | 63 DriveFileSystemInterface* file_system = system_service->file_system(); |
| 63 | 64 |
| 64 // Reset the index, so we know when we're done. | 65 // Reset the index, so we know when we're done. |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 153 |
| 153 void DriveTaskExecutor::Done(bool success) { | 154 void DriveTaskExecutor::Done(bool success) { |
| 154 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 155 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 155 current_index_ = 0; | 156 current_index_ = 0; |
| 156 if (!done_.is_null()) | 157 if (!done_.is_null()) |
| 157 done_.Run(success); | 158 done_.Run(success); |
| 158 done_.Reset(); | 159 done_.Reset(); |
| 159 } | 160 } |
| 160 | 161 |
| 161 } // namespace drive | 162 } // namespace drive |
| OLD | NEW |