Chromium Code Reviews| 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_CHROMEOS_GDATA_GDATA_PARAMS_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_PARAMS_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_PARAMS_H_ | 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_PARAMS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/platform_file.h" | 15 #include "base/platform_file.h" |
| 16 #include "base/values.h" | 16 #include "base/values.h" |
| 17 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h" | 17 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h" |
| 18 #include "chrome/browser/chromeos/gdata/gdata_upload_file_info.h" | 18 #include "chrome/browser/chromeos/gdata/gdata_upload_file_info.h" |
| 19 #include "googleurl/src/gurl.h" | 19 #include "googleurl/src/gurl.h" |
| 20 #include "net/base/io_buffer.h" | 20 #include "net/base/io_buffer.h" |
| 21 | 21 |
| 22 namespace gdata { | 22 namespace gdata { |
| 23 | 23 |
| 24 class GDataEntry; | 24 class GDataEntry; |
| 25 struct ResumeUploadResponse; | |
| 26 | |
| 27 // Different callback types for various functionalities in DocumentsService. | |
| 28 | |
| 29 // Callback type for authentication related DocumentService calls. | |
| 30 typedef base::Callback<void(GDataErrorCode error, | |
| 31 const std::string& token)> AuthStatusCallback; | |
| 32 | |
| 33 // Callback type for DocumentServiceInterface::GetDocuments. | |
| 34 // Note: feed_data argument should be passed using base::Passed(&feed_data), not | |
| 35 // feed_data.Pass(). | |
| 36 typedef base::Callback<void(GDataErrorCode error, | |
| 37 scoped_ptr<base::Value> feed_data)> GetDataCallback; | |
| 38 | |
| 39 // Callback type for Delete/Move DocumentServiceInterface calls. | |
| 40 typedef base::Callback<void(GDataErrorCode error, | |
| 41 const GURL& document_url)> EntryActionCallback; | |
| 42 | |
| 43 // Callback type for DownloadDocument/DownloadFile DocumentServiceInterface | |
| 44 // calls. | |
| 45 typedef base::Callback<void(GDataErrorCode error, | |
| 46 const GURL& content_url, | |
| 47 const FilePath& temp_file)> DownloadActionCallback; | |
| 48 | |
| 49 // Callback type for getting download data from DownloadFile | |
| 50 // DocumentServiceInterface calls. | |
| 51 typedef base::Callback<void( | |
| 52 GDataErrorCode error, | |
| 53 scoped_ptr<std::string> download_data)> GetDownloadDataCallback; | |
| 54 | |
| 55 // Callback type for DocumentServiceInterface::InitiateUpload. | |
| 56 typedef base::Callback<void(GDataErrorCode error, | |
| 57 const GURL& upload_url)> InitiateUploadCallback; | |
| 58 | |
| 59 // Callback type for DocumentServiceInterface::ResumeUpload. | |
| 60 typedef base::Callback<void( | |
| 61 const ResumeUploadResponse& response, | |
| 62 scoped_ptr<gdata::DocumentEntry> new_entry)> ResumeUploadCallback; | |
| 63 | |
| 64 // Callback type used to get result of file search. | |
| 65 // If |error| is not PLATFORM_FILE_OK, |entry| is set to NULL. | |
| 66 typedef base::Callback<void(GDataFileError error, GDataEntry* entry)> | |
| 67 FindEntryCallback; | |
| 68 | |
| 25 | 69 |
| 26 // Struct for response to ResumeUpload. | 70 // Struct for response to ResumeUpload. |
| 27 struct ResumeUploadResponse { | 71 struct ResumeUploadResponse { |
| 28 ResumeUploadResponse(GDataErrorCode code, | 72 ResumeUploadResponse(GDataErrorCode code, |
| 29 int64 start_range_received, | 73 int64 start_range_received, |
| 30 int64 end_range_received); | 74 int64 end_range_received); |
| 31 ~ResumeUploadResponse(); | 75 ~ResumeUploadResponse(); |
| 32 | 76 |
| 33 GDataErrorCode code; | 77 GDataErrorCode code; |
| 34 int64 start_range_received; | 78 int64 start_range_received; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 ~InitiateUploadParams(); | 125 ~InitiateUploadParams(); |
| 82 | 126 |
| 83 UploadMode upload_mode; | 127 UploadMode upload_mode; |
| 84 std::string title; | 128 std::string title; |
| 85 std::string content_type; | 129 std::string content_type; |
| 86 int64 content_length; | 130 int64 content_length; |
| 87 GURL upload_location; | 131 GURL upload_location; |
| 88 const FilePath& virtual_path; | 132 const FilePath& virtual_path; |
| 89 }; | 133 }; |
| 90 | 134 |
| 91 // Different callback types for various functionalities in DocumentsService. | 135 // Defines set of parameters sent to callback OnProtoLoaded(). |
| 136 struct LoadRootFeedParams { | |
| 137 LoadRootFeedParams( | |
| 138 FilePath search_file_path, | |
| 139 bool should_load_from_server, | |
| 140 const FindEntryCallback& callback); | |
| 141 ~LoadRootFeedParams(); | |
| 92 | 142 |
| 93 // Callback type for authentication related DocumentService calls. | 143 FilePath search_file_path; |
| 94 typedef base::Callback<void(GDataErrorCode error, | 144 bool should_load_from_server; |
| 95 const std::string& token)> AuthStatusCallback; | 145 std::string proto; |
| 96 | 146 GDataFileError load_error; |
| 97 // Callback type for DocumentServiceInterface::GetDocuments. | 147 base::Time last_modified; |
| 98 // Note: feed_data argument should be passed using base::Passed(&feed_data), not | 148 // Time when filesystem began to be loaded from disk. |
| 99 // feed_data.Pass(). | 149 base::Time load_start_time_; |
|
hashimoto
2012/08/03 05:17:07
load_start_time
achuithb
2012/08/03 21:41:04
Done.
| |
| 100 typedef base::Callback<void(GDataErrorCode error, | 150 const FindEntryCallback callback; |
| 101 scoped_ptr<base::Value> feed_data)> GetDataCallback; | 151 }; |
| 102 | |
| 103 // Callback type for Delete/Move DocumentServiceInterface calls. | |
| 104 typedef base::Callback<void(GDataErrorCode error, | |
| 105 const GURL& document_url)> EntryActionCallback; | |
| 106 | |
| 107 // Callback type for DownloadDocument/DownloadFile DocumentServiceInterface | |
| 108 // calls. | |
| 109 typedef base::Callback<void(GDataErrorCode error, | |
| 110 const GURL& content_url, | |
| 111 const FilePath& temp_file)> DownloadActionCallback; | |
| 112 | |
| 113 // Callback type for getting download data from DownloadFile | |
| 114 // DocumentServiceInterface calls. | |
| 115 typedef base::Callback<void( | |
| 116 GDataErrorCode error, | |
| 117 scoped_ptr<std::string> download_data)> GetDownloadDataCallback; | |
| 118 | |
| 119 // Callback type for DocumentServiceInterface::InitiateUpload. | |
| 120 typedef base::Callback<void(GDataErrorCode error, | |
| 121 const GURL& upload_url)> InitiateUploadCallback; | |
| 122 | |
| 123 // Callback type for DocumentServiceInterface::ResumeUpload. | |
| 124 typedef base::Callback<void( | |
| 125 const ResumeUploadResponse& response, | |
| 126 scoped_ptr<gdata::DocumentEntry> new_entry)> ResumeUploadCallback; | |
| 127 | |
| 128 // Callback type used to get result of file search. | |
| 129 // If |error| is not PLATFORM_FILE_OK, |entry| is set to NULL. | |
| 130 typedef base::Callback<void(GDataFileError error, GDataEntry* entry)> | |
| 131 FindEntryCallback; | |
| 132 | 152 |
| 133 } // namespace gdata | 153 } // namespace gdata |
| 134 | 154 |
| 135 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_PARAMS_H_ | 155 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_PARAMS_H_ |
| OLD | NEW |