| 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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 void DriveAPIService::RemoveObserver(DriveServiceObserver* observer) { | 259 void DriveAPIService::RemoveObserver(DriveServiceObserver* observer) { |
| 260 observers_.RemoveObserver(observer); | 260 observers_.RemoveObserver(observer); |
| 261 } | 261 } |
| 262 | 262 |
| 263 bool DriveAPIService::CanSendRequest() const { | 263 bool DriveAPIService::CanSendRequest() const { |
| 264 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 264 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 265 | 265 |
| 266 return HasRefreshToken(); | 266 return HasRefreshToken(); |
| 267 } | 267 } |
| 268 | 268 |
| 269 void DriveAPIService::CancelAll() { | |
| 270 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
| 271 sender_->CancelAll(); | |
| 272 } | |
| 273 | |
| 274 bool DriveAPIService::CancelForFilePath(const base::FilePath& file_path) { | |
| 275 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
| 276 return sender_->request_registry()->CancelForFilePath(file_path); | |
| 277 } | |
| 278 | |
| 279 std::string DriveAPIService::CanonicalizeResourceId( | 269 std::string DriveAPIService::CanonicalizeResourceId( |
| 280 const std::string& resource_id) const { | 270 const std::string& resource_id) const { |
| 281 return drive::util::CanonicalizeResourceId(resource_id); | 271 return drive::util::CanonicalizeResourceId(resource_id); |
| 282 } | 272 } |
| 283 | 273 |
| 284 std::string DriveAPIService::GetRootResourceId() const { | 274 std::string DriveAPIService::GetRootResourceId() const { |
| 285 return kDriveApiRootDirectoryResourceId; | 275 return kDriveApiRootDirectoryResourceId; |
| 286 } | 276 } |
| 287 | 277 |
| 288 CancelCallback DriveAPIService::GetAllResourceList( | 278 CancelCallback DriveAPIService::GetAllResourceList( |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 if (CanSendRequest()) { | 732 if (CanSendRequest()) { |
| 743 FOR_EACH_OBSERVER( | 733 FOR_EACH_OBSERVER( |
| 744 DriveServiceObserver, observers_, OnReadyToSendRequests()); | 734 DriveServiceObserver, observers_, OnReadyToSendRequests()); |
| 745 } else if (!HasRefreshToken()) { | 735 } else if (!HasRefreshToken()) { |
| 746 FOR_EACH_OBSERVER( | 736 FOR_EACH_OBSERVER( |
| 747 DriveServiceObserver, observers_, OnRefreshTokenInvalid()); | 737 DriveServiceObserver, observers_, OnRefreshTokenInvalid()); |
| 748 } | 738 } |
| 749 } | 739 } |
| 750 | 740 |
| 751 } // namespace google_apis | 741 } // namespace google_apis |
| OLD | NEW |