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

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: a nit 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 const char kGDataViewFileHostnameUrl[] = "viewfile"; 37 const char kGDataViewFileHostnameUrl[] = "viewfile";
21 38
22 // Returns the GData mount point path, which looks like "/special/gdata". 39 // Returns the GData mount point path, which looks like "/special/gdata".
23 const FilePath& GetGDataMountPointPath(); 40 const FilePath& GetGDataMountPointPath();
24 41
25 // Returns the GData mount path as string. 42 // Returns the GData mount path as string.
26 const std::string& GetGDataMountPointPathAsString(); 43 const std::string& GetGDataMountPointPathAsString();
27 44
28 // Returns the 'local' root of remote file system as "/special". 45 // Returns the 'local' root of remote file system as "/special".
29 const FilePath& GetSpecialRemoteRootPath(); 46 const FilePath& GetSpecialRemoteRootPath();
30 47
31 // Returns the gdata file resource url formatted as 48 // Returns the gdata file resource url formatted as
32 // chrome://gdata/<resource_id>/<file_name>. 49 // chrome://gdata/<resource_id>/<file_name>.
33 GURL GetFileResourceUrl(const std::string& resource_id, 50 GURL GetFileResourceUrl(const std::string& resource_id,
34 const std::string& file_name); 51 const std::string& file_name);
35 52
36 // Given a profile and a gdata_cache_path, return the file resource url. 53 // Given a profile and a gdata_cache_path, return the file resource url.
37 void ModifyGDataFileResourceUrl(Profile* profile, 54 void ModifyGDataFileResourceUrl(Profile* profile,
38 const FilePath& gdata_cache_path, 55 const FilePath& gdata_cache_path,
39 GURL* url); 56 GURL* url);
40 57
41 // Returns true if the given path is under the GData mount point. 58 // Returns true if the given path is under the GData mount point.
42 bool IsUnderGDataMountPoint(const FilePath& path); 59 bool IsUnderGDataMountPoint(const FilePath& path);
43 60
61 // Checks if the path is under (virtual) gdata search directory, and returns its
62 // search status.
63 GDataSearchPathType GetSearchPathStatus(const FilePath& path);
64
65 // Checks if the path is under (virtual) gdata earch directory, and returns its
66 // search status.
67 GDataSearchPathType GetSearchPathStatusForPathComponents(
68 const std::vector<std::string>& path_components);
69
70 // Gets resource id and original file name from the search file name.
71 // Search file name is formatted as: <resource_id>.<original_file_name>.
72 // If the path is not search path, the behaviour is not defined.
73 void ParseSearchFileName(const std::string& search_file_name,
satorux1 2012/05/04 01:48:40 shouldn't this return true/false that indicates su
74 std::string* resource_id,
75 std::string* original_file_name);
76
44 // Extracts the GData path from the given path located under the GData mount 77 // Extracts the GData path from the given path located under the GData mount
45 // point. Returns an empty path if |path| is not under the GData mount point. 78 // point. Returns an empty path if |path| is not under the GData mount point.
46 // Examples: ExtractGDatPath("/special/gdata/foo.txt") => "gdata/foo.txt" 79 // Examples: ExtractGDatPath("/special/gdata/foo.txt") => "gdata/foo.txt"
47 FilePath ExtractGDataPath(const FilePath& path); 80 FilePath ExtractGDataPath(const FilePath& path);
48 81
49 // Returns vector of all possible cache paths for a given path on gdata mount 82 // Returns vector of all possible cache paths for a given path on gdata mount
50 // point. 83 // point.
51 void InsertGDataCachePathsPermissions( 84 void InsertGDataCachePathsPermissions(
52 Profile* profile_, 85 Profile* profile_,
53 const FilePath& gdata_path, 86 const FilePath& gdata_path,
(...skipping 21 matching lines...) Expand all
75 // Example: path="/user/GCache/v1/persistent/pdf:a1b2.01234567.mounted" => 108 // Example: path="/user/GCache/v1/persistent/pdf:a1b2.01234567.mounted" =>
76 // resource_id="pdf:a1b2", md5="01234567", extra_extension="mounted". 109 // resource_id="pdf:a1b2", md5="01234567", extra_extension="mounted".
77 void ParseCacheFilePath(const FilePath& path, 110 void ParseCacheFilePath(const FilePath& path,
78 std::string* resource_id, 111 std::string* resource_id,
79 std::string* md5, 112 std::string* md5,
80 std::string* extra_extension); 113 std::string* extra_extension);
81 } // namespace util 114 } // namespace util
82 } // namespace gdata 115 } // namespace gdata
83 116
84 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_UTIL_H_ 117 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698