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.
5 #ifndef XWALK_RUNTIME_BROWSER_XWALK_APP_EXTENSION_BRIDGE_H_
6 #define XWALK_RUNTIME_BROWSER_XWALK_APP_EXTENSION_BRIDGE_H_
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"
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 {
26 XWalkAppExtensionBridge();
27 virtual ~XWalkAppExtensionBridge();
29 void SetApplicationSystem(application::ApplicationSystem* app_system) {
30 app_system_ = app_system;
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;
40 application::ApplicationSystem* app_system_;
42 DISALLOW_COPY_AND_ASSIGN(XWalkAppExtensionBridge);
47 #endif // XWALK_RUNTIME_BROWSER_XWALK_APP_EXTENSION_BRIDGE_H_