| 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/gdata_wapi_service.h" | 5 #include "chrome/browser/chromeos/gdata/gdata_wapi_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 namespace { | 23 namespace { |
| 24 | 24 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 GDataWapiService::GDataWapiService() | 62 GDataWapiService::GDataWapiService() |
| 63 : profile_(NULL), | 63 : profile_(NULL), |
| 64 runner_(NULL) { | 64 runner_(NULL) { |
| 65 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 65 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 66 } | 66 } |
| 67 | 67 |
| 68 GDataWapiService::~GDataWapiService() { | 68 GDataWapiService::~GDataWapiService() { |
| 69 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 69 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 70 } | 70 } |
| 71 | 71 |
| 72 GDataAuthService* GDataWapiService::auth_service_for_testing() { | 72 AuthService* GDataWapiService::auth_service_for_testing() { |
| 73 return runner_->auth_service(); | 73 return runner_->auth_service(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 void GDataWapiService::Initialize(Profile* profile) { | 76 void GDataWapiService::Initialize(Profile* profile) { |
| 77 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 77 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 78 profile_ = profile; | 78 profile_ = profile; |
| 79 runner_.reset(new GDataOperationRunner(profile)); | 79 runner_.reset(new OperationRunner(profile)); |
| 80 runner_->Initialize(); | 80 runner_->Initialize(); |
| 81 } | 81 } |
| 82 | 82 |
| 83 GDataOperationRegistry* GDataWapiService::operation_registry() const { | 83 OperationRegistry* GDataWapiService::operation_registry() const { |
| 84 return runner_->operation_registry(); | 84 return runner_->operation_registry(); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void GDataWapiService::CancelAll() { | 87 void GDataWapiService::CancelAll() { |
| 88 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 88 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 89 runner_->CancelAll(); | 89 runner_->CancelAll(); |
| 90 } | 90 } |
| 91 | 91 |
| 92 void GDataWapiService::Authenticate(const AuthStatusCallback& callback) { | 92 void GDataWapiService::Authenticate(const AuthStatusCallback& callback) { |
| 93 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 93 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 return runner_->auth_service()->HasAccessToken(); | 277 return runner_->auth_service()->HasAccessToken(); |
| 278 } | 278 } |
| 279 | 279 |
| 280 bool GDataWapiService::HasRefreshToken() const { | 280 bool GDataWapiService::HasRefreshToken() const { |
| 281 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 281 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 282 | 282 |
| 283 return runner_->auth_service()->HasRefreshToken(); | 283 return runner_->auth_service()->HasRefreshToken(); |
| 284 } | 284 } |
| 285 | 285 |
| 286 } // namespace gdata | 286 } // namespace gdata |
| OLD | NEW |