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