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

Side by Side Diff: chrome/browser/chromeos/gdata/drive_file_system.h

Issue 10874028: Rename GDataFileSystem* to DriveFileSystem* (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remaining manual changes Created 8 years, 4 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 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_FILE_SYSTEM_H_
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ 6 #define CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_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/api/prefs/pref_change_registrar.h" 18 #include "chrome/browser/api/prefs/pref_change_registrar.h"
19 #include "chrome/browser/chromeos/gdata/drive_cache.h" 19 #include "chrome/browser/chromeos/gdata/drive_cache.h"
20 #include "chrome/browser/chromeos/gdata/drive_file_system_interface.h"
20 #include "chrome/browser/chromeos/gdata/drive_resource_metadata.h" 21 #include "chrome/browser/chromeos/gdata/drive_resource_metadata.h"
21 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h" 22 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h"
22 #include "chrome/browser/chromeos/gdata/gdata_file_system_interface.h"
23 #include "chrome/browser/chromeos/gdata/gdata_wapi_feed_loader.h" 23 #include "chrome/browser/chromeos/gdata/gdata_wapi_feed_loader.h"
24 #include "chrome/browser/chromeos/gdata/gdata_wapi_feed_processor.h" 24 #include "chrome/browser/chromeos/gdata/gdata_wapi_feed_processor.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 DriveServiceInterface; 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 DriveFileSystemInterface.
40 class GDataFileSystem : public GDataFileSystemInterface, 40 class DriveFileSystem : public DriveFileSystemInterface,
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 DriveFileSystem(Profile* profile,
45 DriveCache* cache, 45 DriveCache* cache,
46 DriveServiceInterface* drive_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 ~DriveFileSystem();
51 51
52 // GDataFileSystem overrides. 52 // DriveFileSystem 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 DriveFileSystemInterface::Observer* observer) OVERRIDE;
56 virtual void RemoveObserver( 56 virtual void RemoveObserver(
57 GDataFileSystemInterface::Observer* observer) OVERRIDE; 57 DriveFileSystemInterface::Observer* observer) OVERRIDE;
58 virtual void StartUpdates() OVERRIDE; 58 virtual void StartUpdates() OVERRIDE;
59 virtual void StopUpdates() OVERRIDE; 59 virtual void StopUpdates() OVERRIDE;
60 virtual void NotifyFileSystemMounted() OVERRIDE; 60 virtual void NotifyFileSystemMounted() OVERRIDE;
61 virtual void NotifyFileSystemToBeUnmounted() OVERRIDE; 61 virtual void NotifyFileSystemToBeUnmounted() OVERRIDE;
62 virtual void CheckForUpdates() OVERRIDE; 62 virtual void CheckForUpdates() OVERRIDE;
63 virtual void GetEntryInfoByResourceId( 63 virtual void GetEntryInfoByResourceId(
64 const std::string& resource_id, 64 const std::string& resource_id,
65 const GetEntryInfoWithFilePathCallback& callback) OVERRIDE; 65 const GetEntryInfoWithFilePathCallback& callback) OVERRIDE;
66 virtual void Search(const std::string& search_query, 66 virtual void Search(const std::string& search_query,
67 const GURL& next_feed, 67 const GURL& next_feed,
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 void LoadRootFeedFromCacheForTesting(); 142 void LoadRootFeedFromCacheForTesting();
143 143
144 // Used in tests to update the file system from |feed_list|. 144 // Used in tests to update the file system from |feed_list|.
145 // See also the comment at GDataWapiFeedLoader::UpdateFromFeed(). 145 // See also the comment at GDataWapiFeedLoader::UpdateFromFeed().
146 DriveFileError UpdateFromFeedForTesting( 146 DriveFileError UpdateFromFeedForTesting(
147 const std::vector<DocumentFeed*>& feed_list, 147 const std::vector<DocumentFeed*>& feed_list,
148 int64 start_changestamp, 148 int64 start_changestamp,
149 int64 root_feed_changestamp); 149 int64 root_feed_changestamp);
150 150
151 private: 151 private:
152 friend class GDataFileSystemTest; 152 friend class DriveFileSystemTest;
153 FRIEND_TEST_ALL_PREFIXES(GDataFileSystemTest, 153 FRIEND_TEST_ALL_PREFIXES(DriveFileSystemTest,
154 FindFirstMissingParentDirectory); 154 FindFirstMissingParentDirectory);
155 155
156 // Defines possible search results of FindFirstMissingParentDirectory(). 156 // Defines possible search results of FindFirstMissingParentDirectory().
157 enum FindMissingDirectoryResult { 157 enum FindMissingDirectoryResult {
158 // Target directory found, it's not a directory. 158 // Target directory found, it's not a directory.
159 FOUND_INVALID, 159 FOUND_INVALID,
160 // Found missing directory segment while searching for given directory. 160 // Found missing directory segment while searching for given directory.
161 FOUND_MISSING, 161 FOUND_MISSING,
162 // Found target directory, it already exists. 162 // Found target directory, it already exists.
163 DIRECTORY_ALREADY_PRESENT, 163 DIRECTORY_ALREADY_PRESENT,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 void TransferFileFromLocalToRemoteAfterGetEntryInfo( 195 void TransferFileFromLocalToRemoteAfterGetEntryInfo(
196 const FilePath& local_src_file_path, 196 const FilePath& local_src_file_path,
197 const FilePath& remote_dest_file_path, 197 const FilePath& remote_dest_file_path,
198 const FileOperationCallback& callback, 198 const FileOperationCallback& callback,
199 DriveFileError error, 199 DriveFileError error,
200 scoped_ptr<DriveEntryProto> entry_proto); 200 scoped_ptr<DriveEntryProto> entry_proto);
201 201
202 // Initiates transfer of |local_file_path| with |resource_id| to 202 // Initiates transfer of |local_file_path| with |resource_id| to
203 // |remote_dest_file_path|. |local_file_path| must be a file from the local 203 // |remote_dest_file_path|. |local_file_path| must be a file from the local
204 // file system, |remote_dest_file_path| is the virtual destination path within 204 // file system, |remote_dest_file_path| is the virtual destination path within
205 // gdata file system. If |resource_id| is a non-empty string, the transfer is 205 // Drive file system. If |resource_id| is a non-empty string, the transfer is
206 // handled by CopyDocumentToDirectory. Otherwise, the transfer is handled by 206 // handled by CopyDocumentToDirectory. Otherwise, the transfer is handled by
207 // TransferRegularFile. 207 // TransferRegularFile.
208 // 208 //
209 // Must be called from *UI* thread. |callback| is run on the calling thread. 209 // Must be called from *UI* thread. |callback| is run on the calling thread.
210 // |callback| must not be null. 210 // |callback| must not be null.
211 void TransferFileForResourceId(const FilePath& local_file_path, 211 void TransferFileForResourceId(const FilePath& local_file_path,
212 const FilePath& remote_dest_file_path, 212 const FilePath& remote_dest_file_path,
213 const FileOperationCallback& callback, 213 const FileOperationCallback& callback,
214 std::string* resource_id); 214 std::string* resource_id);
215 215
216 // Initiates transfer of |local_file_path| to |remote_dest_file_path|. 216 // Initiates transfer of |local_file_path| to |remote_dest_file_path|.
217 // |local_file_path| must be a regular file (i.e. not a hosted document) from 217 // |local_file_path| must be a regular file (i.e. not a hosted document) from
218 // the local file system, |remote_dest_file_path| is the virtual destination 218 // the local file system, |remote_dest_file_path| is the virtual destination
219 // path within gdata file system. 219 // path within Drive file system.
220 // 220 //
221 // Must be called from *UI* thread. |callback| is run on the calling thread. 221 // Must be called from *UI* thread. |callback| is run on the calling thread.
222 void TransferRegularFile(const FilePath& local_file_path, 222 void TransferRegularFile(const FilePath& local_file_path,
223 const FilePath& remote_dest_file_path, 223 const FilePath& remote_dest_file_path,
224 const FileOperationCallback& callback); 224 const FileOperationCallback& callback);
225 225
226 // Invoked during the process of CreateFile. 226 // Invoked during the process of CreateFile.
227 // First, FindEntryByPathAsyncOnUIThread is called and the result is returned 227 // First, FindEntryByPathAsyncOnUIThread is called and the result is returned
228 // to OnGetEntryInfoForCreateFile. By using the information, CreateFile deals 228 // to OnGetEntryInfoForCreateFile. By using the information, CreateFile deals
229 // with the cases when an entry already existed at the path. If there was no 229 // with the cases when an entry already existed at the path. If there was no
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 void CheckLocalModificationAndRunAfterGetFileInfo( 831 void CheckLocalModificationAndRunAfterGetFileInfo(
832 scoped_ptr<DriveEntryProto> entry_proto, 832 scoped_ptr<DriveEntryProto> entry_proto,
833 const GetEntryInfoCallback& callback, 833 const GetEntryInfoCallback& callback,
834 base::PlatformFileInfo* file_info, 834 base::PlatformFileInfo* file_info,
835 bool* get_file_info_result); 835 bool* get_file_info_result);
836 836
837 // All members should be accessed only on UI thread. Do not post tasks to 837 // All members should be accessed only on UI thread. Do not post tasks to
838 // other threads with base::Unretained(this). 838 // other threads with base::Unretained(this).
839 scoped_ptr<DriveResourceMetadata> resource_metadata_; 839 scoped_ptr<DriveResourceMetadata> resource_metadata_;
840 840
841 // The profile hosts the GDataFileSystem via GDataSystemService. 841 // The profile hosts the DriveFileSystem via GDataSystemService.
842 Profile* profile_; 842 Profile* profile_;
843 843
844 // The cache owned by GDataSystemService. 844 // The cache owned by GDataSystemService.
845 DriveCache* cache_; 845 DriveCache* cache_;
846 846
847 // The uploader owned by GDataSystemService. 847 // The uploader owned by GDataSystemService.
848 GDataUploaderInterface* uploader_; 848 GDataUploaderInterface* uploader_;
849 849
850 // The document service owned by GDataSystemService. 850 // The document service owned by GDataSystemService.
851 DriveServiceInterface* drive_service_; 851 DriveServiceInterface* drive_service_;
852 852
853 // The webapps registry owned by GDataSystemService. 853 // The webapps registry owned by GDataSystemService.
854 DriveWebAppsRegistryInterface* webapps_registry_; 854 DriveWebAppsRegistryInterface* webapps_registry_;
855 855
856 // Periodic timer for checking updates. 856 // Periodic timer for checking updates.
857 base::Timer update_timer_; 857 base::Timer update_timer_;
858 858
859 // True if hosted documents should be hidden. 859 // True if hosted documents should be hidden.
860 bool hide_hosted_docs_; 860 bool hide_hosted_docs_;
861 861
862 // The set of paths opened by OpenFile but not yet closed by CloseFile. 862 // The set of paths opened by OpenFile but not yet closed by CloseFile.
863 std::set<FilePath> open_files_; 863 std::set<FilePath> open_files_;
864 864
865 scoped_ptr<PrefChangeRegistrar> pref_registrar_; 865 scoped_ptr<PrefChangeRegistrar> pref_registrar_;
866 866
867 // The loader is used to load the feeds. 867 // The loader is used to load the feeds.
868 scoped_ptr<GDataWapiFeedLoader> feed_loader_; 868 scoped_ptr<GDataWapiFeedLoader> feed_loader_;
869 869
870 ObserverList<GDataFileSystemInterface::Observer> observers_; 870 ObserverList<DriveFileSystemInterface::Observer> observers_;
871 871
872 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; 872 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
873 873
874 // WeakPtrFactory and WeakPtr bound to the UI thread. 874 // WeakPtrFactory and WeakPtr bound to the UI thread.
875 // Note: These should remain the last member so they'll be destroyed and 875 // Note: These should remain the last member so they'll be destroyed and
876 // invalidate the weak pointers before any other members are destroyed. 876 // invalidate the weak pointers before any other members are destroyed.
877 base::WeakPtrFactory<GDataFileSystem> ui_weak_ptr_factory_; 877 base::WeakPtrFactory<DriveFileSystem> ui_weak_ptr_factory_;
878 // Unlike other classes, we need this as we need this to redirect a task 878 // Unlike other classes, we need this as we need this to redirect a task
879 // from IO thread to UI thread. 879 // from IO thread to UI thread.
880 base::WeakPtr<GDataFileSystem> ui_weak_ptr_; 880 base::WeakPtr<DriveFileSystem> ui_weak_ptr_;
881 }; 881 };
882 882
883 } // namespace gdata 883 } // namespace gdata
884 884
885 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ 885 #endif // CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_FILE_SYSTEM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698