Upstream version 8.36.156.0
[platform/framework/web/crosswalk.git] / src / xwalk / application / browser / 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_BROWSER_APPLICATION_STORAGE_H_
6 #define XWALK_APPLICATION_BROWSER_APPLICATION_STORAGE_H_
7
8 #include <map>
9 #include <string>
10 #include <vector>
11
12 #include "base/memory/ref_counted.h"
13 #include "base/observer_list.h"
14 #include "xwalk/application/common/application_data.h"
15
16 namespace xwalk {
17 namespace application {
18
19 class ApplicationStorage {
20  public:
21   explicit ApplicationStorage(const base::FilePath& path);
22   ~ApplicationStorage();
23
24   bool AddApplication(scoped_refptr<ApplicationData> app_data);
25
26   bool RemoveApplication(const std::string& id);
27
28   bool UpdateApplication(scoped_refptr<ApplicationData> app_data);
29
30   bool Contains(const std::string& app_id) const;
31
32   scoped_refptr<ApplicationData> GetApplicationData(
33       const std::string& application_id) const;
34
35   const ApplicationData::ApplicationDataMap& GetInstalledApplications() const;
36
37  private:
38   bool Insert(scoped_refptr<ApplicationData> app_data);
39   base::FilePath data_path_;
40   scoped_ptr<class ApplicationStorageImpl> impl_;
41   ApplicationData::ApplicationDataMap applications_;
42   DISALLOW_COPY_AND_ASSIGN(ApplicationStorage);
43 };
44
45 }  // namespace application
46 }  // namespace xwalk
47
48 #endif  // XWALK_APPLICATION_BROWSER_APPLICATION_STORAGE_H_