summaryrefslogtreecommitdiffstats
path: root/chrome/browser/webdata/token_service_table.h
blob: a9ad849a62812b0b9512585a9258e8919faac817 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_WEBDATA_TOKEN_SERVICE_TABLE_H_
#define CHROME_BROWSER_WEBDATA_TOKEN_SERVICE_TABLE_H_
#pragma once

#include <map>
#include <string>

#include "base/compiler_specific.h"
#include "chrome/browser/webdata/web_database_table.h"

class TokenServiceTable : public WebDatabaseTable {
 public:
  TokenServiceTable(sql::Connection* db, sql::MetaTable* meta_table)
      : WebDatabaseTable(db, meta_table) {}
  virtual ~TokenServiceTable() {}
  virtual bool Init() OVERRIDE;
  virtual bool IsSyncable() OVERRIDE;

  // Remove all tokens previously set with SetTokenForService.
  bool RemoveAllTokens();

  // Retrieves all tokens previously set with SetTokenForService.
  // Returns true if there were tokens and we decrypted them,
  // false if there was a failure somehow
  bool GetAllTokens(std::map<std::string, std::string>* tokens);

  // Store a token in the token_service table. Stored encrypted. May cause
  // a mac keychain popup.
  // True if we encrypted a token and stored it, false otherwise.
  bool SetTokenForService(const std::string& service,
                          const std::string& token);

 private:
  DISALLOW_COPY_AND_ASSIGN(TokenServiceTable);
};

#endif  // CHROME_BROWSER_WEBDATA_TOKEN_SERVICE_TABLE_H_