| 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 TokenServiceTable : public WebDatabaseTable { | 14 class TokenServiceTable : public WebDatabaseTable { |
| 15 public: | 15 public: |
| 16 TokenServiceTable(sql::Connection* db, sql::MetaTable* meta_table) | 16 TokenServiceTable(sql::Connection* db, sql::MetaTable* meta_table) |
| 17 : WebDatabaseTable(db, meta_table) {} | 17 : WebDatabaseTable(db, meta_table) {} |
| 18 virtual ~TokenServiceTable() {} | 18 virtual ~TokenServiceTable() {} |
| 19 virtual bool Init() OVERRIDE; | 19 virtual bool Init() OVERRIDE; |
| 20 virtual bool IsSyncable() OVERRIDE; | 20 virtual bool IsSyncable() OVERRIDE; |
| 21 virtual bool MigrateToVersion(int version, |
| 22 const std::string& app_locale, |
| 23 bool* update_compatible_version) OVERRIDE; |
| 21 | 24 |
| 22 // Remove all tokens previously set with SetTokenForService. | 25 // Remove all tokens previously set with SetTokenForService. |
| 23 bool RemoveAllTokens(); | 26 bool RemoveAllTokens(); |
| 24 | 27 |
| 25 // Retrieves all tokens previously set with SetTokenForService. | 28 // Retrieves all tokens previously set with SetTokenForService. |
| 26 // Returns true if there were tokens and we decrypted them, | 29 // Returns true if there were tokens and we decrypted them, |
| 27 // false if there was a failure somehow | 30 // false if there was a failure somehow |
| 28 bool GetAllTokens(std::map<std::string, std::string>* tokens); | 31 bool GetAllTokens(std::map<std::string, std::string>* tokens); |
| 29 | 32 |
| 30 // Store a token in the token_service table. Stored encrypted. May cause | 33 // Store a token in the token_service table. Stored encrypted. May cause |
| 31 // a mac keychain popup. | 34 // a mac keychain popup. |
| 32 // True if we encrypted a token and stored it, false otherwise. | 35 // True if we encrypted a token and stored it, false otherwise. |
| 33 bool SetTokenForService(const std::string& service, | 36 bool SetTokenForService(const std::string& service, |
| 34 const std::string& token); | 37 const std::string& token); |
| 35 | 38 |
| 36 private: | 39 private: |
| 37 DISALLOW_COPY_AND_ASSIGN(TokenServiceTable); | 40 DISALLOW_COPY_AND_ASSIGN(TokenServiceTable); |
| 38 }; | 41 }; |
| 39 | 42 |
| 40 #endif // CHROME_BROWSER_WEBDATA_TOKEN_SERVICE_TABLE_H_ | 43 #endif // CHROME_BROWSER_WEBDATA_TOKEN_SERVICE_TABLE_H_ |
| OLD | NEW |