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