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

Side by Side Diff: components/signin/core/browser/webdata/token_web_data.cc

Issue 2672833002: [Desktop] Add diagnostics about loading the refresh tokens. (Closed)
Patch Set: Fix compile Created 3 years, 10 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/signin/core/browser/webdata/token_web_data.h" 5 #include "components/signin/core/browser/webdata/token_web_data.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/memory/ref_counted_delete_on_sequence.h" 9 #include "base/memory/ref_counted_delete_on_sequence.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 29 matching lines...) Expand all
40 WebDatabase::State SetTokenForService( 40 WebDatabase::State SetTokenForService(
41 const std::string& service, const std::string& token, WebDatabase* db) { 41 const std::string& service, const std::string& token, WebDatabase* db) {
42 if (TokenServiceTable::FromWebDatabase(db)->SetTokenForService(service, 42 if (TokenServiceTable::FromWebDatabase(db)->SetTokenForService(service,
43 token)) { 43 token)) {
44 return WebDatabase::COMMIT_NEEDED; 44 return WebDatabase::COMMIT_NEEDED;
45 } 45 }
46 return WebDatabase::COMMIT_NOT_NEEDED; 46 return WebDatabase::COMMIT_NOT_NEEDED;
47 } 47 }
48 48
49 std::unique_ptr<WDTypedResult> GetAllTokens(WebDatabase* db) { 49 std::unique_ptr<WDTypedResult> GetAllTokens(WebDatabase* db) {
50 std::map<std::string, std::string> map; 50 TokenResult result;
51 TokenServiceTable::FromWebDatabase(db)->GetAllTokens(&map); 51 result.db_result =
52 return base::MakeUnique<WDResult<std::map<std::string, std::string>>>( 52 TokenServiceTable::FromWebDatabase(db)->GetAllTokens(&result.tokens);
53 TOKEN_RESULT, map); 53 return base::MakeUnique<WDResult<TokenResult>>(TOKEN_RESULT, result);
54 } 54 }
55 55
56 protected: 56 protected:
57 virtual ~TokenWebDataBackend() { 57 virtual ~TokenWebDataBackend() {
58 } 58 }
59 59
60 private: 60 private:
61 friend class base::RefCountedDeleteOnSequence<TokenWebDataBackend>; 61 friend class base::RefCountedDeleteOnSequence<TokenWebDataBackend>;
62 friend class base::DeleteHelper<TokenWebDataBackend>; 62 friend class base::DeleteHelper<TokenWebDataBackend>;
63 }; 63 };
64 64
65 TokenResult::TokenResult()
66 : db_result(TokenServiceTable::TOKEN_DB_RESULT_SQL_INVALID_STATEMENT) {}
67 TokenResult::TokenResult(const TokenResult& other) = default;
68 TokenResult::~TokenResult(){};
69
65 TokenWebData::TokenWebData( 70 TokenWebData::TokenWebData(
66 scoped_refptr<WebDatabaseService> wdbs, 71 scoped_refptr<WebDatabaseService> wdbs,
67 scoped_refptr<base::SingleThreadTaskRunner> ui_thread, 72 scoped_refptr<base::SingleThreadTaskRunner> ui_thread,
68 scoped_refptr<base::SingleThreadTaskRunner> db_thread, 73 scoped_refptr<base::SingleThreadTaskRunner> db_thread,
69 const ProfileErrorCallback& callback) 74 const ProfileErrorCallback& callback)
70 : WebDataServiceBase(wdbs, callback, ui_thread), 75 : WebDataServiceBase(wdbs, callback, ui_thread),
71 token_backend_(new TokenWebDataBackend(db_thread)) { 76 token_backend_(new TokenWebDataBackend(db_thread)) {
72 } 77 }
73 78
74 void TokenWebData::SetTokenForService(const std::string& service, 79 void TokenWebData::SetTokenForService(const std::string& service,
(...skipping 23 matching lines...) Expand all
98 103
99 TokenWebData::TokenWebData( 104 TokenWebData::TokenWebData(
100 scoped_refptr<base::SingleThreadTaskRunner> ui_thread, 105 scoped_refptr<base::SingleThreadTaskRunner> ui_thread,
101 scoped_refptr<base::SingleThreadTaskRunner> db_thread) 106 scoped_refptr<base::SingleThreadTaskRunner> db_thread)
102 : WebDataServiceBase(NULL, ProfileErrorCallback(), ui_thread), 107 : WebDataServiceBase(NULL, ProfileErrorCallback(), ui_thread),
103 token_backend_(new TokenWebDataBackend(db_thread)) { 108 token_backend_(new TokenWebDataBackend(db_thread)) {
104 } 109 }
105 110
106 TokenWebData::~TokenWebData() { 111 TokenWebData::~TokenWebData() {
107 } 112 }
OLDNEW
« no previous file with comments | « components/signin/core/browser/webdata/token_web_data.h ('k') | components/webdata/common/web_data_results.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698