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

Side by Side Diff: components/signin/core/webdata/token_web_data.h

Issue 130813003: 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 unified diff | Download patch | Annotate | Revision Log
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 // Chromium settings and storage represent user-selected preferences and 5 // Chromium settings and storage represent user-selected preferences and
6 // information and MUST not be extracted, overwritten or modified except 6 // information and MUST not be extracted, overwritten or modified except
7 // through Chromium defined APIs. 7 // through Chromium defined APIs.
8 8
9 #ifndef CHROME_BROWSER_WEBDATA_TOKEN_WEB_DATA_H__ 9 #ifndef COMPONENTS_SIGNIN_CORE_WEBDATA_TOKEN_WEB_DATA_H__
10 #define CHROME_BROWSER_WEBDATA_TOKEN_WEB_DATA_H__ 10 #define COMPONENTS_SIGNIN_CORE_WEBDATA_TOKEN_WEB_DATA_H__
11 11
12 #include <map> 12 #include <map>
13 #include <string> 13 #include <string>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/callback_forward.h" 16 #include "base/callback_forward.h"
17 #include "base/files/file_path.h" 17 #include "base/files/file_path.h"
18 #include "base/location.h" 18 #include "base/location.h"
19 #include "base/memory/ref_counted.h" 19 #include "base/memory/ref_counted.h"
20 #include "components/webdata/common/web_data_results.h" 20 #include "components/webdata/common/web_data_results.h"
21 #include "components/webdata/common/web_data_service_base.h" 21 #include "components/webdata/common/web_data_service_base.h"
22 #include "components/webdata/common/web_data_service_consumer.h" 22 #include "components/webdata/common/web_data_service_consumer.h"
23 #include "components/webdata/common/web_database.h" 23 #include "components/webdata/common/web_database.h"
24 24
25 namespace base {
26 class MessageLoopProxy;
27 }
28
25 class TokenWebDataBackend; 29 class TokenWebDataBackend;
26 class WebDatabaseService; 30 class WebDatabaseService;
27 class WebDataServiceConsumer; 31 class WebDataServiceConsumer;
28 32
29 namespace content {
30 class BrowserContext;
31 }
32
33 // TokenWebData is a data repository for storage of authentication tokens. 33 // TokenWebData is a data repository for storage of authentication tokens.
34 34
35 class TokenWebData : public WebDataServiceBase { 35 class TokenWebData : public WebDataServiceBase {
36 public: 36 public:
37 // Retrieve a WebDataService for the given context. 37 TokenWebData(scoped_refptr<WebDatabaseService> wdbs,
38 static scoped_refptr<TokenWebData> FromBrowserContext( 38 scoped_refptr<base::MessageLoopProxy> ui_thread,
39 content::BrowserContext* context); 39 scoped_refptr<base::MessageLoopProxy> db_thread,
40 const ProfileErrorCallback& callback);
40 41
41 TokenWebData(scoped_refptr<WebDatabaseService> wdbs, 42 TokenWebData(scoped_refptr<base::MessageLoopProxy> ui_thread,
42 const ProfileErrorCallback& callback); 43 scoped_refptr<base::MessageLoopProxy> db_thread);
43 44
44 // Set a token to use for a specified service. 45 // Set a token to use for a specified service.
45 void SetTokenForService(const std::string& service, 46 void SetTokenForService(const std::string& service,
46 const std::string& token); 47 const std::string& token);
47 48
48 // Remove all tokens stored in the web database. 49 // Remove all tokens stored in the web database.
49 void RemoveAllTokens(); 50 void RemoveAllTokens();
50 51
51 // Removes a token related to |service| from the web database. 52 // Removes a token related to |service| from the web database.
52 void RemoveTokenForService(const std::string& service); 53 void RemoveTokenForService(const std::string& service);
53 54
54 // Null on failure. Success is WDResult<std::vector<std::string> > 55 // Null on failure. Success is WDResult<std::vector<std::string> >
55 virtual Handle GetAllTokens(WebDataServiceConsumer* consumer); 56 virtual Handle GetAllTokens(WebDataServiceConsumer* consumer);
56 57
57 protected: 58 protected:
58 // For unit tests, passes a null callback. 59 // For unit tests, passes a null callback.
59 TokenWebData(); 60 TokenWebData();
60 61
61 virtual ~TokenWebData(); 62 virtual ~TokenWebData();
62 63
63 private: 64 private:
64 scoped_refptr<TokenWebDataBackend> token_backend_; 65 scoped_refptr<TokenWebDataBackend> token_backend_;
65 66
66 DISALLOW_COPY_AND_ASSIGN(TokenWebData); 67 DISALLOW_COPY_AND_ASSIGN(TokenWebData);
67 }; 68 };
68 69
69 #endif // CHROME_BROWSER_WEBDATA_TOKEN_WEB_DATA_H__ 70 #endif // COMPONENTS_SIGNIN_CORE_WEBDATA_TOKEN_WEB_DATA_H__
OLDNEW
« no previous file with comments | « components/signin/core/webdata/token_service_table_unittest.cc ('k') | components/signin/core/webdata/token_web_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698