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_file_system.h" | 5 #include "chrome/browser/chromeos/drive/drive_file_system.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
11 #include "base/platform_file.h" | 11 #include "base/platform_file.h" |
12 #include "base/prefs/pref_change_registrar.h" | 12 #include "base/prefs/pref_change_registrar.h" |
13 #include "base/prefs/pref_service.h" | 13 #include "base/prefs/pref_service.h" |
14 #include "base/stringprintf.h" | 14 #include "base/stringprintf.h" |
15 #include "base/threading/sequenced_worker_pool.h" | 15 #include "base/threading/sequenced_worker_pool.h" |
16 #include "chrome/browser/chromeos/drive/change_list_loader.h" | 16 #include "chrome/browser/chromeos/drive/change_list_loader.h" |
17 #include "chrome/browser/chromeos/drive/change_list_processor.h" | 17 #include "chrome/browser/chromeos/drive/change_list_processor.h" |
18 #include "chrome/browser/chromeos/drive/drive.pb.h" | 18 #include "chrome/browser/chromeos/drive/drive.pb.h" |
19 #include "chrome/browser/chromeos/drive/drive_cache.h" | 19 #include "chrome/browser/chromeos/drive/drive_cache.h" |
20 #include "chrome/browser/chromeos/drive/drive_file_system_util.h" | 20 #include "chrome/browser/chromeos/drive/drive_file_system_util.h" |
21 #include "chrome/browser/chromeos/drive/drive_scheduler.h" | |
22 #include "chrome/browser/chromeos/drive/file_system_observer.h" | 21 #include "chrome/browser/chromeos/drive/file_system_observer.h" |
| 22 #include "chrome/browser/chromeos/drive/job_scheduler.h" |
23 #include "chrome/browser/chromeos/drive/resource_entry_conversion.h" | 23 #include "chrome/browser/chromeos/drive/resource_entry_conversion.h" |
24 #include "chrome/browser/chromeos/drive/search_metadata.h" | 24 #include "chrome/browser/chromeos/drive/search_metadata.h" |
25 #include "chrome/browser/google_apis/drive_api_parser.h" | 25 #include "chrome/browser/google_apis/drive_api_parser.h" |
26 #include "chrome/browser/google_apis/drive_api_util.h" | 26 #include "chrome/browser/google_apis/drive_api_util.h" |
27 #include "chrome/browser/google_apis/drive_service_interface.h" | 27 #include "chrome/browser/google_apis/drive_service_interface.h" |
28 #include "chrome/browser/profiles/profile.h" | 28 #include "chrome/browser/profiles/profile.h" |
29 #include "chrome/common/chrome_notification_types.h" | 29 #include "chrome/common/chrome_notification_types.h" |
30 #include "chrome/common/pref_names.h" | 30 #include "chrome/common/pref_names.h" |
31 #include "content/public/browser/browser_thread.h" | 31 #include "content/public/browser/browser_thread.h" |
32 #include "content/public/browser/notification_details.h" | 32 #include "content/public/browser/notification_details.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 std::string md5; | 202 std::string md5; |
203 }; | 203 }; |
204 | 204 |
205 | 205 |
206 // DriveFileSystem class implementation. | 206 // DriveFileSystem class implementation. |
207 | 207 |
208 DriveFileSystem::DriveFileSystem( | 208 DriveFileSystem::DriveFileSystem( |
209 Profile* profile, | 209 Profile* profile, |
210 DriveCache* cache, | 210 DriveCache* cache, |
211 google_apis::DriveServiceInterface* drive_service, | 211 google_apis::DriveServiceInterface* drive_service, |
212 DriveScheduler* scheduler, | 212 JobScheduler* scheduler, |
213 DriveWebAppsRegistry* webapps_registry, | 213 DriveWebAppsRegistry* webapps_registry, |
214 DriveResourceMetadata* resource_metadata, | 214 DriveResourceMetadata* resource_metadata, |
215 base::SequencedTaskRunner* blocking_task_runner) | 215 base::SequencedTaskRunner* blocking_task_runner) |
216 : profile_(profile), | 216 : profile_(profile), |
217 cache_(cache), | 217 cache_(cache), |
218 drive_service_(drive_service), | 218 drive_service_(drive_service), |
219 scheduler_(scheduler), | 219 scheduler_(scheduler), |
220 webapps_registry_(webapps_registry), | 220 webapps_registry_(webapps_registry), |
221 resource_metadata_(resource_metadata), | 221 resource_metadata_(resource_metadata), |
222 last_update_check_error_(FILE_ERROR_OK), | 222 last_update_check_error_(FILE_ERROR_OK), |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 entry_proto.Pass(), | 663 entry_proto.Pass(), |
664 initialized_callback, | 664 initialized_callback, |
665 base::Bind(&GetFileCallbackToFileOperationCallbackAdapter, | 665 base::Bind(&GetFileCallbackToFileOperationCallbackAdapter, |
666 completion_callback), | 666 completion_callback), |
667 get_content_callback))); | 667 get_content_callback))); |
668 } | 668 } |
669 | 669 |
670 void DriveFileSystem::CancelGetFile(const base::FilePath& drive_file_path) { | 670 void DriveFileSystem::CancelGetFile(const base::FilePath& drive_file_path) { |
671 // Currently the task is managed on DriveServiceInterface, so we directly | 671 // Currently the task is managed on DriveServiceInterface, so we directly |
672 // call its method here. | 672 // call its method here. |
673 // Note: the task management will be moved to DriveScheduler, an the we | 673 // Note: the task management will be moved to JobScheduler, an the we |
674 // can cancel the job via the |scheduler_|. | 674 // can cancel the job via the |scheduler_|. |
675 drive_service_->CancelForFilePath(drive_file_path); | 675 drive_service_->CancelForFilePath(drive_file_path); |
676 } | 676 } |
677 | 677 |
678 void DriveFileSystem::GetEntryInfoByPath(const base::FilePath& file_path, | 678 void DriveFileSystem::GetEntryInfoByPath(const base::FilePath& file_path, |
679 const GetEntryInfoCallback& callback) { | 679 const GetEntryInfoCallback& callback) { |
680 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 680 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
681 DCHECK(!callback.is_null()); | 681 DCHECK(!callback.is_null()); |
682 | 682 |
683 // DriveResourceMetadata may know about the entry even if the resource | 683 // DriveResourceMetadata may know about the entry even if the resource |
(...skipping 1135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1819 return; | 1819 return; |
1820 } | 1820 } |
1821 | 1821 |
1822 PlatformFileInfoProto entry_file_info; | 1822 PlatformFileInfoProto entry_file_info; |
1823 util::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info); | 1823 util::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info); |
1824 *entry_proto->mutable_file_info() = entry_file_info; | 1824 *entry_proto->mutable_file_info() = entry_file_info; |
1825 callback.Run(FILE_ERROR_OK, entry_proto.Pass()); | 1825 callback.Run(FILE_ERROR_OK, entry_proto.Pass()); |
1826 } | 1826 } |
1827 | 1827 |
1828 } // namespace drive | 1828 } // namespace drive |
OLD | NEW |