84e271a7d5d601bb44fcfa61df3137d4d58d543f
[platform/framework/web/crosswalk.git] / src / xwalk / runtime / browser / xwalk_app_extension_bridge.h
1 // Copyright (c) 2014 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_RUNTIME_BROWSER_XWALK_APP_EXTENSION_BRIDGE_H_
6 #define XWALK_RUNTIME_BROWSER_XWALK_APP_EXTENSION_BRIDGE_H_
7
8 #include <string>
9
10 #include "xwalk/application/browser/application_system.h"
11 #include "xwalk/extensions/browser/xwalk_extension_service.h"
12 #include "xwalk/extensions/common/xwalk_extension_permission_types.h"
13
14 namespace xwalk {
15
16 // The class is the main interface for co-operations between the two major
17 // xwalk components -- the application subsystem and the extension subsystem.
18 // Because of the dependency requirements two components cound not include
19 // each other's header, and we also would not like to fill the xwalk_runner
20 // with delegates, so this class is the place where all the communications
21 // between application and extension takes place, just like a 'bridge'.
22 // The class instance will be owned by xwalk_runner.
23 class XWalkAppExtensionBridge
24     : public extensions::XWalkExtensionService::Delegate {
25  public:
26   XWalkAppExtensionBridge();
27   virtual ~XWalkAppExtensionBridge();
28
29   void SetApplicationSystem(application::ApplicationSystem* app_system) {
30     app_system_ = app_system;
31   }
32   // XWalkExtensionService::Delegate implementation
33   virtual void CheckAPIAccessControl(const std::string& extension_name,
34       const std::string& api_name,
35       const extensions::PermissionCallback& callback) OVERRIDE;
36   virtual bool RegisterPermissions(const std::string& extension_name,
37       const std::string& perm_table) OVERRIDE;
38
39  private:
40   application::ApplicationSystem* app_system_;
41
42   DISALLOW_COPY_AND_ASSIGN(XWalkAppExtensionBridge);
43 };
44
45 }  // namespace xwalk
46
47 #endif  // XWALK_RUNTIME_BROWSER_XWALK_APP_EXTENSION_BRIDGE_H_