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

Side by Side Diff: chrome/browser/chromeos/drive/drive_uploader.cc

Issue 11143014: Add request header on gdata operation for testing ETag match. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: +comment Created 8 years, 2 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 #include "chrome/browser/chromeos/drive/drive_uploader.h" 5 #include "chrome/browser/chromeos/drive/drive_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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 if (upload_file_info->initial_upload_location.is_empty()) { 297 if (upload_file_info->initial_upload_location.is_empty()) {
298 UploadFailed(upload_file_info, DRIVE_FILE_ERROR_ABORT); 298 UploadFailed(upload_file_info, DRIVE_FILE_ERROR_ABORT);
299 return; 299 return;
300 } 300 }
301 drive_service_->InitiateUpload( 301 drive_service_->InitiateUpload(
302 gdata::InitiateUploadParams(upload_file_info->upload_mode, 302 gdata::InitiateUploadParams(upload_file_info->upload_mode,
303 upload_file_info->title, 303 upload_file_info->title,
304 upload_file_info->content_type, 304 upload_file_info->content_type,
305 upload_file_info->content_length, 305 upload_file_info->content_length,
306 upload_file_info->initial_upload_location, 306 upload_file_info->initial_upload_location,
307 upload_file_info->drive_path), 307 upload_file_info->drive_path,
308 upload_file_info->etag),
308 base::Bind(&DriveUploader::OnUploadLocationReceived, 309 base::Bind(&DriveUploader::OnUploadLocationReceived,
309 weak_ptr_factory_.GetWeakPtr(), 310 weak_ptr_factory_.GetWeakPtr(),
310 upload_file_info->upload_id)); 311 upload_file_info->upload_id));
311 } 312 }
312 // The uploader gets ready after we complete opening the file, called 313 // The uploader gets ready after we complete opening the file, called
313 // from the StartUploadFile method. We use PostTask on purpose, because 314 // from the StartUploadFile method. We use PostTask on purpose, because
314 // this callback is called by FileStream, and we may access FileStream 315 // this callback is called by FileStream, and we may access FileStream
315 // again from the |ready_callback| implementation. FileStream is not 316 // again from the |ready_callback| implementation. FileStream is not
316 // reentrant. 317 // reentrant.
317 // 318 //
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 return; 442 return;
442 443
443 drive_service_->ResumeUpload( 444 drive_service_->ResumeUpload(
444 gdata::ResumeUploadParams(upload_file_info->upload_mode, 445 gdata::ResumeUploadParams(upload_file_info->upload_mode,
445 upload_file_info->start_range, 446 upload_file_info->start_range,
446 upload_file_info->end_range, 447 upload_file_info->end_range,
447 upload_file_info->content_length, 448 upload_file_info->content_length,
448 upload_file_info->content_type, 449 upload_file_info->content_type,
449 upload_file_info->buf, 450 upload_file_info->buf,
450 upload_file_info->upload_location, 451 upload_file_info->upload_location,
451 upload_file_info->drive_path), 452 upload_file_info->drive_path,
453 upload_file_info->etag),
452 base::Bind(&DriveUploader::OnResumeUploadResponseReceived, 454 base::Bind(&DriveUploader::OnResumeUploadResponseReceived,
453 weak_ptr_factory_.GetWeakPtr(), 455 weak_ptr_factory_.GetWeakPtr(),
454 upload_file_info->upload_id)); 456 upload_file_info->upload_id));
455 } 457 }
456 458
457 void DriveUploader::OnResumeUploadResponseReceived( 459 void DriveUploader::OnResumeUploadResponseReceived(
458 int upload_id, 460 int upload_id,
459 const gdata::ResumeUploadResponse& response, 461 const gdata::ResumeUploadResponse& response,
460 scoped_ptr<gdata::DocumentEntry> entry) { 462 scoped_ptr<gdata::DocumentEntry> entry) {
461 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 463 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 return "title=[" + title + 566 return "title=[" + title +
565 "], file_path=[" + file_path.AsUTF8Unsafe() + 567 "], file_path=[" + file_path.AsUTF8Unsafe() +
566 "], content_type=[" + content_type + 568 "], content_type=[" + content_type +
567 "], content_length=[" + base::UintToString(content_length) + 569 "], content_length=[" + base::UintToString(content_length) +
568 "], file_size=[" + base::UintToString(file_size) + 570 "], file_size=[" + base::UintToString(file_size) +
569 "], drive_path=[" + drive_path.AsUTF8Unsafe() + 571 "], drive_path=[" + drive_path.AsUTF8Unsafe() +
570 "]"; 572 "]";
571 } 573 }
572 574
573 } // namespace drive 575 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698