OLD | NEW |
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_DRIVE_DRIVE_API_UTIL_H_ | 5 #ifndef CHROME_BROWSER_DRIVE_DRIVE_API_UTIL_H_ |
6 #define CHROME_BROWSER_DRIVE_DRIVE_API_UTIL_H_ | 6 #define CHROME_BROWSER_DRIVE_DRIVE_API_UTIL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 // (e.g. dog cat => fullText contains 'dog' and fullText contains 'cat') | 53 // (e.g. dog cat => fullText contains 'dog' and fullText contains 'cat') |
54 // Exclusion query (e.g. -cat => not fullText contains 'cat'). | 54 // Exclusion query (e.g. -cat => not fullText contains 'cat'). |
55 // Quoted query (e.g. "dog cat" => fullText contains 'dog cat'). | 55 // Quoted query (e.g. "dog cat" => fullText contains 'dog cat'). |
56 // See also: https://developers.google.com/drive/search-parameters | 56 // See also: https://developers.google.com/drive/search-parameters |
57 std::string TranslateQuery(const std::string& original_query); | 57 std::string TranslateQuery(const std::string& original_query); |
58 | 58 |
59 // If |resource_id| is in the old resource ID format used by WAPI, converts it | 59 // If |resource_id| is in the old resource ID format used by WAPI, converts it |
60 // into the new format. | 60 // into the new format. |
61 std::string CanonicalizeResourceId(const std::string& resource_id); | 61 std::string CanonicalizeResourceId(const std::string& resource_id); |
62 | 62 |
63 // Converts FileResource to ResourceEntry. | |
64 scoped_ptr<google_apis::ResourceEntry> | |
65 ConvertFileResourceToResourceEntry( | |
66 const google_apis::FileResource& file_resource); | |
67 | |
68 // Returns the (base-16 encoded) MD5 digest of the file content at |file_path|, | 63 // Returns the (base-16 encoded) MD5 digest of the file content at |file_path|, |
69 // or an empty string if an error is found. | 64 // or an empty string if an error is found. |
70 std::string GetMd5Digest(const base::FilePath& file_path); | 65 std::string GetMd5Digest(const base::FilePath& file_path); |
71 | 66 |
72 // Returns preferred file extension for hosted documents which have given mime | 67 // Returns preferred file extension for hosted documents which have given mime |
73 // type. | 68 // type. |
74 std::string GetHostedDocumentExtension(const std::string& mime_type); | 69 std::string GetHostedDocumentExtension(const std::string& mime_type); |
75 | 70 |
76 // Returns true if the given mime type is corresponding to one of known hosted | 71 // Returns true if the given mime type is corresponding to one of known hosted |
77 // document types. | 72 // document types. |
78 bool IsKnownHostedDocumentMimeType(const std::string& mime_type); | 73 bool IsKnownHostedDocumentMimeType(const std::string& mime_type); |
79 | 74 |
80 // Returns true if the given file path has an extension corresponding to one of | 75 // Returns true if the given file path has an extension corresponding to one of |
81 // hosted document types. | 76 // hosted document types. |
82 bool HasHostedDocumentExtension(const base::FilePath& path); | 77 bool HasHostedDocumentExtension(const base::FilePath& path); |
83 | 78 |
84 } // namespace util | 79 } // namespace util |
85 } // namespace drive | 80 } // namespace drive |
86 | 81 |
87 #endif // CHROME_BROWSER_DRIVE_DRIVE_API_UTIL_H_ | 82 #endif // CHROME_BROWSER_DRIVE_DRIVE_API_UTIL_H_ |
OLD | NEW |