OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_WEBDATA_TOKEN_SERVICE_TABLE_H_ | 5 #ifndef CHROME_BROWSER_WEBDATA_TOKEN_SERVICE_TABLE_H_ |
6 #define CHROME_BROWSER_WEBDATA_TOKEN_SERVICE_TABLE_H_ | 6 #define CHROME_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 "chrome/browser/webdata/web_database_table.h" | 12 #include "chrome/browser/webdata/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 virtual ~TokenServiceTable() {} |
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 virtual WebDatabaseTable::TypeKey GetTypeKey() const OVERRIDE; |
25 virtual bool Init(sql::Connection* db, sql::MetaTable* meta_table) OVERRIDE; | 25 virtual bool Init(sql::Connection* db, sql::MetaTable* meta_table) OVERRIDE; |
26 virtual bool IsSyncable() OVERRIDE; | 26 virtual bool IsSyncable() OVERRIDE; |
27 virtual bool MigrateToVersion(int version, | 27 virtual bool MigrateToVersion(int version, |
28 const std::string& app_locale, | |
29 bool* update_compatible_version) OVERRIDE; | 28 bool* update_compatible_version) OVERRIDE; |
30 | 29 |
31 // Remove all tokens previously set with SetTokenForService. | 30 // Remove all tokens previously set with SetTokenForService. |
32 bool RemoveAllTokens(); | 31 bool RemoveAllTokens(); |
33 | 32 |
34 // Retrieves all tokens previously set with SetTokenForService. | 33 // Retrieves all tokens previously set with SetTokenForService. |
35 // Returns true if there were tokens and we decrypted them, | 34 // Returns true if there were tokens and we decrypted them, |
36 // false if there was a failure somehow | 35 // false if there was a failure somehow |
37 bool GetAllTokens(std::map<std::string, std::string>* tokens); | 36 bool GetAllTokens(std::map<std::string, std::string>* tokens); |
38 | 37 |
39 // Store a token in the token_service table. Stored encrypted. May cause | 38 // Store a token in the token_service table. Stored encrypted. May cause |
40 // a mac keychain popup. | 39 // a mac keychain popup. |
41 // True if we encrypted a token and stored it, false otherwise. | 40 // True if we encrypted a token and stored it, false otherwise. |
42 bool SetTokenForService(const std::string& service, | 41 bool SetTokenForService(const std::string& service, |
43 const std::string& token); | 42 const std::string& token); |
44 | 43 |
45 private: | 44 private: |
46 DISALLOW_COPY_AND_ASSIGN(TokenServiceTable); | 45 DISALLOW_COPY_AND_ASSIGN(TokenServiceTable); |
47 }; | 46 }; |
48 | 47 |
49 #endif // CHROME_BROWSER_WEBDATA_TOKEN_SERVICE_TABLE_H_ | 48 #endif // CHROME_BROWSER_WEBDATA_TOKEN_SERVICE_TABLE_H_ |
OLD | NEW |