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

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: fix renaming 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 enum GDataSearchPathType {
satorux1 2012/05/03 17:58:34 Please add some comment about what is a search pat
tbarzic 2012/05/03 23:56:17 Done.
21 // Not a search path.
22 GDATA_SEARCH_PATH_INVALID,
23 // gdata/.search.
24 GDATA_SEARCH_PATH_ROOT,
25 // Path that defines search query (gdata/.search/foo).
26 GDATA_SEARCH_PATH_QUERY,
27 // Path given to a search result (gdata/.search/foo/foo_found).
28 // The file name will be formatted: "resource_id.file_name".
29 GDATA_SEARCH_PATH_RESULT,
30 // If search result is directory, it may contain some children.
31 GDATA_SEARCH_PATH_RESULT_CHILD
32 };
33
20 const char kGDataViewFileHostnameUrl[] = "viewfile"; 34 const char kGDataViewFileHostnameUrl[] = "viewfile";
21 35
22 // Returns the GData mount point path, which looks like "/special/gdata". 36 // Returns the GData mount point path, which looks like "/special/gdata".
23 const FilePath& GetGDataMountPointPath(); 37 const FilePath& GetGDataMountPointPath();
24 38
25 // Returns the GData mount path as string. 39 // Returns the GData mount path as string.
26 const std::string& GetGDataMountPointPathAsString(); 40 const std::string& GetGDataMountPointPathAsString();
27 41
28 // Returns the 'local' root of remote file system as "/special". 42 // Returns the 'local' root of remote file system as "/special".
29 const FilePath& GetSpecialRemoteRootPath(); 43 const FilePath& GetSpecialRemoteRootPath();
30 44
31 // Returns the gdata file resource url formatted as 45 // Returns the gdata file resource url formatted as
32 // chrome://gdata/<resource_id>/<file_name>. 46 // chrome://gdata/<resource_id>/<file_name>.
33 GURL GetFileResourceUrl(const std::string& resource_id, 47 GURL GetFileResourceUrl(const std::string& resource_id,
34 const std::string& file_name); 48 const std::string& file_name);
35 49
36 // Given a profile and a gdata_cache_path, return the file resource url. 50 // Given a profile and a gdata_cache_path, return the file resource url.
37 void ModifyGDataFileResourceUrl(Profile* profile, 51 void ModifyGDataFileResourceUrl(Profile* profile,
38 const FilePath& gdata_cache_path, 52 const FilePath& gdata_cache_path,
39 GURL* url); 53 GURL* url);
40 54
41 // Returns true if the given path is under the GData mount point. 55 // Returns true if the given path is under the GData mount point.
42 bool IsUnderGDataMountPoint(const FilePath& path); 56 bool IsUnderGDataMountPoint(const FilePath& path);
43 57
58 // Checks if the path is under (virtual) gdata earch directory, and returns its
satorux1 2012/05/03 17:58:34 earch -> search
tbarzic 2012/05/03 23:56:17 Done.
59 // search status.
60 GDataSearchPathType GetSearchPathStatus(const FilePath& path);
61
62 // Checks if the path is under (virtual) gdata earch directory, and returns its
63 // search status.
64 GDataSearchPathType GetSearchPathStatusForPathComponents(
65 const std::vector<std::string>& path_components);
66
67 // Gets resource id and original file name from the search file name.
68 // Search file name is formatted as: <resource_id>.<original_file_name>.
69 // If the path is not search path, the behaviour is not defined.
70 void CrackSearchFileName(const std::string& search_file_name,
satorux1 2012/05/03 17:58:34 Crack -> Parse? Crack sounds rather uncivilized. :
tbarzic 2012/05/03 23:56:17 Well, am I from Balkans or not :) (Balkan people a
71 std::string* resource_id,
72 std::string* original_file_name);
73
44 // Extracts the GData path from the given path located under the GData mount 74 // 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. 75 // point. Returns an empty path if |path| is not under the GData mount point.
46 // Examples: ExtractGDatPath("/special/gdata/foo.txt") => "gdata/foo.txt" 76 // Examples: ExtractGDatPath("/special/gdata/foo.txt") => "gdata/foo.txt"
47 FilePath ExtractGDataPath(const FilePath& path); 77 FilePath ExtractGDataPath(const FilePath& path);
48 78
49 // Returns vector of all possible cache paths for a given path on gdata mount 79 // Returns vector of all possible cache paths for a given path on gdata mount
50 // point. 80 // point.
51 void InsertGDataCachePathsPermissions( 81 void InsertGDataCachePathsPermissions(
52 Profile* profile_, 82 Profile* profile_,
53 const FilePath& gdata_path, 83 const FilePath& gdata_path,
(...skipping 21 matching lines...) Expand all
75 // Example: path="/user/GCache/v1/persistent/pdf:a1b2.01234567.mounted" => 105 // Example: path="/user/GCache/v1/persistent/pdf:a1b2.01234567.mounted" =>
76 // resource_id="pdf:a1b2", md5="01234567", extra_extension="mounted". 106 // resource_id="pdf:a1b2", md5="01234567", extra_extension="mounted".
77 void ParseCacheFilePath(const FilePath& path, 107 void ParseCacheFilePath(const FilePath& path,
78 std::string* resource_id, 108 std::string* resource_id,
79 std::string* md5, 109 std::string* md5,
80 std::string* extra_extension); 110 std::string* extra_extension);
81 } // namespace util 111 } // namespace util
82 } // namespace gdata 112 } // namespace gdata
83 113
84 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_UTIL_H_ 114 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698