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

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

Issue 10825120: gdata: Introduce GDataWapiFeedProcessor class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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_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 20 matching lines...) Expand all
31 namespace gdata { 31 namespace gdata {
32 32
33 class DocumentsServiceInterface; 33 class DocumentsServiceInterface;
34 class DriveWebAppsRegistryInterface; 34 class DriveWebAppsRegistryInterface;
35 struct UploadFileInfo; 35 struct UploadFileInfo;
36 36
37 namespace { 37 namespace {
38 struct LoadRootFeedParams; 38 struct LoadRootFeedParams;
39 } // namespace 39 } // namespace
40 40
41 // TODO(satorux): Move this into a new file. crbug.com/130669
42 typedef std::map<std::string /* resource_id */, GDataEntry*>
43 FileResourceIdMap;
44
41 // The production implementation of GDataFileSystemInterface. 45 // The production implementation of GDataFileSystemInterface.
42 class GDataFileSystem : public GDataFileSystemInterface, 46 class GDataFileSystem : public GDataFileSystemInterface,
43 public content::NotificationObserver { 47 public content::NotificationObserver {
44 public: 48 public:
45 GDataFileSystem(Profile* profile, 49 GDataFileSystem(Profile* profile,
46 GDataCache* cache, 50 GDataCache* cache,
47 DocumentsServiceInterface* documents_service, 51 DocumentsServiceInterface* documents_service,
48 GDataUploaderInterface* uploader, 52 GDataUploaderInterface* uploader,
49 DriveWebAppsRegistryInterface* webapps_registry, 53 DriveWebAppsRegistryInterface* webapps_registry,
50 base::SequencedTaskRunner* blocking_task_runner); 54 base::SequencedTaskRunner* blocking_task_runner);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 struct CreateDirectoryParams; 153 struct CreateDirectoryParams;
150 154
151 // Defines set of parameters passed to an intermediate callback 155 // Defines set of parameters passed to an intermediate callback
152 // OnGetFileCompleteForOpen, during execution of OpenFile() method. 156 // OnGetFileCompleteForOpen, during execution of OpenFile() method.
153 struct GetFileCompleteForOpenParams; 157 struct GetFileCompleteForOpenParams;
154 158
155 // Defines set of parameters passed to intermediate callbacks during 159 // Defines set of parameters passed to intermediate callbacks during
156 // execution of GetFileByPath() method. 160 // execution of GetFileByPath() method.
157 struct GetFileFromCacheParams; 161 struct GetFileFromCacheParams;
158 162
159 typedef std::map<std::string /* resource_id */, GDataEntry*>
160 FileResourceIdMap;
161
162 // Callback similar to FileOperationCallback but with a given |file_path|. 163 // Callback similar to FileOperationCallback but with a given |file_path|.
163 typedef base::Callback<void(GDataFileError error, 164 typedef base::Callback<void(GDataFileError error,
164 const FilePath& file_path)> 165 const FilePath& file_path)>
165 FilePathUpdateCallback; 166 FilePathUpdateCallback;
166 167
167 // Callback run as a response to LoadFeedFromServer. 168 // Callback run as a response to LoadFeedFromServer.
168 typedef base::Callback<void(GetDocumentsParams* params, 169 typedef base::Callback<void(GetDocumentsParams* params,
169 GDataFileError error)> 170 GDataFileError error)>
170 LoadDocumentFeedCallback; 171 LoadDocumentFeedCallback;
171 172
172 // Struct used to record UMA stats with FeedToFileResourceMap().
173 struct FeedToFileResourceMapUmaStats;
174
175 // Struct used for StartFileUploadOnUIThread(). 173 // Struct used for StartFileUploadOnUIThread().
176 struct StartFileUploadParams; 174 struct StartFileUploadParams;
177 175
178 // Callback passed to |LoadFeedFromServer| from |Search| method. 176 // Callback passed to |LoadFeedFromServer| from |Search| method.
179 // |callback| is that should be run with data received from 177 // |callback| is that should be run with data received from
180 // |LoadFeedFromServer|. 178 // |LoadFeedFromServer|.
181 // |params| params used for getting document feed for content search. 179 // |params| params used for getting document feed for content search.
182 // |error| error code returned by |LoadFeedFromServer|. 180 // |error| error code returned by |LoadFeedFromServer|.
183 void OnSearch(const SearchCallback& callback, 181 void OnSearch(const SearchCallback& callback,
184 GetDocumentsParams* params, 182 GetDocumentsParams* params,
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 GDataFileError RemoveEntryFromFileSystem(const FilePath& file_path); 515 GDataFileError RemoveEntryFromFileSystem(const FilePath& file_path);
518 516
519 // Updates whole directory structure feeds collected in |feed_list|. 517 // Updates whole directory structure feeds collected in |feed_list|.
520 // On success, returns PLATFORM_FILE_OK. Record file statistics as UMA 518 // On success, returns PLATFORM_FILE_OK. Record file statistics as UMA
521 // histograms. 519 // histograms.
522 GDataFileError UpdateFromFeed( 520 GDataFileError UpdateFromFeed(
523 const std::vector<DocumentFeed*>& feed_list, 521 const std::vector<DocumentFeed*>& feed_list,
524 int largest_changestamp, 522 int largest_changestamp,
525 int root_feed_changestamp); 523 int root_feed_changestamp);
526 524
527 // Updates UMA histograms about file counts.
528 void UpdateFileCountUmaHistograms(
529 const FeedToFileResourceMapUmaStats& uma_stats) const;
530
531 // Applies the pre-processed feed from |file_map| map onto the file system.
532 // All entries in |file_map| will be erased (i.e. the map becomes empty),
533 // and values are deleted.
534 void ApplyFeedFromFileUrlMap(bool is_delta_feed,
535 int feed_changestamp,
536 FileResourceIdMap* file_map);
537
538 // Helper function for adding new |file| from the feed into |directory|. It
539 // checks the type of file and updates |changed_dirs| if this file adding
540 // operation needs to raise directory notification update. If file is being
541 // added to |orphaned_dir_service| such notifications are not raised since
542 // we ignore such files and don't add them to the file system now.
543 // static
544 static void AddEntryToDirectoryAndCollectChangedDirectories(
545 GDataEntry* entry,
546 GDataDirectory* directory,
547 GDataDirectoryService* orphaned_dir_service,
548 std::set<FilePath>* changed_dirs);
549
550 // Helper function for removing |entry| from |directory|. If |entry| is a
551 // directory too, it will collect all its children file paths into
552 // |changed_dirs| as well.
553 // static
554 static void RemoveEntryFromDirectoryAndCollectChangedDirectories(
555 GDataDirectory* directory,
556 GDataEntry* entry,
557 std::set<FilePath>* changed_dirs);
558
559 // Callback for GetEntryByResourceIdAsync. 525 // Callback for GetEntryByResourceIdAsync.
560 // Removes stale entry upon upload of file. 526 // Removes stale entry upon upload of file.
561 static void RemoveStaleEntryOnUpload(const std::string& resource_id, 527 static void RemoveStaleEntryOnUpload(const std::string& resource_id,
562 GDataDirectory* parent_dir, 528 GDataDirectory* parent_dir,
563 GDataEntry* existing_entry); 529 GDataEntry* existing_entry);
564 530
565 // Finds directory where new |file| should be added to during feed processing.
566 // |orphaned_entries_dir| collects files/dirs that don't have a parent in
567 // either locally cached file system or in this new feed.
568 GDataDirectory* FindDirectoryForNewEntry(
569 GDataEntry* new_entry,
570 const FileResourceIdMap& file_map,
571 GDataDirectoryService* orphaned_entries);
572
573 // Converts list of document feeds from collected feeds into
574 // FileResourceIdMap.
575 GDataFileError FeedToFileResourceMap(
576 const std::vector<DocumentFeed*>& feed_list,
577 FileResourceIdMap* file_map,
578 int* feed_changestamp,
579 FeedToFileResourceMapUmaStats* uma_stats);
580
581 // Converts |entry_value| into GFileDocument instance and adds it 531 // Converts |entry_value| into GFileDocument instance and adds it
582 // to virtual file system at |directory_path|. 532 // to virtual file system at |directory_path|.
583 GDataFileError AddNewDirectory(const FilePath& directory_path, 533 GDataFileError AddNewDirectory(const FilePath& directory_path,
584 base::Value* entry_value); 534 base::Value* entry_value);
585 535
586 // Given non-existing |directory_path|, finds the first missing parent 536 // Given non-existing |directory_path|, finds the first missing parent
587 // directory of |directory_path|. 537 // directory of |directory_path|.
588 FindMissingDirectoryResult FindFirstMissingParentDirectory( 538 FindMissingDirectoryResult FindFirstMissingParentDirectory(
589 const FilePath& directory_path, 539 const FilePath& directory_path,
590 GURL* last_dir_content_url, 540 GURL* last_dir_content_url,
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 base::WeakPtr<GDataFileSystem> ui_weak_ptr_; 885 base::WeakPtr<GDataFileSystem> ui_weak_ptr_;
936 886
937 ObserverList<Observer> observers_; 887 ObserverList<Observer> observers_;
938 888
939 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; 889 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
940 }; 890 };
941 891
942 } // namespace gdata 892 } // namespace gdata
943 893
944 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ 894 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/gdata/gdata_file_system.cc » ('j') | chrome/browser/chromeos/gdata/gdata_file_system.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698