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.h" | 5 #include "chrome/browser/chromeos/gdata/gdata.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 17 matching lines...) Expand all Loading... | |
28 #include "chrome/browser/signin/token_service.h" | 28 #include "chrome/browser/signin/token_service.h" |
29 #include "chrome/browser/signin/token_service_factory.h" | 29 #include "chrome/browser/signin/token_service_factory.h" |
30 #include "chrome/common/chrome_notification_types.h" | 30 #include "chrome/common/chrome_notification_types.h" |
31 #include "chrome/common/libxml_utils.h" | 31 #include "chrome/common/libxml_utils.h" |
32 #include "chrome/common/net/gaia/gaia_constants.h" | 32 #include "chrome/common/net/gaia/gaia_constants.h" |
33 #include "chrome/common/net/gaia/gaia_urls.h" | 33 #include "chrome/common/net/gaia/gaia_urls.h" |
34 #include "content/public/browser/browser_thread.h" | 34 #include "content/public/browser/browser_thread.h" |
35 #include "content/public/browser/notification_details.h" | 35 #include "content/public/browser/notification_details.h" |
36 #include "content/public/browser/notification_source.h" | 36 #include "content/public/browser/notification_source.h" |
37 #include "content/public/browser/notification_types.h" | 37 #include "content/public/browser/notification_types.h" |
38 #include "net/base/escape.h" | |
38 #include "net/base/file_stream.h" | 39 #include "net/base/file_stream.h" |
39 #include "net/base/load_flags.h" | 40 #include "net/base/load_flags.h" |
40 #include "net/http/http_response_headers.h" | 41 #include "net/http/http_response_headers.h" |
41 #include "net/http/http_util.h" | 42 #include "net/http/http_util.h" |
42 | 43 |
43 using content::BrowserThread; | 44 using content::BrowserThread; |
44 using content::URLFetcher; | 45 using content::URLFetcher; |
45 using content::URLFetcherDelegate; | 46 using content::URLFetcherDelegate; |
46 | 47 |
47 namespace gdata { | 48 namespace gdata { |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
327 callback_(callback), | 328 callback_(callback), |
328 // MessageLoopProxy is used to run |callback| on the origin thread. | 329 // MessageLoopProxy is used to run |callback| on the origin thread. |
329 relay_proxy_(base::MessageLoopProxy::current()), | 330 relay_proxy_(base::MessageLoopProxy::current()), |
330 re_authenticate_count_(0), | 331 re_authenticate_count_(0), |
331 save_temp_file_(false) { | 332 save_temp_file_(false) { |
332 } | 333 } |
333 | 334 |
334 // Overridden from GDataOperationInterface. | 335 // Overridden from GDataOperationInterface. |
335 virtual void Start(const std::string& auth_token) OVERRIDE { | 336 virtual void Start(const std::string& auth_token) OVERRIDE { |
336 DCHECK(!auth_token.empty()); | 337 DCHECK(!auth_token.empty()); |
338 | |
337 GURL url = GetURL(); | 339 GURL url = GetURL(); |
338 url_fetcher_.reset(URLFetcher::Create( | 340 DCHECK(!url.is_empty()); |
339 url, GetRequestType(), this)); | 341 DVLOG(1) << "URL: " << url.spec(); |
342 | |
343 url_fetcher_.reset(URLFetcher::Create(url, GetRequestType(), this)); | |
340 url_fetcher_->SetRequestContext(profile_->GetRequestContext()); | 344 url_fetcher_->SetRequestContext(profile_->GetRequestContext()); |
341 // Always set flags to neither send nor save cookies. | 345 // Always set flags to neither send nor save cookies. |
342 url_fetcher_->SetLoadFlags( | 346 url_fetcher_->SetLoadFlags( |
343 net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES); | 347 net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES); |
344 if (save_temp_file_) { | 348 if (save_temp_file_) { |
345 url_fetcher_->SaveResponseToTemporaryFile( | 349 url_fetcher_->SaveResponseToTemporaryFile( |
346 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); | 350 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); |
347 } | 351 } |
348 | 352 |
349 // Add request headers. | 353 // Add request headers. |
350 // Note that SetExtraRequestHeaders clears the current headers and sets it | 354 // Note that SetExtraRequestHeaders clears the current headers and sets it |
351 // to the passed-in headers, so calling it for each header will result in | 355 // to the passed-in headers, so calling it for each header will result in |
352 // only the last header being set in request headers. | 356 // only the last header being set in request headers. |
353 url_fetcher_->AddExtraRequestHeader(kGDataVersionHeader); | 357 url_fetcher_->AddExtraRequestHeader(kGDataVersionHeader); |
354 url_fetcher_->AddExtraRequestHeader( | 358 url_fetcher_->AddExtraRequestHeader( |
355 base::StringPrintf(kAuthorizationHeaderFormat, auth_token.data())); | 359 base::StringPrintf(kAuthorizationHeaderFormat, auth_token.data())); |
356 std::vector<std::string> headers = GetExtraRequestHeaders(); | 360 std::vector<std::string> headers = GetExtraRequestHeaders(); |
357 for (size_t i = 0; i < headers.size(); ++i) { | 361 for (size_t i = 0; i < headers.size(); ++i) { |
358 url_fetcher_->AddExtraRequestHeader(headers[i]); | 362 url_fetcher_->AddExtraRequestHeader(headers[i]); |
359 DVLOG(1) << "Extra header " << headers[i]; | 363 DVLOG(1) << "Extra header: " << headers[i]; |
360 } | 364 } |
361 | 365 |
362 // Set upload data if available. | 366 // Set upload data if available. |
363 std::string upload_content_type; | 367 std::string upload_content_type; |
364 std::string upload_content; | 368 std::string upload_content; |
365 if (GetContentData(&upload_content_type, &upload_content)) { | 369 if (GetContentData(&upload_content_type, &upload_content)) { |
366 url_fetcher_->SetUploadData(upload_content_type, upload_content); | 370 url_fetcher_->SetUploadData(upload_content_type, upload_content); |
367 } | 371 } |
368 | 372 |
369 // Register to operation registry. | 373 // Register to operation registry. |
370 NotifyStart(); | 374 NotifyStart(); |
371 | 375 |
372 url_fetcher_->Start(); | 376 url_fetcher_->Start(); |
373 } | 377 } |
374 | 378 |
375 // Overridden from GDataOperationInterface. | 379 // Overridden from GDataOperationInterface. |
376 virtual void SetReAuthenticateCallback( | 380 virtual void SetReAuthenticateCallback( |
377 const ReAuthenticateCallback& callback) OVERRIDE { | 381 const ReAuthenticateCallback& callback) OVERRIDE { |
378 DCHECK(re_authenticate_callback_.is_null()); | 382 DCHECK(re_authenticate_callback_.is_null()); |
379 | 383 |
380 re_authenticate_callback_ = callback; | 384 re_authenticate_callback_ = callback; |
381 } | 385 } |
382 | 386 |
383 protected: | 387 protected: |
384 virtual ~UrlFetchOperation() {} | 388 virtual ~UrlFetchOperation() {} |
385 // Gets URL for GET request. | 389 // Gets URL for GET request. |
satorux1
2012/03/12 17:48:24
Is this only for GET? Seems to be used for POST as
Ben Chan
2012/03/13 00:29:21
Fixed the comments. Also added comments for GetExt
| |
386 virtual GURL GetURL() const = 0; | 390 virtual GURL GetURL() const = 0; |
387 virtual URLFetcher::RequestType GetRequestType() const { | 391 virtual URLFetcher::RequestType GetRequestType() const { |
388 return URLFetcher::GET; | 392 return URLFetcher::GET; |
389 } | 393 } |
390 virtual std::vector<std::string> GetExtraRequestHeaders() const { | 394 virtual std::vector<std::string> GetExtraRequestHeaders() const { |
391 return std::vector<std::string>(); | 395 return std::vector<std::string>(); |
392 } | 396 } |
393 virtual bool GetContentData(std::string* upload_content_type, | 397 virtual bool GetContentData(std::string* upload_content_type, |
394 std::string* upload_content) { | 398 std::string* upload_content) { |
395 return false; | 399 return false; |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
777 xml_writer.WriteElement("title", directory_name_); | 781 xml_writer.WriteElement("title", directory_name_); |
778 | 782 |
779 xml_writer.EndElement(); // Ends "entry" element. | 783 xml_writer.EndElement(); // Ends "entry" element. |
780 xml_writer.StopWriting(); | 784 xml_writer.StopWriting(); |
781 upload_content->assign(xml_writer.GetWrittenString()); | 785 upload_content->assign(xml_writer.GetWrittenString()); |
782 DVLOG(1) << "CreateDirectory data: " << *upload_content_type << ", [" | 786 DVLOG(1) << "CreateDirectory data: " << *upload_content_type << ", [" |
783 << *upload_content << "]"; | 787 << *upload_content << "]"; |
784 return true; | 788 return true; |
785 } | 789 } |
786 | 790 |
791 //=========================== CopyDocumentOperation ============================ | |
792 | |
793 // Operation for making a copy of a document. | |
794 class CopyDocumentOperation : public GetDataOperation { | |
795 public: | |
796 CopyDocumentOperation(GDataOperationRegistry* registry, | |
797 Profile* profile, | |
798 const GetDataCallback& callback, | |
799 const GURL& document_url, | |
800 const FilePath::StringType& new_name); | |
satorux1
2012/03/12 17:48:24
just fyi: matter of taste, but for small classes l
Ben Chan
2012/03/13 00:29:21
I had a discussion with Zel that we would like to
| |
801 virtual ~CopyDocumentOperation() {} | |
802 | |
803 private: | |
804 // Overridden from GetDataOperation. | |
805 virtual URLFetcher::RequestType GetRequestType() const OVERRIDE; | |
806 | |
807 // Overridden from UrlFetchOperation. | |
808 virtual GURL GetURL() const OVERRIDE; | |
809 virtual bool GetContentData(std::string* upload_content_type, | |
810 std::string* upload_content) OVERRIDE; | |
811 | |
812 GURL document_url_; | |
813 FilePath::StringType new_name_; | |
814 | |
815 DISALLOW_COPY_AND_ASSIGN(CopyDocumentOperation); | |
816 }; | |
817 | |
818 CopyDocumentOperation::CopyDocumentOperation( | |
819 GDataOperationRegistry* registry, | |
820 Profile* profile, | |
821 const GetDataCallback& callback, | |
822 const GURL& document_url, | |
823 const FilePath::StringType& new_name) | |
824 : GetDataOperation(registry, profile, callback), | |
825 document_url_(document_url), | |
826 new_name_(new_name) { | |
827 } | |
828 | |
829 URLFetcher::RequestType CopyDocumentOperation::GetRequestType() const { | |
830 return URLFetcher::POST; | |
831 } | |
832 | |
833 GURL CopyDocumentOperation::GetURL() const { | |
834 return AddStandardUrlParams(GURL(kDocumentListRootURL)); | |
835 } | |
836 | |
837 bool CopyDocumentOperation::GetContentData(std::string* upload_content_type, | |
838 std::string* upload_content) { | |
839 upload_content_type->assign("application/atom+xml"); | |
840 XmlWriter xml_writer; | |
841 xml_writer.StartWriting(); | |
842 xml_writer.StartElement("entry"); | |
843 xml_writer.AddAttribute("xmlns", "http://www.w3.org/2005/Atom"); | |
844 | |
845 xml_writer.WriteElement("id", document_url_.spec()); | |
846 xml_writer.WriteElement("title", new_name_); | |
847 | |
848 xml_writer.EndElement(); // Ends "entry" element. | |
849 xml_writer.StopWriting(); | |
850 upload_content->assign(xml_writer.GetWrittenString()); | |
851 DVLOG(1) << "CopyDocumentOperation data: " << *upload_content_type << ", [" | |
852 << *upload_content << "]"; | |
853 return true; | |
854 } | |
855 | |
856 //=========================== RenameResourceOperation ========================== | |
857 | |
858 class RenameResourceOperation : public EntryActionOperation { | |
859 public: | |
860 RenameResourceOperation(GDataOperationRegistry* registry, | |
861 Profile* profile, | |
862 const EntryActionCallback& callback, | |
863 const GURL& document_url, | |
864 const FilePath::StringType& new_name); | |
865 virtual ~RenameResourceOperation() {} | |
866 | |
867 private: | |
868 // Overridden from EntryActionOperation. | |
869 virtual URLFetcher::RequestType GetRequestType() const OVERRIDE; | |
870 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE; | |
871 | |
872 // Overridden from UrlFetchOperation. | |
873 virtual bool GetContentData(std::string* upload_content_type, | |
874 std::string* upload_content) OVERRIDE; | |
875 | |
876 FilePath::StringType new_name_; | |
877 | |
878 DISALLOW_COPY_AND_ASSIGN(RenameResourceOperation); | |
879 }; | |
880 | |
881 RenameResourceOperation::RenameResourceOperation( | |
882 GDataOperationRegistry* registry, | |
883 Profile* profile, | |
884 const EntryActionCallback& callback, | |
885 const GURL& document_url, | |
886 const FilePath::StringType& new_name) | |
887 : EntryActionOperation(registry, profile, callback, document_url), | |
888 new_name_(new_name) { | |
889 } | |
890 | |
891 URLFetcher::RequestType RenameResourceOperation::GetRequestType() const { | |
892 return URLFetcher::PUT; | |
893 } | |
894 | |
895 std::vector<std::string> | |
896 RenameResourceOperation::GetExtraRequestHeaders() const { | |
897 std::vector<std::string> headers; | |
898 headers.push_back(kIfMatchAllHeader); | |
899 return headers; | |
900 } | |
901 | |
902 bool RenameResourceOperation::GetContentData(std::string* upload_content_type, | |
903 std::string* upload_content) { | |
904 upload_content_type->assign("application/atom+xml"); | |
905 XmlWriter xml_writer; | |
906 xml_writer.StartWriting(); | |
907 xml_writer.StartElement("entry"); | |
908 xml_writer.AddAttribute("xmlns", "http://www.w3.org/2005/Atom"); | |
909 | |
910 xml_writer.WriteElement("title", new_name_); | |
911 | |
912 xml_writer.EndElement(); // Ends "entry" element. | |
913 xml_writer.StopWriting(); | |
914 upload_content->assign(xml_writer.GetWrittenString()); | |
915 DVLOG(1) << "RenameResourceOperation data: " << *upload_content_type << ", [" | |
916 << *upload_content << "]"; | |
917 return true; | |
918 } | |
919 | |
920 //=========================== AddResourceToDirectoryOperation ================== | |
921 | |
922 class AddResourceToDirectoryOperation : public EntryActionOperation { | |
923 public: | |
924 AddResourceToDirectoryOperation(GDataOperationRegistry* registry, | |
925 Profile* profile, | |
926 const EntryActionCallback& callback, | |
927 const GURL& parent_content_url, | |
928 const GURL& document_url); | |
929 virtual ~AddResourceToDirectoryOperation() {} | |
930 | |
931 private: | |
932 // Overridden from EntryActionOperation. | |
933 virtual GURL GetURL() const OVERRIDE; | |
934 | |
935 // Overridden from UrlFetchOperation. | |
936 virtual URLFetcher::RequestType GetRequestType() const OVERRIDE; | |
937 virtual bool GetContentData(std::string* upload_content_type, | |
938 std::string* upload_content) OVERRIDE; | |
939 | |
940 const GURL parent_content_url_; | |
941 | |
942 DISALLOW_COPY_AND_ASSIGN(AddResourceToDirectoryOperation); | |
943 }; | |
944 | |
945 AddResourceToDirectoryOperation::AddResourceToDirectoryOperation( | |
946 GDataOperationRegistry* registry, | |
947 Profile* profile, | |
948 const EntryActionCallback& callback, | |
949 const GURL& parent_content_url, | |
950 const GURL& document_url) | |
951 : EntryActionOperation(registry, profile, callback, document_url), | |
952 parent_content_url_(parent_content_url) { | |
953 } | |
954 | |
955 GURL AddResourceToDirectoryOperation::GetURL() const { | |
956 if (!parent_content_url_.is_empty()) | |
957 return AddStandardUrlParams(parent_content_url_); | |
958 | |
959 return AddStandardUrlParams(GURL(kDocumentListRootURL)); | |
960 } | |
961 | |
962 URLFetcher::RequestType | |
963 AddResourceToDirectoryOperation::GetRequestType() const { | |
964 return URLFetcher::POST; | |
965 } | |
966 | |
967 bool AddResourceToDirectoryOperation::GetContentData( | |
968 std::string* upload_content_type, std::string* upload_content) { | |
969 upload_content_type->assign("application/atom+xml"); | |
970 XmlWriter xml_writer; | |
971 xml_writer.StartWriting(); | |
972 xml_writer.StartElement("entry"); | |
973 xml_writer.AddAttribute("xmlns", "http://www.w3.org/2005/Atom"); | |
974 | |
975 xml_writer.WriteElement("id", document_url_.spec()); | |
976 | |
977 xml_writer.EndElement(); // Ends "entry" element. | |
978 xml_writer.StopWriting(); | |
979 upload_content->assign(xml_writer.GetWrittenString()); | |
980 DVLOG(1) << "AddResourceToDirectoryOperation data: " << *upload_content_type | |
981 << ", [" << *upload_content << "]"; | |
982 return true; | |
983 } | |
984 | |
985 //=========================== RemoveResourceFromDirectoryOperation ============= | |
986 | |
987 class RemoveResourceFromDirectoryOperation : public EntryActionOperation { | |
988 public: | |
989 RemoveResourceFromDirectoryOperation(GDataOperationRegistry* registry, | |
990 Profile* profile, | |
991 const EntryActionCallback& callback, | |
992 const GURL& parent_content_url, | |
993 const GURL& document_url, | |
994 const std::string& resource_id); | |
995 virtual ~RemoveResourceFromDirectoryOperation() {} | |
996 | |
997 private: | |
998 // Overridden from EntryActionOperation. | |
999 virtual GURL GetURL() const OVERRIDE; | |
1000 | |
1001 // Overridden from UrlFetchOperation. | |
1002 virtual URLFetcher::RequestType GetRequestType() const OVERRIDE; | |
1003 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE; | |
1004 | |
1005 const std::string resource_id_; | |
1006 const GURL parent_content_url_; | |
1007 | |
1008 DISALLOW_COPY_AND_ASSIGN(RemoveResourceFromDirectoryOperation); | |
1009 }; | |
1010 | |
1011 RemoveResourceFromDirectoryOperation::RemoveResourceFromDirectoryOperation( | |
1012 GDataOperationRegistry* registry, | |
1013 Profile* profile, | |
1014 const EntryActionCallback& callback, | |
1015 const GURL& parent_content_url, | |
1016 const GURL& document_url, | |
1017 const std::string& document_resource_id) | |
1018 : EntryActionOperation(registry, profile, callback, document_url), | |
1019 resource_id_(document_resource_id), | |
1020 parent_content_url_(parent_content_url) { | |
1021 } | |
1022 | |
1023 GURL RemoveResourceFromDirectoryOperation::GetURL() const { | |
1024 std::string escaped_resource_id = net::EscapePath(resource_id_); | |
1025 GURL edit_url(base::StringPrintf("%s/%s", | |
1026 parent_content_url_.spec().c_str(), | |
1027 escaped_resource_id.c_str())); | |
1028 return AddStandardUrlParams(edit_url); | |
1029 } | |
1030 | |
1031 URLFetcher::RequestType | |
1032 RemoveResourceFromDirectoryOperation::GetRequestType() const { | |
1033 return URLFetcher::DELETE_REQUEST; | |
zel
2012/03/12 20:40:40
will this delete the file completely or just remov
Ben Chan
2012/03/13 00:29:21
It only removes the file from collection, not the
| |
1034 } | |
1035 | |
1036 std::vector<std::string> | |
1037 RemoveResourceFromDirectoryOperation::GetExtraRequestHeaders() const { | |
1038 std::vector<std::string> headers; | |
1039 headers.push_back(kIfMatchAllHeader); | |
1040 return headers; | |
1041 } | |
1042 | |
787 //=========================== InitiateUploadOperation ========================== | 1043 //=========================== InitiateUploadOperation ========================== |
788 | 1044 |
789 class InitiateUploadOperation | 1045 class InitiateUploadOperation |
790 : public UrlFetchOperation<InitiateUploadCallback> { | 1046 : public UrlFetchOperation<InitiateUploadCallback> { |
791 public: | 1047 public: |
792 InitiateUploadOperation(GDataOperationRegistry* registry, | 1048 InitiateUploadOperation(GDataOperationRegistry* registry, |
793 Profile* profile, | 1049 Profile* profile, |
794 const InitiateUploadCallback& callback, | 1050 const InitiateUploadCallback& callback, |
795 const InitiateUploadParams& params); | 1051 const InitiateUploadParams& params); |
796 | 1052 |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1196 void DocumentsService::CreateDirectory( | 1452 void DocumentsService::CreateDirectory( |
1197 const GURL& parent_content_url, | 1453 const GURL& parent_content_url, |
1198 const FilePath::StringType& directory_name, | 1454 const FilePath::StringType& directory_name, |
1199 const GetDataCallback& callback) { | 1455 const GetDataCallback& callback) { |
1200 StartOperationOnUIThread( | 1456 StartOperationOnUIThread( |
1201 new CreateDirectoryOperation(operation_registry_.get(), profile_, | 1457 new CreateDirectoryOperation(operation_registry_.get(), profile_, |
1202 callback, parent_content_url, | 1458 callback, parent_content_url, |
1203 directory_name)); | 1459 directory_name)); |
1204 } | 1460 } |
1205 | 1461 |
1462 void DocumentsService::CopyDocument(const GURL& document_url, | |
1463 const FilePath::StringType& new_name, | |
1464 const GetDataCallback& callback) { | |
1465 StartOperationOnUIThread( | |
1466 new CopyDocumentOperation(operation_registry_.get(), profile_, callback, | |
1467 document_url, new_name)); | |
1468 } | |
1469 | |
1470 void DocumentsService::RenameResource(const GURL& resource_url, | |
1471 const FilePath::StringType& new_name, | |
1472 const EntryActionCallback& callback) { | |
1473 StartOperationOnUIThread( | |
1474 new RenameResourceOperation(operation_registry_.get(), profile_, callback, | |
1475 resource_url, new_name)); | |
1476 } | |
1477 | |
1478 void DocumentsService::AddResourceToDirectory( | |
1479 const GURL& parent_content_url, | |
1480 const GURL& resource_url, | |
1481 const EntryActionCallback& callback) { | |
1482 StartOperationOnUIThread( | |
1483 new AddResourceToDirectoryOperation(operation_registry_.get(), | |
1484 profile_, | |
1485 callback, | |
1486 parent_content_url, | |
1487 resource_url)); | |
1488 } | |
1489 | |
1490 void DocumentsService::RemoveResourceFromDirectory( | |
1491 const GURL& parent_content_url, | |
1492 const GURL& resource_url, | |
1493 const std::string& resource_id, | |
1494 const EntryActionCallback& callback) { | |
1495 StartOperationOnUIThread( | |
1496 new RemoveResourceFromDirectoryOperation(operation_registry_.get(), | |
1497 profile_, | |
1498 callback, | |
1499 parent_content_url, | |
1500 resource_url, | |
1501 resource_id)); | |
1502 } | |
1503 | |
1206 void DocumentsService::InitiateUpload(const InitiateUploadParams& params, | 1504 void DocumentsService::InitiateUpload(const InitiateUploadParams& params, |
1207 const InitiateUploadCallback& callback) { | 1505 const InitiateUploadCallback& callback) { |
1208 if (params.resumable_create_media_link.is_empty()) { | 1506 if (params.resumable_create_media_link.is_empty()) { |
1209 if (!callback.is_null()) { | 1507 if (!callback.is_null()) { |
1210 callback.Run(HTTP_BAD_REQUEST, GURL()); | 1508 callback.Run(HTTP_BAD_REQUEST, GURL()); |
1211 } | 1509 } |
1212 return; | 1510 return; |
1213 } | 1511 } |
1214 | 1512 |
1215 StartOperationOnUIThread( | 1513 StartOperationOnUIThread( |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1274 void DocumentsService::RetryOperation(GDataOperationInterface* operation) { | 1572 void DocumentsService::RetryOperation(GDataOperationInterface* operation) { |
1275 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1573 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
1276 | 1574 |
1277 gdata_auth_service_->ClearOAuth2Token(); | 1575 gdata_auth_service_->ClearOAuth2Token(); |
1278 // User authentication might have expired - rerun the request to force | 1576 // User authentication might have expired - rerun the request to force |
1279 // auth token refresh. | 1577 // auth token refresh. |
1280 StartOperation(operation); | 1578 StartOperation(operation); |
1281 } | 1579 } |
1282 | 1580 |
1283 } // namespace gdata | 1581 } // namespace gdata |
OLD | NEW |