| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_DRIVE_FILE_SYSTEM_DOWNLOAD_OPERATION_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_DOWNLOAD_OPERATION_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_DOWNLOAD_OPERATION_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_DOWNLOAD_OPERATION_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "chrome/browser/chromeos/drive/file_errors.h" | 10 #include "chrome/browser/chromeos/drive/file_errors.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 // downloading. | 56 // downloading. |
| 57 // During the downloading |get_content_callback| will be called periodically | 57 // During the downloading |get_content_callback| will be called periodically |
| 58 // with the downloaded content. | 58 // with the downloaded content. |
| 59 // Upon completion or an error is found, |completion_callback| will be | 59 // Upon completion or an error is found, |completion_callback| will be |
| 60 // called. | 60 // called. |
| 61 // |initialized_callback| and |get_content_callback| can be null if not | 61 // |initialized_callback| and |get_content_callback| can be null if not |
| 62 // needed. | 62 // needed. |
| 63 // |completion_callback| must not be null. | 63 // |completion_callback| must not be null. |
| 64 void EnsureFileDownloaded( | 64 void EnsureFileDownloaded( |
| 65 const base::FilePath& file_path, | 65 const base::FilePath& file_path, |
| 66 DriveClientContext context, | 66 const ClientContext& context, |
| 67 const GetFileContentInitializedCallback& initialized_callback, | 67 const GetFileContentInitializedCallback& initialized_callback, |
| 68 const google_apis::GetContentCallback& get_content_callback, | 68 const google_apis::GetContentCallback& get_content_callback, |
| 69 const GetFileCallback& completion_callback); | 69 const GetFileCallback& completion_callback); |
| 70 | 70 |
| 71 private: | 71 private: |
| 72 // Thin wrapper of Callbacks for EnsureFileDownloaded. | 72 // Thin wrapper of Callbacks for EnsureFileDownloaded. |
| 73 class DownloadCallback; | 73 class DownloadCallback; |
| 74 | 74 |
| 75 // Parameters for JobScheduler::DownloadFile. | 75 // Parameters for JobScheduler::DownloadFile. |
| 76 struct DownloadParams; | 76 struct DownloadParams; |
| 77 | 77 |
| 78 // Part of EnsureFileDownloaded(). Called upon the completion of precondition | 78 // Part of EnsureFileDownloaded(). Called upon the completion of precondition |
| 79 // check. | 79 // check. |
| 80 void EnsureFileDownloadedAfterCheckPreCondition( | 80 void EnsureFileDownloadedAfterCheckPreCondition( |
| 81 const base::FilePath& file_path, | 81 const base::FilePath& file_path, |
| 82 DriveClientContext context, | 82 const ClientContext& context, |
| 83 const DownloadCallback& callback, | 83 const DownloadCallback& callback, |
| 84 scoped_ptr<ResourceEntry> entry, | 84 scoped_ptr<ResourceEntry> entry, |
| 85 base::FilePath* cache_file_path, | 85 base::FilePath* cache_file_path, |
| 86 FileError error); | 86 FileError error); |
| 87 | 87 |
| 88 // Part of EnsureFileDownloaded(). Called upon the completion of fetching | 88 // Part of EnsureFileDownloaded(). Called upon the completion of fetching |
| 89 // ResourceEntry from the server. | 89 // ResourceEntry from the server. |
| 90 void EnsureFileDownloadedAfterGetResourceEntry( | 90 void EnsureFileDownloadedAfterGetResourceEntry( |
| 91 DriveClientContext context, | 91 const ClientContext& context, |
| 92 const DownloadCallback& callback, | 92 const DownloadCallback& callback, |
| 93 google_apis::GDataErrorCode gdata_error, | 93 google_apis::GDataErrorCode gdata_error, |
| 94 scoped_ptr<google_apis::ResourceEntry> resource_entry); | 94 scoped_ptr<google_apis::ResourceEntry> resource_entry); |
| 95 | 95 |
| 96 // Part of EnsureFileDownloaded(). Called when it is ready to start | 96 // Part of EnsureFileDownloaded(). Called when it is ready to start |
| 97 // downloading the file. | 97 // downloading the file. |
| 98 void EnsureFileDownloadedAfterPrepareForDownloadFile( | 98 void EnsureFileDownloadedAfterPrepareForDownloadFile( |
| 99 DownloadParams* params, | 99 DownloadParams* params, |
| 100 const DownloadCallback& callback, | 100 const DownloadCallback& callback, |
| 101 FileError error); | 101 FileError error); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 129 // Note: This should remain the last member so it'll be destroyed and | 129 // Note: This should remain the last member so it'll be destroyed and |
| 130 // invalidate its weak pointers before any other members are destroyed. | 130 // invalidate its weak pointers before any other members are destroyed. |
| 131 base::WeakPtrFactory<DownloadOperation> weak_ptr_factory_; | 131 base::WeakPtrFactory<DownloadOperation> weak_ptr_factory_; |
| 132 DISALLOW_COPY_AND_ASSIGN(DownloadOperation); | 132 DISALLOW_COPY_AND_ASSIGN(DownloadOperation); |
| 133 }; | 133 }; |
| 134 | 134 |
| 135 } // namespace file_system | 135 } // namespace file_system |
| 136 } // namespace drive | 136 } // namespace drive |
| 137 | 137 |
| 138 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_DOWNLOAD_OPERATION_H_ | 138 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_DOWNLOAD_OPERATION_H_ |
| OLD | NEW |