Upstream version 8.36.161.0
[platform/framework/web/crosswalk.git] / src / xwalk / application / common / application_storage.h
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.
4
5 #ifndef XWALK_APPLICATION_COMMON_APPLICATION_STORAGE_H_
6 #define XWALK_APPLICATION_COMMON_APPLICATION_STORAGE_H_
7
8 #include <map>
9 #include <string>
10 #include <vector>
11
12 #include "base/memory/ref_counted.h"
13 #include "xwalk/application/common/application_data.h"
14
15 namespace xwalk {
16 namespace application {
17
18 class ApplicationStorage {
19  public:
20   explicit ApplicationStorage(const base::FilePath& path);
21   ~ApplicationStorage();
22
23   bool AddApplication(scoped_refptr<ApplicationData> app_data);
24
25   bool RemoveApplication(const std::string& app_id);
26
27   bool UpdateApplication(scoped_refptr<ApplicationData> app_data);
28
29   bool Contains(const std::string& app_id) const;
30
31   scoped_refptr<ApplicationData> GetApplicationData(
32       const std::string& app_id) const;
33   // Note: Do not use this method! It is too heavy and it will be
34   // removed.
35   bool GetInstalledApplications(
36       ApplicationData::ApplicationDataMap& apps) const;  // NOLINT
37
38   bool GetInstalledApplicationIDs(
39       std::vector<std::string>& app_ids) const;  // NOLINT
40
41  private:
42   scoped_ptr<class ApplicationStorageImpl> impl_;
43   DISALLOW_COPY_AND_ASSIGN(ApplicationStorage);
44 };
45
46 }  // namespace application
47 }  // namespace xwalk
48
49 #endif  // XWALK_APPLICATION_COMMON_APPLICATION_STORAGE_H_