| 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/drive/drive_api_service.h" |    5 #include "chrome/browser/drive/drive_api_service.h" | 
|    6  |    6  | 
|    7 #include <string> |    7 #include <string> | 
|    8 #include <vector> |    8 #include <vector> | 
|    9  |    9  | 
|   10 #include "base/bind.h" |   10 #include "base/bind.h" | 
| (...skipping 22 matching lines...) Expand all  Loading... | 
|   33 using google_apis::FileList; |   33 using google_apis::FileList; | 
|   34 using google_apis::FileResource; |   34 using google_apis::FileResource; | 
|   35 using google_apis::GDATA_OTHER_ERROR; |   35 using google_apis::GDATA_OTHER_ERROR; | 
|   36 using google_apis::GDATA_PARSE_ERROR; |   36 using google_apis::GDATA_PARSE_ERROR; | 
|   37 using google_apis::GDataErrorCode; |   37 using google_apis::GDataErrorCode; | 
|   38 using google_apis::AboutResourceCallback; |   38 using google_apis::AboutResourceCallback; | 
|   39 using google_apis::GetContentCallback; |   39 using google_apis::GetContentCallback; | 
|   40 using google_apis::GetResourceEntryCallback; |   40 using google_apis::GetResourceEntryCallback; | 
|   41 using google_apis::GetResourceEntryRequest; |   41 using google_apis::GetResourceEntryRequest; | 
|   42 using google_apis::GetResourceListCallback; |   42 using google_apis::GetResourceListCallback; | 
 |   43 using google_apis::GetResourceListRequest; | 
|   43 using google_apis::GetShareUrlCallback; |   44 using google_apis::GetShareUrlCallback; | 
|   44 using google_apis::HTTP_NOT_IMPLEMENTED; |   45 using google_apis::HTTP_NOT_IMPLEMENTED; | 
|   45 using google_apis::HTTP_SUCCESS; |   46 using google_apis::HTTP_SUCCESS; | 
|   46 using google_apis::InitiateUploadCallback; |   47 using google_apis::InitiateUploadCallback; | 
|   47 using google_apis::Link; |   48 using google_apis::Link; | 
|   48 using google_apis::ProgressCallback; |   49 using google_apis::ProgressCallback; | 
|   49 using google_apis::RequestSender; |   50 using google_apis::RequestSender; | 
|   50 using google_apis::ResourceEntry; |   51 using google_apis::ResourceEntry; | 
|   51 using google_apis::ResourceList; |   52 using google_apis::ResourceList; | 
|   52 using google_apis::UploadRangeCallback; |   53 using google_apis::UploadRangeCallback; | 
| (...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  819   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |  820   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 
|  820   DCHECK(!callback.is_null()); |  821   DCHECK(!callback.is_null()); | 
|  821  |  822  | 
|  822   FilesGetRequest* request = new FilesGetRequest( |  823   FilesGetRequest* request = new FilesGetRequest( | 
|  823       sender_.get(), url_generator_, |  824       sender_.get(), url_generator_, | 
|  824       base::Bind(&ExtractOpenUrlAndRun, app_id, callback)); |  825       base::Bind(&ExtractOpenUrlAndRun, app_id, callback)); | 
|  825   request->set_file_id(resource_id); |  826   request->set_file_id(resource_id); | 
|  826   return sender_->StartRequestWithRetry(request); |  827   return sender_->StartRequestWithRetry(request); | 
|  827 } |  828 } | 
|  828  |  829  | 
 |  830 CancelCallback DriveAPIService::GetResourceListInDirectoryByWapi( | 
 |  831     const std::string& directory_resource_id, | 
 |  832     const google_apis::GetResourceListCallback& callback) { | 
 |  833   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 
 |  834   DCHECK(!directory_resource_id.empty()); | 
 |  835   DCHECK(!callback.is_null()); | 
 |  836  | 
 |  837   return sender_->StartRequestWithRetry( | 
 |  838       new GetResourceListRequest(sender_.get(), | 
 |  839                                  wapi_url_generator_, | 
 |  840                                  GURL(),         // No override url | 
 |  841                                  0,              // start changestamp | 
 |  842                                  std::string(),  // empty search query | 
 |  843                                  directory_resource_id, | 
 |  844                                  callback)); | 
 |  845 } | 
 |  846  | 
 |  847 CancelCallback DriveAPIService::GetRemainingResourceList( | 
 |  848     const GURL& next_url, | 
 |  849     const google_apis::GetResourceListCallback& callback) { | 
 |  850   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 
 |  851   DCHECK(!next_url.is_empty()); | 
 |  852   DCHECK(!callback.is_null()); | 
 |  853  | 
 |  854   return sender_->StartRequestWithRetry( | 
 |  855       new GetResourceListRequest(sender_.get(), | 
 |  856                                  wapi_url_generator_, | 
 |  857                                  next_url, | 
 |  858                                  0,              // start changestamp | 
 |  859                                  std::string(),  // empty search query | 
 |  860                                  std::string(),  // no directory resource id | 
 |  861                                  callback)); | 
 |  862 } | 
 |  863  | 
|  829 bool DriveAPIService::HasAccessToken() const { |  864 bool DriveAPIService::HasAccessToken() const { | 
|  830   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |  865   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 
|  831   return sender_->auth_service()->HasAccessToken(); |  866   return sender_->auth_service()->HasAccessToken(); | 
|  832 } |  867 } | 
|  833  |  868  | 
|  834 void DriveAPIService::RequestAccessToken(const AuthStatusCallback& callback) { |  869 void DriveAPIService::RequestAccessToken(const AuthStatusCallback& callback) { | 
|  835   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |  870   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 
|  836   DCHECK(!callback.is_null()); |  871   DCHECK(!callback.is_null()); | 
|  837  |  872  | 
|  838   const std::string access_token = sender_->auth_service()->access_token(); |  873   const std::string access_token = sender_->auth_service()->access_token(); | 
| (...skipping 26 matching lines...) Expand all  Loading... | 
|  865   if (CanSendRequest()) { |  900   if (CanSendRequest()) { | 
|  866     FOR_EACH_OBSERVER( |  901     FOR_EACH_OBSERVER( | 
|  867         DriveServiceObserver, observers_, OnReadyToSendRequests()); |  902         DriveServiceObserver, observers_, OnReadyToSendRequests()); | 
|  868   } else if (!HasRefreshToken()) { |  903   } else if (!HasRefreshToken()) { | 
|  869     FOR_EACH_OBSERVER( |  904     FOR_EACH_OBSERVER( | 
|  870         DriveServiceObserver, observers_, OnRefreshTokenInvalid()); |  905         DriveServiceObserver, observers_, OnRefreshTokenInvalid()); | 
|  871   } |  906   } | 
|  872 } |  907 } | 
|  873  |  908  | 
|  874 }  // namespace drive |  909 }  // namespace drive | 
| OLD | NEW |