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 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ |
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ | 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "chrome/browser/chromeos/gdata/gdata_wapi_feed_processor.h" | 23 #include "chrome/browser/chromeos/gdata/gdata_wapi_feed_processor.h" |
24 #include "chrome/browser/prefs/pref_change_registrar.h" | 24 #include "chrome/browser/prefs/pref_change_registrar.h" |
25 #include "content/public/browser/notification_observer.h" | 25 #include "content/public/browser/notification_observer.h" |
26 | 26 |
27 namespace base { | 27 namespace base { |
28 class SequencedTaskRunner; | 28 class SequencedTaskRunner; |
29 } | 29 } |
30 | 30 |
31 namespace gdata { | 31 namespace gdata { |
32 | 32 |
33 class DocumentsServiceInterface; | 33 class DriveServiceInterface; |
34 class DriveWebAppsRegistryInterface; | 34 class DriveWebAppsRegistryInterface; |
35 class GDataUploaderInterface; | 35 class GDataUploaderInterface; |
36 class GDataWapiFeedLoader; | 36 class GDataWapiFeedLoader; |
37 struct UploadFileInfo; | 37 struct UploadFileInfo; |
38 | 38 |
39 // The production implementation of GDataFileSystemInterface. | 39 // The production implementation of GDataFileSystemInterface. |
40 class GDataFileSystem : public GDataFileSystemInterface, | 40 class GDataFileSystem : public GDataFileSystemInterface, |
41 public GDataWapiFeedLoader::Observer, | 41 public GDataWapiFeedLoader::Observer, |
42 public content::NotificationObserver { | 42 public content::NotificationObserver { |
43 public: | 43 public: |
44 GDataFileSystem(Profile* profile, | 44 GDataFileSystem(Profile* profile, |
45 GDataCache* cache, | 45 GDataCache* cache, |
46 DocumentsServiceInterface* documents_service, | 46 DriveServiceInterface* drive_service, |
47 GDataUploaderInterface* uploader, | 47 GDataUploaderInterface* uploader, |
48 DriveWebAppsRegistryInterface* webapps_registry, | 48 DriveWebAppsRegistryInterface* webapps_registry, |
49 base::SequencedTaskRunner* blocking_task_runner); | 49 base::SequencedTaskRunner* blocking_task_runner); |
50 virtual ~GDataFileSystem(); | 50 virtual ~GDataFileSystem(); |
51 | 51 |
52 // GDataFileSystem overrides. | 52 // GDataFileSystem overrides. |
53 virtual void Initialize() OVERRIDE; | 53 virtual void Initialize() OVERRIDE; |
54 virtual void AddObserver( | 54 virtual void AddObserver( |
55 GDataFileSystemInterface::Observer* observer) OVERRIDE; | 55 GDataFileSystemInterface::Observer* observer) OVERRIDE; |
56 virtual void RemoveObserver( | 56 virtual void RemoveObserver( |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 | 588 |
589 // Helper function for internally handling responses from | 589 // Helper function for internally handling responses from |
590 // GetFileFromCacheByResourceIdAndMd5() calls during processing of | 590 // GetFileFromCacheByResourceIdAndMd5() calls during processing of |
591 // GetFileByPath() request. | 591 // GetFileByPath() request. |
592 void OnGetFileFromCache(const GetFileFromCacheParams& params, | 592 void OnGetFileFromCache(const GetFileFromCacheParams& params, |
593 GDataFileError error, | 593 GDataFileError error, |
594 const std::string& resource_id, | 594 const std::string& resource_id, |
595 const std::string& md5, | 595 const std::string& md5, |
596 const FilePath& cache_file_path); | 596 const FilePath& cache_file_path); |
597 | 597 |
598 // Callback for |documents_service_->GetDocumentEntry|. | 598 // Callback for |drive_service_->GetDocumentEntry|. |
599 // It is called before file download. If GetDocumentEntry was successful, | 599 // It is called before file download. If GetDocumentEntry was successful, |
600 // file download procedure is started for the file. The file is downloaded | 600 // file download procedure is started for the file. The file is downloaded |
601 // from the content url extracted from the fetched metadata to | 601 // from the content url extracted from the fetched metadata to |
602 // |cache_file_path|. Also, available space checks are done using file size | 602 // |cache_file_path|. Also, available space checks are done using file size |
603 // from the fetched metadata. | 603 // from the fetched metadata. |
604 void OnGetDocumentEntry(const FilePath& cache_file_path, | 604 void OnGetDocumentEntry(const FilePath& cache_file_path, |
605 const GetFileFromCacheParams& params, | 605 const GetFileFromCacheParams& params, |
606 GDataErrorCode status, | 606 GDataErrorCode status, |
607 scoped_ptr<base::Value> data); | 607 scoped_ptr<base::Value> data); |
608 | 608 |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 // The profile hosts the GDataFileSystem via GDataSystemService. | 816 // The profile hosts the GDataFileSystem via GDataSystemService. |
817 Profile* profile_; | 817 Profile* profile_; |
818 | 818 |
819 // The cache owned by GDataSystemService. | 819 // The cache owned by GDataSystemService. |
820 GDataCache* cache_; | 820 GDataCache* cache_; |
821 | 821 |
822 // The uploader owned by GDataSystemService. | 822 // The uploader owned by GDataSystemService. |
823 GDataUploaderInterface* uploader_; | 823 GDataUploaderInterface* uploader_; |
824 | 824 |
825 // The document service owned by GDataSystemService. | 825 // The document service owned by GDataSystemService. |
826 DocumentsServiceInterface* documents_service_; | 826 DriveServiceInterface* drive_service_; |
827 | 827 |
828 // The webapps registry owned by GDataSystemService. | 828 // The webapps registry owned by GDataSystemService. |
829 DriveWebAppsRegistryInterface* webapps_registry_; | 829 DriveWebAppsRegistryInterface* webapps_registry_; |
830 | 830 |
831 // Periodic timer for checking updates. | 831 // Periodic timer for checking updates. |
832 base::Timer update_timer_; | 832 base::Timer update_timer_; |
833 | 833 |
834 // True if hosted documents should be hidden. | 834 // True if hosted documents should be hidden. |
835 bool hide_hosted_docs_; | 835 bool hide_hosted_docs_; |
836 | 836 |
(...skipping 14 matching lines...) Expand all Loading... |
851 // invalidate the weak pointers before any other members are destroyed. | 851 // invalidate the weak pointers before any other members are destroyed. |
852 base::WeakPtrFactory<GDataFileSystem> ui_weak_ptr_factory_; | 852 base::WeakPtrFactory<GDataFileSystem> ui_weak_ptr_factory_; |
853 // Unlike other classes, we need this as we need this to redirect a task | 853 // Unlike other classes, we need this as we need this to redirect a task |
854 // from IO thread to UI thread. | 854 // from IO thread to UI thread. |
855 base::WeakPtr<GDataFileSystem> ui_weak_ptr_; | 855 base::WeakPtr<GDataFileSystem> ui_weak_ptr_; |
856 }; | 856 }; |
857 | 857 |
858 } // namespace gdata | 858 } // namespace gdata |
859 | 859 |
860 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ | 860 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ |
OLD | NEW |