Chromium Code Reviews| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 86 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 86 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 87 | 87 |
| 88 runner_->StartOperationWithRetry( | 88 runner_->StartOperationWithRetry( |
| 89 new GetChangelistOperation(operation_registry(), | 89 new GetChangelistOperation(operation_registry(), |
| 90 url, | 90 url, |
| 91 start_changestamp, | 91 start_changestamp, |
| 92 callback)); | 92 callback)); |
| 93 } | 93 } |
| 94 | 94 |
| 95 void DriveAPIService::GetDocumentEntry(const std::string& resource_id, | 95 void DriveAPIService::GetDocumentEntry(const std::string& resource_id, |
| 96 const GetDataCallback& callback) { | 96 const GetDataCallback& callback) { |
|
kochi
2012/08/21 05:09:23
Fix indentation done.
| |
| 97 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 97 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 98 | 98 |
| 99 runner_->StartOperationWithRetry(new GetFileOperation(operation_registry(), | 99 runner_->StartOperationWithRetry(new GetFileOperation(operation_registry(), |
| 100 resource_id, | 100 resource_id, |
| 101 callback)); | 101 callback)); |
| 102 } | 102 } |
| 103 | 103 |
| 104 void DriveAPIService::GetAccountMetadata(const GetDataCallback& callback) { | 104 void DriveAPIService::GetAccountMetadata(const GetDataCallback& callback) { |
| 105 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 105 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 106 | 106 |
| (...skipping 121 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 |