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

Side by Side Diff: chrome/browser/webdata/token_web_data.cc

Issue 16174013: Remove dependency of WebData on content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments Created 7 years, 6 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 unified diff | Download patch
OLDNEW
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/bind.h"
7 #include "base/stl_util.h" 8 #include "base/stl_util.h"
8 #include "chrome/browser/webdata/token_service_table.h" 9 #include "chrome/browser/webdata/token_service_table.h"
9 #include "components/webdata/common/web_database_service.h" 10 #include "components/webdata/common/web_database_service.h"
11 #include "content/public/browser/browser_thread.h"
10 12
11 using base::Bind; 13 using base::Bind;
12 using base::Time; 14 using base::Time;
13 using content::BrowserThread; 15 using content::BrowserThread;
14 16
15 class TokenWebDataBackend 17 class TokenWebDataBackend
16 : public base::RefCountedThreadSafe<TokenWebDataBackend, 18 : public base::RefCountedThreadSafe<TokenWebDataBackend,
17 BrowserThread::DeleteOnDBThread> { 19 BrowserThread::DeleteOnDBThread> {
18 20
19 public: 21 public:
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 friend class base::DeleteHelper<TokenWebDataBackend>; 54 friend class base::DeleteHelper<TokenWebDataBackend>;
53 // We have to friend RCTS<> so WIN shared-lib build is happy 55 // We have to friend RCTS<> so WIN shared-lib build is happy
54 // (http://crbug/112250). 56 // (http://crbug/112250).
55 friend class base::RefCountedThreadSafe<TokenWebDataBackend, 57 friend class base::RefCountedThreadSafe<TokenWebDataBackend,
56 BrowserThread::DeleteOnDBThread>; 58 BrowserThread::DeleteOnDBThread>;
57 59
58 }; 60 };
59 61
60 TokenWebData::TokenWebData(scoped_refptr<WebDatabaseService> wdbs, 62 TokenWebData::TokenWebData(scoped_refptr<WebDatabaseService> wdbs,
61 const ProfileErrorCallback& callback) 63 const ProfileErrorCallback& callback)
62 : WebDataServiceBase(wdbs, callback), 64 : WebDataServiceBase(wdbs, callback,
65 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI)),
63 token_backend_(new TokenWebDataBackend()) { 66 token_backend_(new TokenWebDataBackend()) {
64 } 67 }
65 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(),
90 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI)),
87 token_backend_(new TokenWebDataBackend()) { 91 token_backend_(new TokenWebDataBackend()) {
88 } 92 }
89 93
90 TokenWebData::~TokenWebData() { 94 TokenWebData::~TokenWebData() {
91 } 95 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc ('k') | chrome/browser/webdata/web_data_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698