Chromium Code Reviews| 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> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
| 16 #include "base/platform_file.h" | 16 #include "base/platform_file.h" |
| 17 #include "base/timer.h" | 17 #include "base/timer.h" |
| 18 #include "chrome/browser/chromeos/gdata/gdata_cache.h" | 18 #include "chrome/browser/chromeos/gdata/gdata_cache.h" |
| 19 #include "chrome/browser/chromeos/gdata/gdata_file_system_interface.h" | 19 #include "chrome/browser/chromeos/gdata/gdata_file_system_interface.h" |
| 20 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h" | 20 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h" |
| 21 #include "chrome/browser/chromeos/gdata/gdata_files.h" | 21 #include "chrome/browser/chromeos/gdata/gdata_files.h" |
| 22 #include "chrome/browser/prefs/pref_change_registrar.h" | 22 #include "chrome/browser/prefs/pref_change_registrar.h" |
| 23 #include "content/public/browser/notification_observer.h" | 23 #include "content/public/browser/notification_observer.h" |
| 24 | 24 |
| 25 namespace base { | 25 namespace base { |
| 26 | |
| 27 class SequencedTaskRunner; | 26 class SequencedTaskRunner; |
| 28 | |
| 29 } // namespace base | 27 } // namespace base |
| 30 | 28 |
| 31 namespace gdata { | 29 namespace gdata { |
| 32 | 30 |
| 33 class DocumentsServiceInterface; | 31 class DocumentsServiceInterface; |
| 34 class DriveWebAppsRegistryInterface; | 32 class DriveWebAppsRegistryInterface; |
| 35 struct UploadFileInfo; | 33 struct UploadFileInfo; |
| 36 | 34 |
| 37 namespace { | 35 namespace { |
| 38 struct LoadRootFeedParams; | 36 struct LoadRootFeedParams; |
| 39 } // namespace | 37 } // namespace |
| 40 | 38 |
| 41 // The production implementation of GDataFileSystemInterface. | 39 // The production implementation of GDataFileSystemInterface. |
| 42 class GDataFileSystem : public GDataFileSystemInterface, | 40 class GDataFileSystem : public GDataFileSystemInterface, |
| 43 public content::NotificationObserver { | 41 public content::NotificationObserver { |
| 44 public: | 42 public: |
| 45 GDataFileSystem(Profile* profile, | 43 GDataFileSystem(Profile* profile, |
| 46 GDataCache* cache, | 44 GDataCache* cache, |
| 45 GDataDirectoryService* directory_service, | |
|
hashimoto
2012/07/24 08:41:51
Are you going to inject a mock in tests?
| |
| 47 DocumentsServiceInterface* documents_service, | 46 DocumentsServiceInterface* documents_service, |
| 48 GDataUploaderInterface* uploader, | 47 GDataUploaderInterface* uploader, |
| 49 DriveWebAppsRegistryInterface* webapps_registry, | 48 DriveWebAppsRegistryInterface* webapps_registry, |
| 50 base::SequencedTaskRunner* blocking_task_runner); | 49 base::SequencedTaskRunner* blocking_task_runner); |
| 51 virtual ~GDataFileSystem(); | 50 virtual ~GDataFileSystem(); |
| 52 | 51 |
| 53 // GDataFileSystem overrides. | 52 // GDataFileSystem overrides. |
| 54 virtual void Initialize() OVERRIDE; | 53 virtual void Initialize() OVERRIDE; |
| 55 virtual void AddObserver(Observer* observer) OVERRIDE; | 54 virtual void AddObserver(Observer* observer) OVERRIDE; |
| 56 virtual void RemoveObserver(Observer* observer) OVERRIDE; | 55 virtual void RemoveObserver(Observer* observer) OVERRIDE; |
| (...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 839 GDataFileError error, | 838 GDataFileError error, |
| 840 scoped_ptr<GDataEntryProto> entry_proto); | 839 scoped_ptr<GDataEntryProto> entry_proto); |
| 841 | 840 |
| 842 // Part of RequestDirectoryRefreshOnUIThread(). Called after | 841 // Part of RequestDirectoryRefreshOnUIThread(). Called after |
| 843 // GetEntryInfoByPath() is complete. | 842 // GetEntryInfoByPath() is complete. |
| 844 void RequestDirectoryRefreshOnUIThreadAfterGetEntryInfo( | 843 void RequestDirectoryRefreshOnUIThreadAfterGetEntryInfo( |
| 845 const FilePath& file_path, | 844 const FilePath& file_path, |
| 846 GDataFileError error, | 845 GDataFileError error, |
| 847 scoped_ptr<GDataEntryProto> entry_proto); | 846 scoped_ptr<GDataEntryProto> entry_proto); |
| 848 | 847 |
| 849 // All members should be accessed only on UI thread. Do not post tasks to | |
| 850 // other threads with base::Unretained(this). | |
| 851 scoped_ptr<GDataDirectoryService> directory_service_; | |
| 852 | |
| 853 // The profile hosts the GDataFileSystem via GDataSystemService. | 848 // The profile hosts the GDataFileSystem via GDataSystemService. |
| 854 Profile* profile_; | 849 Profile* profile_; |
| 855 | 850 |
| 856 // The cache owned by GDataSystemService. | 851 // The cache owned by GDataSystemService. |
| 857 GDataCache* cache_; | 852 GDataCache* cache_; |
| 858 | 853 |
| 854 // All members should be accessed only on UI thread. Do not post tasks to | |
| 855 // other threads with base::Unretained(this). Owned by GDataSystemService. | |
| 856 GDataDirectoryService* directory_service_; | |
| 857 | |
| 859 // The uploader owned by GDataSystemService. | 858 // The uploader owned by GDataSystemService. |
| 860 GDataUploaderInterface* uploader_; | 859 GDataUploaderInterface* uploader_; |
| 861 | 860 |
| 862 // The document service owned by GDataSystemService. | 861 // The document service owned by GDataSystemService. |
| 863 DocumentsServiceInterface* documents_service_; | 862 DocumentsServiceInterface* documents_service_; |
| 864 | 863 |
| 865 // The webapps registry owned by GDataSystemService. | 864 // The webapps registry owned by GDataSystemService. |
| 866 DriveWebAppsRegistryInterface* webapps_registry_; | 865 DriveWebAppsRegistryInterface* webapps_registry_; |
| 867 | 866 |
| 868 // Periodic timer for checking updates. | 867 // Periodic timer for checking updates. |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 881 base::WeakPtr<GDataFileSystem> ui_weak_ptr_; | 880 base::WeakPtr<GDataFileSystem> ui_weak_ptr_; |
| 882 | 881 |
| 883 ObserverList<Observer> observers_; | 882 ObserverList<Observer> observers_; |
| 884 | 883 |
| 885 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 884 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
| 886 }; | 885 }; |
| 887 | 886 |
| 888 } // namespace gdata | 887 } // namespace gdata |
| 889 | 888 |
| 890 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ | 889 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ |
| OLD | NEW |