| 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 COMPONENTS_DRIVE_DRIVE_API_UTIL_H_ | 5 #ifndef COMPONENTS_DRIVE_DRIVE_API_UTIL_H_ |
| 6 #define COMPONENTS_DRIVE_DRIVE_API_UTIL_H_ | 6 #define COMPONENTS_DRIVE_DRIVE_API_UTIL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/callback.h" |
| 11 #include "base/md5.h" | 12 #include "base/md5.h" |
| 13 #include "components/drive/file_errors.h" |
| 12 #include "google_apis/drive/drive_api_error_codes.h" | 14 #include "google_apis/drive/drive_api_error_codes.h" |
| 13 #include "google_apis/drive/drive_common_callbacks.h" | 15 #include "google_apis/drive/drive_common_callbacks.h" |
| 14 | 16 |
| 17 namespace tracked_objects { |
| 18 class Location; |
| 19 } // namespace tracked_objects |
| 20 |
| 15 namespace base { | 21 namespace base { |
| 16 class CancellationFlag; | 22 class CancellationFlag; |
| 17 class FilePath; | 23 class FilePath; |
| 24 class TaskRunner; |
| 18 } // namespace base | 25 } // namespace base |
| 19 | 26 |
| 20 namespace drive { | 27 namespace drive { |
| 21 namespace util { | 28 namespace util { |
| 22 | 29 |
| 23 // Google Apps MIME types: | 30 // Google Apps MIME types: |
| 24 const char kGoogleDocumentMimeType[] = "application/vnd.google-apps.document"; | 31 const char kGoogleDocumentMimeType[] = "application/vnd.google-apps.document"; |
| 25 const char kGoogleDrawingMimeType[] = "application/vnd.google-apps.drawing"; | 32 const char kGoogleDrawingMimeType[] = "application/vnd.google-apps.drawing"; |
| 26 const char kGooglePresentationMimeType[] = | 33 const char kGooglePresentationMimeType[] = |
| 27 "application/vnd.google-apps.presentation"; | 34 "application/vnd.google-apps.presentation"; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 std::string GetHostedDocumentExtension(const std::string& mime_type); | 69 std::string GetHostedDocumentExtension(const std::string& mime_type); |
| 63 | 70 |
| 64 // 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 |
| 65 // document types. | 72 // document types. |
| 66 bool IsKnownHostedDocumentMimeType(const std::string& mime_type); | 73 bool IsKnownHostedDocumentMimeType(const std::string& mime_type); |
| 67 | 74 |
| 68 // 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 |
| 69 // hosted document types. | 76 // hosted document types. |
| 70 bool HasHostedDocumentExtension(const base::FilePath& path); | 77 bool HasHostedDocumentExtension(const base::FilePath& path); |
| 71 | 78 |
| 79 // Runs |task| on |task_runner|, then runs |reply| on the original thread with |
| 80 // the resulting error code. |
| 81 void RunAsyncTask(base::TaskRunner* task_runner, |
| 82 const tracked_objects::Location& from_here, |
| 83 base::OnceCallback<FileError()> task, |
| 84 base::OnceCallback<void(FileError)> reply); |
| 85 |
| 72 } // namespace util | 86 } // namespace util |
| 73 } // namespace drive | 87 } // namespace drive |
| 74 | 88 |
| 75 #endif // COMPONENTS_DRIVE_DRIVE_API_UTIL_H_ | 89 #endif // COMPONENTS_DRIVE_DRIVE_API_UTIL_H_ |
| OLD | NEW |