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

Side by Side Diff: chrome/browser/chromeos/gdata/drive_uploader.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
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_UPLOADER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_UPLOADER_H_
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_UPLOADER_H_ 6 #define CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_UPLOADER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/platform_file.h" 14 #include "base/platform_file.h"
15 #include "chrome/browser/chromeos/gdata/drive_upload_file_info.h"
15 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h" 16 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h"
16 #include "chrome/browser/chromeos/gdata/gdata_operations.h" 17 #include "chrome/browser/chromeos/gdata/gdata_operations.h"
17 #include "chrome/browser/chromeos/gdata/gdata_upload_file_info.h"
18 #include "googleurl/src/gurl.h" 18 #include "googleurl/src/gurl.h"
19 19
20 namespace content { 20 namespace content {
21 class DownloadItem; 21 class DownloadItem;
22 } 22 }
23 23
24 namespace gdata { 24 namespace gdata {
25 25
26 class DriveServiceInterface; 26 class DriveServiceInterface;
27 27
28 class GDataUploaderInterface { 28 class DriveUploaderInterface {
29 public: 29 public:
30 virtual ~GDataUploaderInterface() {} 30 virtual ~DriveUploaderInterface() {}
31 31
32 // Uploads a new file specified by |upload_file_info|. Transfers ownership. 32 // Uploads a new file specified by |upload_file_info|. Transfers ownership.
33 // Returns the upload_id. 33 // Returns the upload_id.
34 // 34 //
35 // WARNING: This is not mockable by gmock because it takes scoped_ptr<>. 35 // WARNING: This is not mockable by gmock because it takes scoped_ptr<>.
36 // See "Announcing scoped_ptr<>::Pass(). The latest in pointer ownership 36 // See "Announcing scoped_ptr<>::Pass(). The latest in pointer ownership
37 // technology!" thread on chromium-dev. 37 // technology!" thread on chromium-dev.
38 virtual int UploadNewFile(scoped_ptr<UploadFileInfo> upload_file_info) = 0; 38 virtual int UploadNewFile(scoped_ptr<UploadFileInfo> upload_file_info) = 0;
39 39
40 // Stream data to an existing file from data specified by |upload_file_info|. 40 // Stream data to an existing file from data specified by |upload_file_info|.
(...skipping 15 matching lines...) Expand all
56 const UploadFileInfo::UploadCompletionCallback& callback) = 0; 56 const UploadFileInfo::UploadCompletionCallback& callback) = 0;
57 57
58 // Updates attributes of streaming upload. 58 // Updates attributes of streaming upload.
59 virtual void UpdateUpload(int upload_id, 59 virtual void UpdateUpload(int upload_id,
60 content::DownloadItem* download) = 0; 60 content::DownloadItem* download) = 0;
61 61
62 // Returns the count of bytes confirmed as uploaded so far. 62 // Returns the count of bytes confirmed as uploaded so far.
63 virtual int64 GetUploadedBytes(int upload_id) const = 0; 63 virtual int64 GetUploadedBytes(int upload_id) const = 0;
64 }; 64 };
65 65
66 class GDataUploader : public GDataUploaderInterface { 66 class DriveUploader : public DriveUploaderInterface {
67 public: 67 public:
68 explicit GDataUploader(DriveServiceInterface* drive_service); 68 explicit DriveUploader(DriveServiceInterface* drive_service);
69 virtual ~GDataUploader(); 69 virtual ~DriveUploader();
70 70
71 // GDataUploaderInterface overrides. 71 // DriveUploaderInterface overrides.
72 virtual int UploadNewFile( 72 virtual int UploadNewFile(
73 scoped_ptr<UploadFileInfo> upload_file_info) OVERRIDE; 73 scoped_ptr<UploadFileInfo> upload_file_info) OVERRIDE;
74 virtual int StreamExistingFile( 74 virtual int StreamExistingFile(
75 scoped_ptr<UploadFileInfo> upload_file_info) OVERRIDE; 75 scoped_ptr<UploadFileInfo> upload_file_info) OVERRIDE;
76 virtual int UploadExistingFile( 76 virtual int UploadExistingFile(
77 const GURL& upload_location, 77 const GURL& upload_location,
78 const FilePath& gdata_file_path, 78 const FilePath& gdata_file_path,
79 const FilePath& local_file_path, 79 const FilePath& local_file_path,
80 int64 file_size, 80 int64 file_size,
81 const std::string& content_type, 81 const std::string& content_type,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 // Note that this does not delete the UploadFileInfo object itself, 127 // Note that this does not delete the UploadFileInfo object itself,
128 // because it may still be in use by an asynchronous function. 128 // because it may still be in use by an asynchronous function.
129 void RemoveUpload(int upload_id); 129 void RemoveUpload(int upload_id);
130 130
131 // Starts uploading a file with |upload_file_info|. Returns a new upload 131 // Starts uploading a file with |upload_file_info|. Returns a new upload
132 // ID assigned to |upload_file_info|. 132 // ID assigned to |upload_file_info|.
133 int StartUploadFile(scoped_ptr<UploadFileInfo> upload_file_info); 133 int StartUploadFile(scoped_ptr<UploadFileInfo> upload_file_info);
134 134
135 // Pointers to DriveServiceInterface object owned by DriveSystemService. 135 // Pointers to DriveServiceInterface object owned by DriveSystemService.
136 // The lifetime of this object is guaranteed to exceed that of the 136 // The lifetime of this object is guaranteed to exceed that of the
137 // GDataUploader instance. 137 // DriveUploader instance.
138 DriveServiceInterface* drive_service_; 138 DriveServiceInterface* drive_service_;
139 139
140 int next_upload_id_; // id counter. 140 int next_upload_id_; // id counter.
141 141
142 typedef std::map<int, UploadFileInfo*> UploadFileInfoMap; 142 typedef std::map<int, UploadFileInfo*> UploadFileInfoMap;
143 UploadFileInfoMap pending_uploads_; 143 UploadFileInfoMap pending_uploads_;
144 144
145 // Note: This should remain the last member so it'll be destroyed and 145 // Note: This should remain the last member so it'll be destroyed and
146 // invalidate its weak pointers before any other members are destroyed. 146 // invalidate its weak pointers before any other members are destroyed.
147 base::WeakPtrFactory<GDataUploader> weak_ptr_factory_; 147 base::WeakPtrFactory<DriveUploader> weak_ptr_factory_;
148 148
149 DISALLOW_COPY_AND_ASSIGN(GDataUploader); 149 DISALLOW_COPY_AND_ASSIGN(DriveUploader);
150 }; 150 };
151 151
152 } // namespace gdata 152 } // namespace gdata
153 153
154 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_UPLOADER_H_ 154 #endif // CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_UPLOADER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/drive_upload_file_info.cc ('k') | chrome/browser/chromeos/gdata/drive_uploader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698