Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(539)

Unified Diff: components/signin/core/webdata/token_web_data.cc

Issue 129253003: Revert of Create signin component and componentize TokenWebData. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/signin/core/webdata/token_web_data.h ('k') | components/webdata/DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/signin/core/webdata/token_web_data.cc
diff --git a/components/signin/core/webdata/token_web_data.cc b/components/signin/core/webdata/token_web_data.cc
deleted file mode 100644
index 2531586d3f2a369f5355b832a2a5bb65757b4ebe..0000000000000000000000000000000000000000
--- a/components/signin/core/webdata/token_web_data.cc
+++ /dev/null
@@ -1,106 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/signin/core/webdata/token_web_data.h"
-
-#include "base/bind.h"
-#include "base/memory/ref_counted_delete_on_message_loop.h"
-#include "base/message_loop/message_loop_proxy.h"
-#include "base/stl_util.h"
-#include "components/signin/core/webdata/token_service_table.h"
-#include "components/webdata/common/web_database_service.h"
-
-using base::Bind;
-using base::Time;
-
-class TokenWebDataBackend
- : public base::RefCountedDeleteOnMessageLoop<TokenWebDataBackend> {
-
- public:
- TokenWebDataBackend(scoped_refptr<base::MessageLoopProxy> db_thread)
- : base::RefCountedDeleteOnMessageLoop<TokenWebDataBackend>(db_thread) {
- }
-
- WebDatabase::State RemoveAllTokens(WebDatabase* db) {
- if (TokenServiceTable::FromWebDatabase(db)->RemoveAllTokens()) {
- return WebDatabase::COMMIT_NEEDED;
- }
- return WebDatabase::COMMIT_NOT_NEEDED;
- }
-
- WebDatabase::State RemoveTokenForService(
- const std::string& service, WebDatabase* db) {
- if (TokenServiceTable::FromWebDatabase(db)
- ->RemoveTokenForService(service)) {
- return WebDatabase::COMMIT_NEEDED;
- }
- return WebDatabase::COMMIT_NOT_NEEDED;
- }
-
- WebDatabase::State SetTokenForService(
- const std::string& service, const std::string& token, WebDatabase* db) {
- if (TokenServiceTable::FromWebDatabase(db)->SetTokenForService(service,
- token)) {
- return WebDatabase::COMMIT_NEEDED;
- }
- return WebDatabase::COMMIT_NOT_NEEDED;
- }
-
- scoped_ptr<WDTypedResult> GetAllTokens(WebDatabase* db) {
- std::map<std::string, std::string> map;
- TokenServiceTable::FromWebDatabase(db)->GetAllTokens(&map);
- return scoped_ptr<WDTypedResult>(
- new WDResult<std::map<std::string, std::string> >(TOKEN_RESULT, map));
- }
-
- protected:
- virtual ~TokenWebDataBackend() {
- }
-
- private:
- friend class base::RefCountedDeleteOnMessageLoop<TokenWebDataBackend>;
- friend class base::DeleteHelper<TokenWebDataBackend>;
-};
-
-TokenWebData::TokenWebData(scoped_refptr<WebDatabaseService> wdbs,
- scoped_refptr<base::MessageLoopProxy> ui_thread,
- scoped_refptr<base::MessageLoopProxy> db_thread,
- const ProfileErrorCallback& callback)
- : WebDataServiceBase(wdbs, callback, ui_thread),
- token_backend_(new TokenWebDataBackend(db_thread)) {
-}
-
-void TokenWebData::SetTokenForService(const std::string& service,
- const std::string& token) {
- wdbs_->ScheduleDBTask(FROM_HERE,
- Bind(&TokenWebDataBackend::SetTokenForService, token_backend_,
- service, token));
-}
-
-void TokenWebData::RemoveAllTokens() {
- wdbs_->ScheduleDBTask(FROM_HERE,
- Bind(&TokenWebDataBackend::RemoveAllTokens, token_backend_));
-}
-
-void TokenWebData::RemoveTokenForService(const std::string& service) {
- wdbs_->ScheduleDBTask(FROM_HERE,
- Bind(&TokenWebDataBackend::RemoveTokenForService, token_backend_,
- service));
-}
-
-// Null on failure. Success is WDResult<std::string>
-WebDataServiceBase::Handle TokenWebData::GetAllTokens(
- WebDataServiceConsumer* consumer) {
- return wdbs_->ScheduleDBTaskWithResult(FROM_HERE,
- Bind(&TokenWebDataBackend::GetAllTokens, token_backend_), consumer);
-}
-
-TokenWebData::TokenWebData(scoped_refptr<base::MessageLoopProxy> ui_thread,
- scoped_refptr<base::MessageLoopProxy> db_thread)
- : WebDataServiceBase(NULL, ProfileErrorCallback(), ui_thread),
- token_backend_(new TokenWebDataBackend(db_thread)) {
-}
-
-TokenWebData::~TokenWebData() {
-}
« no previous file with comments | « components/signin/core/webdata/token_web_data.h ('k') | components/webdata/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698