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

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

Issue 10274002: Add gdata content search (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: style nits Created 8 years, 7 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_UTIL_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_UTIL_H_
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_UTIL_H_ 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_UTIL_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "googleurl/src/gurl.h" 12 #include "googleurl/src/gurl.h"
13 13
14 class FilePath; 14 class FilePath;
15 class Profile; 15 class Profile;
16 16
17 namespace gdata { 17 namespace gdata {
18 namespace util { 18 namespace util {
19 19
20 // Search path is a path used to display gdata content search results.
21 // All results are displayed under virtual directory "gdata/.search", in which
22 // each query is given its own directory for displaying results.
23 enum GDataSearchPathType {
24 // Not a search path.
25 GDATA_SEARCH_PATH_INVALID,
26 // gdata/.search.
27 GDATA_SEARCH_PATH_ROOT,
28 // Path that defines search query (gdata/.search/foo).
29 GDATA_SEARCH_PATH_QUERY,
30 // Path given to a search result (gdata/.search/foo/foo_found).
31 // The file name will be formatted: "resource_id.file_name".
32 GDATA_SEARCH_PATH_RESULT,
33 // If search result is directory, it may contain some children.
34 GDATA_SEARCH_PATH_RESULT_CHILD
35 };
36
20 // Returns the GData mount point path, which looks like "/special/gdata". 37 // Returns the GData mount point path, which looks like "/special/gdata".
21 const FilePath& GetGDataMountPointPath(); 38 const FilePath& GetGDataMountPointPath();
22 39
23 // Returns the GData mount path as string. 40 // Returns the GData mount path as string.
24 const std::string& GetGDataMountPointPathAsString(); 41 const std::string& GetGDataMountPointPathAsString();
25 42
26 // Returns the 'local' root of remote file system as "/special". 43 // Returns the 'local' root of remote file system as "/special".
27 const FilePath& GetSpecialRemoteRootPath(); 44 const FilePath& GetSpecialRemoteRootPath();
28 45
29 // Returns the gdata file resource url formatted as 46 // Returns the gdata file resource url formatted as
30 // chrome://gdata/<resource_id>/<file_name>. 47 // chrome://gdata/<resource_id>/<file_name>.
31 GURL GetFileResourceUrl(const std::string& resource_id, 48 GURL GetFileResourceUrl(const std::string& resource_id,
32 const std::string& file_name); 49 const std::string& file_name);
33 50
34 // Given a profile and a gdata_cache_path, return the file resource url. 51 // Given a profile and a gdata_cache_path, return the file resource url.
35 void ModifyGDataFileResourceUrl(Profile* profile, 52 void ModifyGDataFileResourceUrl(Profile* profile,
36 const FilePath& gdata_cache_path, 53 const FilePath& gdata_cache_path,
37 GURL* url); 54 GURL* url);
38 55
39 // Returns true if the given path is under the GData mount point. 56 // Returns true if the given path is under the GData mount point.
40 bool IsUnderGDataMountPoint(const FilePath& path); 57 bool IsUnderGDataMountPoint(const FilePath& path);
41 58
59 // Checks if the path is under (virtual) gdata search directory, and returns its
60 // search status.
61 GDataSearchPathType GetSearchPathStatus(const FilePath& path);
62
63 // Checks if the path is under (virtual) gdata earch directory, and returns its
64 // search status.
65 GDataSearchPathType GetSearchPathStatusForPathComponents(
66 const std::vector<std::string>& path_components);
67
68 // Gets resource id and original file name from the search file name.
69 // Search file name is formatted as: <resource_id>.<original_file_name>.
70 // If the path is not search path, the behaviour is not defined.
71 bool ParseSearchFileName(const std::string& search_file_name,
72 std::string* resource_id,
73 std::string* original_file_name);
74
42 // Extracts the GData path from the given path located under the GData mount 75 // Extracts the GData path from the given path located under the GData mount
43 // point. Returns an empty path if |path| is not under the GData mount point. 76 // point. Returns an empty path if |path| is not under the GData mount point.
44 // Examples: ExtractGDatPath("/special/gdata/foo.txt") => "gdata/foo.txt" 77 // Examples: ExtractGDatPath("/special/gdata/foo.txt") => "gdata/foo.txt"
45 FilePath ExtractGDataPath(const FilePath& path); 78 FilePath ExtractGDataPath(const FilePath& path);
46 79
47 // Returns vector of all possible cache paths for a given path on gdata mount 80 // Returns vector of all possible cache paths for a given path on gdata mount
48 // point. 81 // point.
49 void InsertGDataCachePathsPermissions( 82 void InsertGDataCachePathsPermissions(
50 Profile* profile_, 83 Profile* profile_,
51 const FilePath& gdata_path, 84 const FilePath& gdata_path,
(...skipping 21 matching lines...) Expand all
73 // Example: path="/user/GCache/v1/persistent/pdf:a1b2.01234567.mounted" => 106 // Example: path="/user/GCache/v1/persistent/pdf:a1b2.01234567.mounted" =>
74 // resource_id="pdf:a1b2", md5="01234567", extra_extension="mounted". 107 // resource_id="pdf:a1b2", md5="01234567", extra_extension="mounted".
75 void ParseCacheFilePath(const FilePath& path, 108 void ParseCacheFilePath(const FilePath& path,
76 std::string* resource_id, 109 std::string* resource_id,
77 std::string* md5, 110 std::string* md5,
78 std::string* extra_extension); 111 std::string* extra_extension);
79 } // namespace util 112 } // namespace util
80 } // namespace gdata 113 } // namespace gdata
81 114
82 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_UTIL_H_ 115 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_UTIL_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_operations.cc ('k') | chrome/browser/chromeos/gdata/gdata_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698