| 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/drive_api_service.h" | 5 #include "chrome/browser/chromeos/gdata/drive_api_service.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
| 11 #include "chrome/browser/chromeos/gdata/drive_api_operations.h" | 11 #include "chrome/browser/chromeos/gdata/drive_api_operations.h" |
| 12 #include "chrome/browser/chromeos/gdata/gdata_operation_runner.h" | |
| 13 #include "chrome/browser/chromeos/gdata/gdata_operations.h" | 12 #include "chrome/browser/chromeos/gdata/gdata_operations.h" |
| 14 #include "chrome/browser/chromeos/gdata/gdata_util.h" | 13 #include "chrome/browser/chromeos/gdata/gdata_util.h" |
| 14 #include "chrome/browser/chromeos/gdata/operation_runner.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/common/net/url_util.h" | 16 #include "chrome/common/net/url_util.h" |
| 17 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
| 18 | 18 |
| 19 using content::BrowserThread; | 19 using content::BrowserThread; |
| 20 | 20 |
| 21 namespace gdata { | 21 namespace gdata { |
| 22 | 22 |
| 23 DriveAPIService::DriveAPIService() | 23 DriveAPIService::DriveAPIService() |
| 24 : profile_(NULL), | 24 : profile_(NULL), |
| 25 runner_(NULL) { | 25 runner_(NULL) { |
| 26 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 26 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 27 } | 27 } |
| 28 | 28 |
| 29 DriveAPIService::~DriveAPIService() { | 29 DriveAPIService::~DriveAPIService() { |
| 30 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 30 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 31 } | 31 } |
| 32 | 32 |
| 33 void DriveAPIService::Initialize(Profile* profile) { | 33 void DriveAPIService::Initialize(Profile* profile) { |
| 34 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 34 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 35 profile_ = profile; | 35 profile_ = profile; |
| 36 runner_.reset(new GDataOperationRunner(profile)); | 36 runner_.reset(new OperationRunner(profile)); |
| 37 runner_->Initialize(); | 37 runner_->Initialize(); |
| 38 } | 38 } |
| 39 | 39 |
| 40 GDataOperationRegistry* DriveAPIService::operation_registry() const { | 40 OperationRegistry* DriveAPIService::operation_registry() const { |
| 41 return runner_->operation_registry(); | 41 return runner_->operation_registry(); |
| 42 } | 42 } |
| 43 | 43 |
| 44 void DriveAPIService::CancelAll() { | 44 void DriveAPIService::CancelAll() { |
| 45 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 45 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 46 runner_->CancelAll(); | 46 runner_->CancelAll(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 void DriveAPIService::Authenticate(const AuthStatusCallback& callback) { | 49 void DriveAPIService::Authenticate(const AuthStatusCallback& callback) { |
| 50 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 50 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 return runner_->auth_service()->HasAccessToken(); | 228 return runner_->auth_service()->HasAccessToken(); |
| 229 } | 229 } |
| 230 | 230 |
| 231 bool DriveAPIService::HasRefreshToken() const { | 231 bool DriveAPIService::HasRefreshToken() const { |
| 232 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 232 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 233 | 233 |
| 234 return runner_->auth_service()->HasRefreshToken(); | 234 return runner_->auth_service()->HasRefreshToken(); |
| 235 } | 235 } |
| 236 | 236 |
| 237 } // namespace gdata | 237 } // namespace gdata |
| OLD | NEW |