| 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" |
| 11 #include "google_apis/drive/drive_common_callbacks.h" | 11 #include "google_apis/drive/drive_common_callbacks.h" |
| 12 #include "google_apis/drive/gdata_errorcode.h" | 12 #include "google_apis/drive/gdata_errorcode.h" |
| 13 | 13 |
| 14 class GURL; | 14 class GURL; |
| 15 | 15 |
| 16 namespace base { | 16 namespace base { |
| 17 class FilePath; | 17 class FilePath; |
| 18 class Value; | 18 class Value; |
| 19 } // namespace base | 19 } // namespace base |
| 20 | 20 |
| 21 namespace google_apis { | 21 namespace google_apis { |
| 22 class AppList; | |
| 23 class AppResource; | |
| 24 class ChangeList; | 22 class ChangeList; |
| 25 class ChangeResource; | 23 class ChangeResource; |
| 26 class DriveAppIcon; | |
| 27 class FileList; | 24 class FileList; |
| 28 class FileResource; | 25 class FileResource; |
| 29 class ResourceEntry; | 26 class ResourceEntry; |
| 30 class ResourceList; | 27 class ResourceList; |
| 31 } // namespace google_apis | 28 } // namespace google_apis |
| 32 | 29 |
| 33 namespace drive { | 30 namespace drive { |
| 34 namespace util { | 31 namespace util { |
| 35 | 32 |
| 36 // Google Apps MIME types: | 33 // Google Apps MIME types: |
| (...skipping 22 matching lines...) Expand all Loading... |
| 59 // See also: https://developers.google.com/drive/search-parameters | 56 // See also: https://developers.google.com/drive/search-parameters |
| 60 std::string TranslateQuery(const std::string& original_query); | 57 std::string TranslateQuery(const std::string& original_query); |
| 61 | 58 |
| 62 // Extracts resource_id out of edit url. | 59 // Extracts resource_id out of edit url. |
| 63 std::string ExtractResourceIdFromUrl(const GURL& url); | 60 std::string ExtractResourceIdFromUrl(const GURL& url); |
| 64 | 61 |
| 65 // If |resource_id| is in the old resource ID format used by WAPI, converts it | 62 // If |resource_id| is in the old resource ID format used by WAPI, converts it |
| 66 // into the new format. | 63 // into the new format. |
| 67 std::string CanonicalizeResourceId(const std::string& resource_id); | 64 std::string CanonicalizeResourceId(const std::string& resource_id); |
| 68 | 65 |
| 69 // Note: Following constants and a function are used to support GetShareUrl on | |
| 70 // Drive API v2. Unfortunately, there is no support on Drive API v2, so we need | |
| 71 // to fall back to GData WAPI for the GetShareUrl. Thus, these are shared by | |
| 72 // both GDataWapiService and DriveAPIService. | |
| 73 // TODO(hidehiko): Remove these from here, when Drive API v2 supports | |
| 74 // GetShareUrl. | |
| 75 | |
| 76 // OAuth2 scopes for the GData WAPI. | |
| 77 extern const char kDocsListScope[]; | |
| 78 extern const char kDriveAppsScope[]; | |
| 79 | |
| 80 // Converts FileResource to ResourceEntry. | 66 // Converts FileResource to ResourceEntry. |
| 81 scoped_ptr<google_apis::ResourceEntry> | 67 scoped_ptr<google_apis::ResourceEntry> |
| 82 ConvertFileResourceToResourceEntry( | 68 ConvertFileResourceToResourceEntry( |
| 83 const google_apis::FileResource& file_resource); | 69 const google_apis::FileResource& file_resource); |
| 84 | 70 |
| 85 // Converts ChangeResource to ResourceEntry. | 71 // Converts ChangeResource to ResourceEntry. |
| 86 scoped_ptr<google_apis::ResourceEntry> | 72 scoped_ptr<google_apis::ResourceEntry> |
| 87 ConvertChangeResourceToResourceEntry( | 73 ConvertChangeResourceToResourceEntry( |
| 88 const google_apis::ChangeResource& change_resource); | 74 const google_apis::ChangeResource& change_resource); |
| 89 | 75 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 108 bool IsKnownHostedDocumentMimeType(const std::string& mime_type); | 94 bool IsKnownHostedDocumentMimeType(const std::string& mime_type); |
| 109 | 95 |
| 110 // Returns true if the given file path has an extension corresponding to one of | 96 // Returns true if the given file path has an extension corresponding to one of |
| 111 // hosted document types. | 97 // hosted document types. |
| 112 bool HasHostedDocumentExtension(const base::FilePath& path); | 98 bool HasHostedDocumentExtension(const base::FilePath& path); |
| 113 | 99 |
| 114 } // namespace util | 100 } // namespace util |
| 115 } // namespace drive | 101 } // namespace drive |
| 116 | 102 |
| 117 #endif // CHROME_BROWSER_DRIVE_DRIVE_API_UTIL_H_ | 103 #endif // CHROME_BROWSER_DRIVE_DRIVE_API_UTIL_H_ |
| OLD | NEW |