| 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 void DriveAPIService::RemoveObserver(DriveServiceObserver* observer) { | 212 void DriveAPIService::RemoveObserver(DriveServiceObserver* observer) { |
| 213 observers_.RemoveObserver(observer); | 213 observers_.RemoveObserver(observer); |
| 214 } | 214 } |
| 215 | 215 |
| 216 bool DriveAPIService::CanSendRequest() const { | 216 bool DriveAPIService::CanSendRequest() const { |
| 217 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 217 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 218 | 218 |
| 219 return HasRefreshToken(); | 219 return HasRefreshToken(); |
| 220 } | 220 } |
| 221 | 221 |
| 222 ResourceIdCanonicalizer DriveAPIService::GetResourceIdCanonicalizer() const { | |
| 223 return base::Bind(&drive::util::CanonicalizeResourceId); | |
| 224 } | |
| 225 | |
| 226 std::string DriveAPIService::GetRootResourceId() const { | 222 std::string DriveAPIService::GetRootResourceId() const { |
| 227 return kDriveApiRootDirectoryResourceId; | 223 return kDriveApiRootDirectoryResourceId; |
| 228 } | 224 } |
| 229 | 225 |
| 230 CancelCallback DriveAPIService::GetAllFileList( | 226 CancelCallback DriveAPIService::GetAllFileList( |
| 231 const FileListCallback& callback) { | 227 const FileListCallback& callback) { |
| 232 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 228 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 233 DCHECK(!callback.is_null()); | 229 DCHECK(!callback.is_null()); |
| 234 | 230 |
| 235 FilesListRequest* request = new FilesListRequest( | 231 FilesListRequest* request = new FilesListRequest( |
| (...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 if (CanSendRequest()) { | 746 if (CanSendRequest()) { |
| 751 FOR_EACH_OBSERVER( | 747 FOR_EACH_OBSERVER( |
| 752 DriveServiceObserver, observers_, OnReadyToSendRequests()); | 748 DriveServiceObserver, observers_, OnReadyToSendRequests()); |
| 753 } else if (!HasRefreshToken()) { | 749 } else if (!HasRefreshToken()) { |
| 754 FOR_EACH_OBSERVER( | 750 FOR_EACH_OBSERVER( |
| 755 DriveServiceObserver, observers_, OnRefreshTokenInvalid()); | 751 DriveServiceObserver, observers_, OnRefreshTokenInvalid()); |
| 756 } | 752 } |
| 757 } | 753 } |
| 758 | 754 |
| 759 } // namespace drive | 755 } // namespace drive |
| OLD | NEW |