From 32d697898ed85f514480c19f25737a5b9c3c42a4 Mon Sep 17 00:00:00 2001 From: "tbarzic@chromium.org" Date: Sun, 6 May 2012 22:59:54 +0000 Subject: Add gdata content search Search results will be shown under virtual path gdata/.search/. Content search will be triggered whenever we try to enumerate directory with the mentioned file path format. Entries returned by search results will have file names formatted as . NOTE: the file manager part is in separate cl. TEST = manual, unittests: *GData* BUG=chromium-os:27539 Review URL: https://chromiumcodereview.appspot.com/10274002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@135606 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/chromeos/gdata/gdata_files.h | 38 +++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'chrome/browser/chromeos/gdata/gdata_files.h') diff --git a/chrome/browser/chromeos/gdata/gdata_files.h b/chrome/browser/chromeos/gdata/gdata_files.h index 7e000db..6beb1fd 100644 --- a/chrome/browser/chromeos/gdata/gdata_files.h +++ b/chrome/browser/chromeos/gdata/gdata_files.h @@ -8,6 +8,7 @@ #include #include +#include #include "base/callback.h" #include "base/gtest_prod_util.h" @@ -138,6 +139,12 @@ class GDataEntry { // delta feeds. bool is_deleted() const { return deleted_; } + // True if the entry is not bound to any file system (i.e. doesn't have a root + // directory set). E.g. |fake_search_directory| below. + // NOTE: GDataRootDirectories will return true here, since they have + // themselves as root directories. + bool is_detached() const { return root_ == NULL; } + // Returns virtual file path representing this file system entry. This path // corresponds to file path expected by public methods of GDataFileSyste // class. @@ -493,9 +500,40 @@ class GDataRootDirectory : public GDataDirectory { void ToProto(GDataRootDirectoryProto* proto) const; private: + // Used in |FindEntryByPath| if the path that is being searched for is + // pointing to a search result path. The find entry parameters should be + // modified to point to the actual file system entry that is referenced by + // virtual search path. + // Search path is formatted: . + // is used when search result is directory, and is + // relative to search result path (id references some content inside search + // result). + // Search result file name will be formatted .. + // We can define "search result path references gdata entry" for gdata search + // results by: + // Entry that whose file name is , and has the same parent as + // the entry with resource id . This definition enables us to + // test uniqueness of the proposed name when renaming gdata search result. + // + // For example, if gdata/.search/foo/res_id.foo_name references + // gdata/result_parent/result, and the search path is + // gdata/.search/foo/res_ud.foo_name/foo_child, we'll set current dir to the + // entry with path reulst_parent, and components to [result_parent, result, + // foo_child]. + bool ModifyFindEntryParamsForSearchPath( + const FilePath& file_path, + std::vector* components, + GDataDirectory** current_dir, + FilePath* directory_path); + ResourceMap resource_map_; CacheMap cache_map_; + // Fake directory that will be returned when searching for content search + // paths to make file manager happy when resolving paths. This directory + // should never be used for file operations or storing file entries. + scoped_ptr fake_search_directory_; + base::Time last_serialized_; int largest_changestamp_; size_t serialized_size_; -- cgit v1.1