• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 // found in the LICENSE file.
4 
5 #ifndef CHROME_BROWSER_WEBDATA_TOKEN_SERVICE_TABLE_H_
6 #define CHROME_BROWSER_WEBDATA_TOKEN_SERVICE_TABLE_H_
7 #pragma once
8 
9 #include "chrome/browser/webdata/web_database_table.h"
10 
11 class TokenServiceTable : public WebDatabaseTable {
12  public:
TokenServiceTable(sql::Connection * db,sql::MetaTable * meta_table)13   TokenServiceTable(sql::Connection* db, sql::MetaTable* meta_table)
14       : WebDatabaseTable(db, meta_table) {}
~TokenServiceTable()15   virtual ~TokenServiceTable() {}
16   virtual bool Init();
17   virtual bool IsSyncable();
18 
19   // Remove all tokens previously set with SetTokenForService.
20   bool RemoveAllTokens();
21 
22   // Retrieves all tokens previously set with SetTokenForService.
23   // Returns true if there were tokens and we decrypted them,
24   // false if there was a failure somehow
25   bool GetAllTokens(std::map<std::string, std::string>* tokens);
26 
27   // Store a token in the token_service table. Stored encrypted. May cause
28   // a mac keychain popup.
29   // True if we encrypted a token and stored it, false otherwise.
30   bool SetTokenForService(const std::string& service,
31                           const std::string& token);
32 
33  private:
34   DISALLOW_COPY_AND_ASSIGN(TokenServiceTable);
35 };
36 
37 
38 #endif  // CHROME_BROWSER_WEBDATA_TOKEN_SERVICE_TABLE_H_
39