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_OPERATIONS_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_OPERATIONS_H_ |
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_OPERATIONS_H_ | 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_OPERATIONS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "chrome/browser/chromeos/gdata/operations_base.h" | 11 #include "chrome/browser/chromeos/gdata/operations_base.h" |
12 #include "chrome/browser/chromeos/gdata/gdata_upload_file_info.h" | |
12 | 13 |
13 namespace gdata { | 14 namespace gdata { |
14 | 15 |
16 class GDataEntry; | |
17 class DocumentEntry; | |
18 struct ResumeUploadResponse; | |
19 | |
20 //============================ Callbacks =========================== | |
21 | |
22 // Different callback types for various functionalities in oparations. | |
23 | |
24 // Callback type for DownloadDocument/DownloadFile DocumentServiceInterface | |
25 // calls. | |
26 typedef base::Callback<void(GDataErrorCode error, | |
27 const GURL& content_url, | |
28 const FilePath& temp_file)> DownloadActionCallback; | |
satorux1
2012/08/09 20:53:48
Please see my comments in operations_base.h
yoshiki
2012/08/09 22:00:46
Done.
| |
29 | |
30 // Callback type for getting download data from DownloadFile | |
31 // DocumentServiceInterface calls. | |
32 typedef base::Callback<void( | |
33 GDataErrorCode error, | |
34 scoped_ptr<std::string> download_data)> GetDownloadDataCallback; | |
35 | |
36 // Callback type for DocumentServiceInterface::InitiateUpload. | |
37 typedef base::Callback<void(GDataErrorCode error, | |
38 const GURL& upload_url)> InitiateUploadCallback; | |
39 | |
40 // Callback type for DocumentServiceInterface::ResumeUpload. | |
41 typedef base::Callback<void( | |
42 const ResumeUploadResponse& response, | |
43 scoped_ptr<gdata::DocumentEntry> new_entry)> ResumeUploadCallback; | |
44 | |
45 //============================ Structs =========================== | |
46 | |
47 // Struct for response to ResumeUpload. | |
48 struct ResumeUploadResponse { | |
49 ResumeUploadResponse(GDataErrorCode code, | |
50 int64 start_range_received, | |
51 int64 end_range_received); | |
52 ~ResumeUploadResponse(); | |
53 | |
54 GDataErrorCode code; | |
55 int64 start_range_received; | |
56 int64 end_range_received; | |
57 FilePath virtual_path; | |
58 }; | |
59 | |
60 // Struct for passing params needed for DocumentsService::ResumeUpload() calls. | |
61 struct ResumeUploadParams { | |
62 ResumeUploadParams(UploadMode upload_mode, | |
63 int64 start_range, | |
64 int64 end_range, | |
65 int64 content_length, | |
66 const std::string& content_type, | |
67 scoped_refptr<net::IOBuffer> buf, | |
68 const GURL& upload_location, | |
69 const FilePath& virtual_path); | |
70 ~ResumeUploadParams(); | |
71 | |
72 UploadMode upload_mode; // Mode of the upload. | |
73 int64 start_range; // Start of range of contents currently stored in |buf|. | |
74 int64 end_range; // End of range of contents currently stored in |buf|. | |
75 int64 content_length; // File content-Length. | |
76 std::string content_type; // Content-Type of file. | |
77 scoped_refptr<net::IOBuffer> buf; // Holds current content to be uploaded. | |
78 GURL upload_location; // Url of where to upload the file to. | |
79 // Virtual GData path of the file seen in the UI. Not necessary for | |
80 // resuming an upload, but used for adding an entry to | |
81 // GDataOperationRegistry. | |
82 FilePath virtual_path; | |
83 }; | |
84 | |
85 // Struct for passing params needed for DocumentsService::InitiateUpload() | |
86 // calls. | |
87 // | |
88 // When uploading a new file (UPLOAD_NEW_FILE): | |
89 // - |title| should be set. | |
90 // - |upload_location| should be the upload_url() of the parent directory. | |
91 // | |
92 // When updating an existing file (UPLOAD_EXISTING_FILE): | |
93 // - |title| should be empty | |
94 // - |upload_location| should be the upload_url() of the existing file. | |
95 struct InitiateUploadParams { | |
96 InitiateUploadParams(UploadMode upload_mode, | |
97 const std::string& title, | |
98 const std::string& content_type, | |
99 int64 content_length, | |
100 const GURL& upload_location, | |
101 const FilePath& virtual_path); | |
102 ~InitiateUploadParams(); | |
103 | |
104 UploadMode upload_mode; | |
105 std::string title; | |
106 std::string content_type; | |
107 int64 content_length; | |
108 GURL upload_location; | |
109 const FilePath& virtual_path; | |
110 }; | |
111 | |
15 //============================ GetDocumentsOperation =========================== | 112 //============================ GetDocumentsOperation =========================== |
16 | 113 |
17 // This class performs the operation for fetching a document list. | 114 // This class performs the operation for fetching a document list. |
18 class GetDocumentsOperation : public GetDataOperation { | 115 class GetDocumentsOperation : public GetDataOperation { |
19 public: | 116 public: |
20 // |start_changestamp| specifies the starting point of change list or 0 if | 117 // |start_changestamp| specifies the starting point of change list or 0 if |
21 // all changes are necessary. | 118 // all changes are necessary. |
22 // |url| specifies URL for documents feed fetching operation. If empty URL is | 119 // |url| specifies URL for documents feed fetching operation. If empty URL is |
23 // passed, the default URL is used and returns the first page of the result. | 120 // passed, the default URL is used and returns the first page of the result. |
24 // When non-first page result is requested, |url| should be specified. | 121 // When non-first page result is requested, |url| should be specified. |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
454 | 551 |
455 // Callback to which the photo data is passed. | 552 // Callback to which the photo data is passed. |
456 GetDownloadDataCallback callback_; | 553 GetDownloadDataCallback callback_; |
457 | 554 |
458 DISALLOW_COPY_AND_ASSIGN(GetContactPhotoOperation); | 555 DISALLOW_COPY_AND_ASSIGN(GetContactPhotoOperation); |
459 }; | 556 }; |
460 | 557 |
461 } // namespace gdata | 558 } // namespace gdata |
462 | 559 |
463 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_OPERATIONS_H_ | 560 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_OPERATIONS_H_ |
OLD | NEW |