blob: c994345495d163b2942de9d0904d4aa60830daad [file] [log] [blame]
// Copyright 2017 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.
#include <string>
#include <vector>
#include "base/macros.h"
#include "components/webdata/common/web_database_table.h"
class WebDatabase;
namespace payments {
// This class manages payment_method_manifest table in SQLite database. It
// expects the following schema.
// payment_method_manifest The table stores of the
// supported web app in this payment method manifest.
// Note that a payment method manifest might contain
// multiple supported web apps ids.
// expire_date The expire date in seconds from 1601-01-01 00:00:00
// UTC.
// method_name The method name.
// web_app_id The supported web app id.
// (
class PaymentMethodManifestTable : public WebDatabaseTable {
~PaymentMethodManifestTable() override;
// Retrieves the PaymentMethodManifestTable* owned by |db|.
static PaymentMethodManifestTable* FromWebDatabase(WebDatabase* db);
// WebDatabaseTable:
WebDatabaseTable::TypeKey GetTypeKey() const override;
bool CreateTablesIfNecessary() override;
bool IsSyncable() override;
bool MigrateToVersion(int version, bool* update_compatible_version) override;
// Remove expired data.
void RemoveExpiredData();
// Adds |payment_method|'s manifest. |web_app_ids| contains supported web apps
// ids.
bool AddManifest(const std::string& payment_method,
const std::vector<std::string>& web_app_ids);
// Gets manifest for |payment_method|. Return empty vector if no manifest
// exists for this method.
std::vector<std::string> GetManifest(const std::string& payment_method);
} // namespace payments