| 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 #include "chrome/browser/chromeos/gdata/gdata_uploader.h" | 5 #include "chrome/browser/chromeos/gdata/gdata_uploader.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // Google Documents List API requires uploading in chunks of 512kB. | 24 // Google Documents List API requires uploading in chunks of 512kB. |
| 25 const int64 kUploadChunkSize = 512 * 1024; | 25 const int64 kUploadChunkSize = 512 * 1024; |
| 26 | 26 |
| 27 // Maximum number of times we try to open a file before giving up. | 27 // Maximum number of times we try to open a file before giving up. |
| 28 const int kMaxFileOpenTries = 5; | 28 const int kMaxFileOpenTries = 5; |
| 29 | 29 |
| 30 } // namespace | 30 } // namespace |
| 31 | 31 |
| 32 namespace gdata { | 32 namespace gdata { |
| 33 | 33 |
| 34 GDataUploader::GDataUploader(GDataFileSystem* file_system, | 34 GDataUploader::GDataUploader(DocumentsServiceInterface* documents_service) |
| 35 DocumentsServiceInterface* documents_service) | 35 : file_system_(NULL), |
| 36 : file_system_(file_system), | |
| 37 documents_service_(documents_service), | 36 documents_service_(documents_service), |
| 38 next_upload_id_(0), | 37 next_upload_id_(0), |
| 39 ALLOW_THIS_IN_INITIALIZER_LIST(uploader_factory_(this)) { | 38 ALLOW_THIS_IN_INITIALIZER_LIST(uploader_factory_(this)) { |
| 40 } | 39 } |
| 41 | 40 |
| 42 GDataUploader::~GDataUploader() { | 41 GDataUploader::~GDataUploader() { |
| 43 } | 42 } |
| 44 | 43 |
| 45 int GDataUploader::UploadFile(scoped_ptr<UploadFileInfo> upload_file_info) { | 44 int GDataUploader::UploadFile(scoped_ptr<UploadFileInfo> upload_file_info) { |
| 46 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 45 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 if (!callback.is_null()) | 392 if (!callback.is_null()) |
| 394 callback.Run(error, upload_file_info.Pass()); | 393 callback.Run(error, upload_file_info.Pass()); |
| 395 } | 394 } |
| 396 | 395 |
| 397 void GDataUploader::RemoveUpload(int upload_id) { | 396 void GDataUploader::RemoveUpload(int upload_id) { |
| 398 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 397 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 399 pending_uploads_.erase(upload_id); | 398 pending_uploads_.erase(upload_id); |
| 400 } | 399 } |
| 401 | 400 |
| 402 } // namespace gdata | 401 } // namespace gdata |
| OLD | NEW |