| 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_GOOGLE_APIS_DRIVE_API_UTIL_H_ | 5 #ifndef CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_UTIL_H_ |
| 6 #define CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_UTIL_H_ | 6 #define CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_UTIL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 namespace google_apis { | 10 namespace google_apis { |
| 11 namespace util { | 11 namespace util { |
| 12 | 12 |
| 13 // Returns true if Drive v2 API is enabled via commandline switch. | 13 // Returns true if Drive v2 API is enabled via commandline switch. |
| 14 bool IsDriveV2ApiEnabled(); | 14 bool IsDriveV2ApiEnabled(); |
| 15 | 15 |
| 16 } // namespace util | 16 } // namespace util |
| 17 | 17 |
| 18 namespace drive { | 18 namespace drive { |
| 19 namespace util { | 19 namespace util { |
| 20 | 20 |
| 21 // Escapes ' to \' in the |str|. This is designed to use for string value of | 21 // Escapes ' to \' in the |str|. This is designed to use for string value of |
| 22 // search parameter on Drive API v2. | 22 // search parameter on Drive API v2. |
| 23 // See also: https://developers.google.com/drive/search-parameters | 23 // See also: https://developers.google.com/drive/search-parameters |
| 24 std::string EscapeQueryStringValue(const std::string& str); | 24 std::string EscapeQueryStringValue(const std::string& str); |
| 25 | 25 |
| 26 // Parses the query, and builds a search query for Drive API v2. |
| 27 // This only supports: |
| 28 // Regular query (e.g. dog => fullText contains 'dog') |
| 29 // Conjunctions |
| 30 // (e.g. dog cat => fullText contains 'dog' and fullText contains 'cat') |
| 31 // Exclusion query (e.g. -cat => not fullText contains 'cat'). |
| 32 // Quoted query (e.g. "dog cat" => fullText contains 'dog cat'). |
| 33 // See also: https://developers.google.com/drive/search-parameters |
| 34 std::string TranslateQuery(const std::string& original_query); |
| 35 |
| 26 } // namespace util | 36 } // namespace util |
| 27 } // namespace drive | 37 } // namespace drive |
| 28 } // namespace google_apis | 38 } // namespace google_apis |
| 29 | 39 |
| 30 #endif // CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_UTIL_H_ | 40 #endif // CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_UTIL_H_ |
| OLD | NEW |