OLD | NEW |
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 #ifndef COMPONENTS_SIGNIN_CORE_BROWSER_WEBDATA_TOKEN_SERVICE_TABLE_H_ | 5 #ifndef COMPONENTS_SIGNIN_CORE_BROWSER_WEBDATA_TOKEN_SERVICE_TABLE_H_ |
6 #define COMPONENTS_SIGNIN_CORE_BROWSER_WEBDATA_TOKEN_SERVICE_TABLE_H_ | 6 #define COMPONENTS_SIGNIN_CORE_BROWSER_WEBDATA_TOKEN_SERVICE_TABLE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "components/webdata/common/web_database_table.h" | 12 #include "components/webdata/common/web_database_table.h" |
13 | 13 |
14 class WebDatabase; | 14 class WebDatabase; |
15 | 15 |
16 class TokenServiceTable : public WebDatabaseTable { | 16 class TokenServiceTable : public WebDatabaseTable { |
17 public: | 17 public: |
18 TokenServiceTable() {} | 18 TokenServiceTable() {} |
19 virtual ~TokenServiceTable() {} | 19 ~TokenServiceTable() override {} |
20 | 20 |
21 // Retrieves the TokenServiceTable* owned by |database|. | 21 // Retrieves the TokenServiceTable* owned by |database|. |
22 static TokenServiceTable* FromWebDatabase(WebDatabase* db); | 22 static TokenServiceTable* FromWebDatabase(WebDatabase* db); |
23 | 23 |
24 virtual WebDatabaseTable::TypeKey GetTypeKey() const override; | 24 WebDatabaseTable::TypeKey GetTypeKey() const override; |
25 virtual bool CreateTablesIfNecessary() override; | 25 bool CreateTablesIfNecessary() override; |
26 virtual bool IsSyncable() override; | 26 bool IsSyncable() override; |
27 virtual bool MigrateToVersion(int version, | 27 bool MigrateToVersion(int version, bool* update_compatible_version) override; |
28 bool* update_compatible_version) override; | |
29 | 28 |
30 // Remove all tokens previously set with SetTokenForService. | 29 // Remove all tokens previously set with SetTokenForService. |
31 bool RemoveAllTokens(); | 30 bool RemoveAllTokens(); |
32 | 31 |
33 // Removes a token related to the service from the token_service table. | 32 // Removes a token related to the service from the token_service table. |
34 bool RemoveTokenForService(const std::string& service); | 33 bool RemoveTokenForService(const std::string& service); |
35 | 34 |
36 // Retrieves all tokens previously set with SetTokenForService. | 35 // Retrieves all tokens previously set with SetTokenForService. |
37 // Returns true if there were tokens and we decrypted them, | 36 // Returns true if there were tokens and we decrypted them, |
38 // false if there was a failure somehow | 37 // false if there was a failure somehow |
39 bool GetAllTokens(std::map<std::string, std::string>* tokens); | 38 bool GetAllTokens(std::map<std::string, std::string>* tokens); |
40 | 39 |
41 // Store a token in the token_service table. Stored encrypted. May cause | 40 // Store a token in the token_service table. Stored encrypted. May cause |
42 // a mac keychain popup. | 41 // a mac keychain popup. |
43 // True if we encrypted a token and stored it, false otherwise. | 42 // True if we encrypted a token and stored it, false otherwise. |
44 bool SetTokenForService(const std::string& service, | 43 bool SetTokenForService(const std::string& service, |
45 const std::string& token); | 44 const std::string& token); |
46 | 45 |
47 private: | 46 private: |
48 DISALLOW_COPY_AND_ASSIGN(TokenServiceTable); | 47 DISALLOW_COPY_AND_ASSIGN(TokenServiceTable); |
49 }; | 48 }; |
50 | 49 |
51 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_WEBDATA_TOKEN_SERVICE_TABLE_H_ | 50 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_WEBDATA_TOKEN_SERVICE_TABLE_H_ |
OLD | NEW |