| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/webdata/token_web_data.h" | 5 #include "chrome/browser/webdata/token_web_data.h" |
| 6 | 6 |
| 7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 #include "chrome/browser/webdata/token_service_table.h" | 8 #include "chrome/browser/webdata/token_service_table.h" |
| 9 #include "components/webdata/common/web_database_service.h" | 9 #include "components/webdata/common/web_database_service.h" |
| 10 | 10 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 BrowserThread::DeleteOnDBThread>; | 56 BrowserThread::DeleteOnDBThread>; |
| 57 | 57 |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 TokenWebData::TokenWebData(scoped_refptr<WebDatabaseService> wdbs, | 60 TokenWebData::TokenWebData(scoped_refptr<WebDatabaseService> wdbs, |
| 61 const ProfileErrorCallback& callback) | 61 const ProfileErrorCallback& callback) |
| 62 : WebDataServiceBase(wdbs, callback), | 62 : WebDataServiceBase(wdbs, callback), |
| 63 token_backend_(new TokenWebDataBackend()) { | 63 token_backend_(new TokenWebDataBackend()) { |
| 64 } | 64 } |
| 65 | 65 |
| 66 TokenWebData::~TokenWebData() { |
| 67 } |
| 68 |
| 66 void TokenWebData::SetTokenForService(const std::string& service, | 69 void TokenWebData::SetTokenForService(const std::string& service, |
| 67 const std::string& token) { | 70 const std::string& token) { |
| 68 wdbs_->ScheduleDBTask(FROM_HERE, | 71 wdbs_->ScheduleDBTask(FROM_HERE, |
| 69 Bind(&TokenWebDataBackend::SetTokenForService, token_backend_, | 72 Bind(&TokenWebDataBackend::SetTokenForService, token_backend_, |
| 70 service, token)); | 73 service, token)); |
| 71 } | 74 } |
| 72 | 75 |
| 73 void TokenWebData::RemoveAllTokens() { | 76 void TokenWebData::RemoveAllTokens() { |
| 74 wdbs_->ScheduleDBTask(FROM_HERE, | 77 wdbs_->ScheduleDBTask(FROM_HERE, |
| 75 Bind(&TokenWebDataBackend::RemoveAllTokens, token_backend_)); | 78 Bind(&TokenWebDataBackend::RemoveAllTokens, token_backend_)); |
| 76 } | 79 } |
| 77 | 80 |
| 78 // Null on failure. Success is WDResult<std::string> | 81 // Null on failure. Success is WDResult<std::string> |
| 79 WebDataServiceBase::Handle TokenWebData::GetAllTokens( | 82 WebDataServiceBase::Handle TokenWebData::GetAllTokens( |
| 80 WebDataServiceConsumer* consumer) { | 83 WebDataServiceConsumer* consumer) { |
| 81 return wdbs_->ScheduleDBTaskWithResult(FROM_HERE, | 84 return wdbs_->ScheduleDBTaskWithResult(FROM_HERE, |
| 82 Bind(&TokenWebDataBackend::GetAllTokens, token_backend_), consumer); | 85 Bind(&TokenWebDataBackend::GetAllTokens, token_backend_), consumer); |
| 83 } | 86 } |
| 84 | 87 |
| 85 TokenWebData::TokenWebData() | 88 TokenWebData::TokenWebData() |
| 86 : WebDataServiceBase(NULL, ProfileErrorCallback()), | 89 : WebDataServiceBase(NULL, ProfileErrorCallback()), |
| 87 token_backend_(new TokenWebDataBackend()) { | 90 token_backend_(new TokenWebDataBackend()) { |
| 88 } | 91 } |
| 89 | |
| 90 TokenWebData::~TokenWebData() { | |
| 91 } | |
| OLD | NEW |