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

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

Issue 9844006: GData downloads cleanup (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: asanka review feedback Created 8 years, 9 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
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_UPLOAD_FILE_INFO_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_UPLOAD_FILE_INFO_H_
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_UPLOAD_FILE_INFO_H_ 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_UPLOAD_FILE_INFO_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/file_path.h" 14 #include "base/file_path.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h" 16 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h"
17 #include "googleurl/src/gurl.h" 17 #include "googleurl/src/gurl.h"
18 #include "net/base/file_stream.h" 18 #include "net/base/file_stream.h"
19 #include "net/base/io_buffer.h" 19 #include "net/base/io_buffer.h"
20 20
21 namespace content { 21 namespace content {
22 class DownloadItem; 22 class DownloadItem;
23 } 23 }
24 24
25 namespace gdata { 25 namespace gdata {
26 26
27 class DocumentEntry; 27 class DocumentEntry;
28 28
29 // Used for file operations like removing files.
30 typedef base::Callback<void(base::PlatformFileError error,
31 DocumentEntry* entry)>
32 UploadCompletionCallback;
33
34 // Structure containing current upload information of file, passed between 29 // Structure containing current upload information of file, passed between
35 // DocumentsService methods and callbacks. 30 // DocumentsService methods and callbacks.
36 struct UploadFileInfo { 31 struct UploadFileInfo {
37 UploadFileInfo(); 32 UploadFileInfo();
38 ~UploadFileInfo(); 33 ~UploadFileInfo();
39 34
40 // Bytes left to upload. 35 // Bytes left to upload.
41 int64 SizeRemaining() const; 36 int64 SizeRemaining() const;
42 37
43 // Useful for printf debugging. 38 // Useful for printf debugging.
(...skipping 21 matching lines...) Expand all
65 scoped_refptr<net::IOBuffer> buf; // Holds current content to be uploaded. 60 scoped_refptr<net::IOBuffer> buf; // Holds current content to be uploaded.
66 // Size of |buf|, max is 512KB; Google Docs requires size of each upload chunk 61 // Size of |buf|, max is 512KB; Google Docs requires size of each upload chunk
67 // to be a multiple of 512KB. 62 // to be a multiple of 512KB.
68 int64 buf_len; 63 int64 buf_len;
69 64
70 // Data to be updated by caller before sending each ResumeUpload request. 65 // Data to be updated by caller before sending each ResumeUpload request.
71 // Note that end_range is inclusive, so start_range=0, end_range=8 is 9 bytes. 66 // Note that end_range is inclusive, so start_range=0, end_range=8 is 9 bytes.
72 int64 start_range; // Start of range of contents currently stored in |buf|. 67 int64 start_range; // Start of range of contents currently stored in |buf|.
73 int64 end_range; // End of range of contents currently stored in |buf|. 68 int64 end_range; // End of range of contents currently stored in |buf|.
74 69
75 bool all_bytes_present; // Whether this file has finished downloading. 70 bool all_bytes_present; // Whether all bytes of this file are present.
76 bool upload_paused; // Whether this file's upload has been paused. 71 bool upload_paused; // Whether this file's upload has been paused.
77 72
78 bool should_retry_file_open; // Whether we should retry opening this file. 73 bool should_retry_file_open; // Whether we should retry opening this file.
79 int num_file_open_tries; // Number of times we've tried to open this file. 74 int num_file_open_tries; // Number of times we've tried to open this file.
80 75
81 // Will be set once the upload is complete. 76 // Will be set once the upload is complete.
82 scoped_ptr<DocumentEntry> entry; 77 scoped_ptr<DocumentEntry> entry;
83 78
84 // Callback to be invoked once the upload has completed. 79 // Callback to be invoked once the upload has completed.
80 typedef base::Callback<void(base::PlatformFileError error,
81 UploadFileInfo* upload_file_info)> UploadCompletionCallback;
85 UploadCompletionCallback completion_callback; 82 UploadCompletionCallback completion_callback;
86 }; 83 };
87 84
88 } // namespace gdata 85 } // namespace gdata
89 86
90 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_UPLOAD_FILE_INFO_H_ 87 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_UPLOAD_FILE_INFO_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_system_service.cc ('k') | chrome/browser/chromeos/gdata/gdata_uploader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698