1 // Copyright (c) 2013 Intel Corporation. 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 XWALK_APPLICATION_COMMON_DB_STORE_SQLITE_IMPL_H_
6 #define XWALK_APPLICATION_COMMON_DB_STORE_SQLITE_IMPL_H_
10 #include "base/files/file_path.h"
11 #include "sql/connection.h"
12 #include "sql/meta_table.h"
13 #include "xwalk/application/common/db_store.h"
16 namespace application {
18 // The Sqlite backend implementation of DBStore.
19 class DBStoreSqliteImpl: public DBStore {
21 static const base::FilePath::CharType kDBFileName[];
22 explicit DBStoreSqliteImpl(const base::FilePath& path);
23 virtual ~DBStoreSqliteImpl();
25 // Implement the DBStore inferface.
26 virtual bool Insert(const ApplicationData* application,
27 const base::Time install_time) OVERRIDE;
28 virtual bool Remove(const std::string& key) OVERRIDE;
29 virtual bool InitDB() OVERRIDE;
30 virtual void SetValue(const std::string& key, base::Value* value) OVERRIDE;
40 bool Commit(const std::string& id,
41 const std::string& column,
44 void ReportValueChanged(const std::string& key,
45 const base::Value* value);
46 bool UpgradeToVersion1(const base::FilePath& v0_file);
47 bool SetApplication(const std::string& id, base::Value* value);
48 bool UpdateApplication(const std::string& id, base::Value* value);
49 bool DeleteApplication(const std::string& id);
50 bool SetManifestValue(const std::string& id, base::Value* value);
51 bool SetInstallTimeValue(const std::string& id, base::Value* value);
52 bool SetApplicationPathValue(const std::string& id, base::Value* value);
54 bool SetEventsValue(const std::string& id,
56 const std::string& operation);
57 bool DeleteEventsValue(const std::string& id);
59 scoped_ptr<sql::Connection> sqlite_db_;
60 sql::MetaTable meta_table_;
64 } // namespace application
67 #endif // XWALK_APPLICATION_COMMON_DB_STORE_SQLITE_IMPL_H_