Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_upload_file_info.h

Issue 10919093: Rename GDataUplaoder to DriveUploader (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix after rebase Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_UPLOAD_FILE_INFO_H_
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_UPLOAD_FILE_INFO_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/basictypes.h"
12 #include "base/callback.h"
13 #include "base/file_path.h"
14 #include "base/memory/ref_counted.h"
15 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h"
16 #include "googleurl/src/gurl.h"
17 #include "net/base/file_stream.h"
18 #include "net/base/io_buffer.h"
19
20 namespace content {
21 class DownloadItem;
22 }
23
24 namespace gdata {
25
26 class DocumentEntry;
27
28 // The mode for uploading.
29 enum UploadMode {
30 UPLOAD_NEW_FILE,
31 UPLOAD_EXISTING_FILE,
32 UPLOAD_INVALID, // Used as an invalid value.
33 };
34
35 // Structure containing current upload information of file, passed between
36 // DriveServiceInterface methods and callbacks.
37 struct UploadFileInfo {
38 UploadFileInfo();
39 ~UploadFileInfo();
40
41 // Bytes left to upload.
42 int64 SizeRemaining() const;
43
44 // Useful for printf debugging.
45 std::string DebugString() const;
46
47 int upload_id; // id of this upload.
48 FilePath file_path; // The path of the file to be uploaded.
49 int64 file_size; // Last known size of the file.
50
51 // TODO(zelirag, achuith): Make this string16.
52 std::string title; // Title to be used for file to be uploaded.
53 std::string content_type; // Content-Type of file.
54 int64 content_length; // Header content-Length.
55
56 UploadMode upload_mode;
57
58 // Location URL used to get |upload_location| with InitiateUpload.
59 GURL initial_upload_location;
60
61 // Location URL where file is to be uploaded to, returned from
62 // InitiateUpload. Used for the subsequent ResumeUpload requests.
63 GURL upload_location;
64
65 // Final path in gdata. Looks like /special/drive/MyFolder/MyFile.
66 FilePath gdata_path;
67
68 // TODO(achuith): Use generic stream object after FileStream is refactored to
69 // extend a generic stream.
70 net::FileStream* file_stream; // For opening and reading from physical file.
71 scoped_refptr<net::IOBuffer> buf; // Holds current content to be uploaded.
72 // Size of |buf|, max is 512KB; Google Docs requires size of each upload chunk
73 // to be a multiple of 512KB.
74 int64 buf_len;
75
76 // Data to be updated by caller before sending each ResumeUpload request.
77 // Note that end_range is inclusive, so start_range=0, end_range=8 is 9 bytes.
78 int64 start_range; // Start of range of contents currently stored in |buf|.
79 int64 end_range; // End of range of contents currently stored in |buf|.
80
81 bool all_bytes_present; // Whether all bytes of this file are present.
82 bool upload_paused; // Whether this file's upload has been paused.
83
84 bool should_retry_file_open; // Whether we should retry opening this file.
85 int num_file_open_tries; // Number of times we've tried to open this file.
86
87 // Will be set once the upload is complete.
88 scoped_ptr<DocumentEntry> entry;
89
90 // Callback to be invoked once the upload has completed.
91 typedef base::Callback<void(DriveFileError error,
92 scoped_ptr<UploadFileInfo> upload_file_info)> UploadCompletionCallback;
93 UploadCompletionCallback completion_callback;
94 };
95
96 } // namespace gdata
97
98 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_UPLOAD_FILE_INFO_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_operations.h ('k') | chrome/browser/chromeos/gdata/gdata_upload_file_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698