summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/gdata/gdata_files.h
diff options
context:
space:
mode:
authortbarzic@chromium.org <tbarzic@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-06 22:59:54 +0000
committertbarzic@chromium.org <tbarzic@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-06 22:59:54 +0000
commit32d697898ed85f514480c19f25737a5b9c3c42a4 (patch)
treefc332112de4ee4e1bbc6f5ca1350809c13da5c5b /chrome/browser/chromeos/gdata/gdata_files.h
parent3f3cde2429575665237e4fdff7e29d650a70c420 (diff)
downloadchromium_src-32d697898ed85f514480c19f25737a5b9c3c42a4.zip
chromium_src-32d697898ed85f514480c19f25737a5b9c3c42a4.tar.gz
chromium_src-32d697898ed85f514480c19f25737a5b9c3c42a4.tar.bz2
Add gdata content search
Search results will be shown under virtual path gdata/.search/<query>. 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 <resource_id>.<real_file_name> 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
Diffstat (limited to 'chrome/browser/chromeos/gdata/gdata_files.h')
-rw-r--r--chrome/browser/chromeos/gdata/gdata_files.h38
1 files changed, 38 insertions, 0 deletions
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 <map>
#include <string>
+#include <vector>
#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: <search_result_path><search_result_child_path>.
+ // <search_result_child_path> 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 <resource_id>.<file_name>.
+ // We can define "search result path references gdata entry" for gdata search
+ // results by:
+ // Entry that whose file name is <file_name>, and has the same parent as
+ // the entry with resource id <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<FilePath::StringType>* 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<GDataDirectory> fake_search_directory_;
+
base::Time last_serialized_;
int largest_changestamp_;
size_t serialized_size_;