Upstream version 5.34.97.0
[platform/framework/web/crosswalk.git] / src / xwalk / extensions / common / xwalk_extension.cc
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 #include "xwalk/extensions/common/xwalk_extension.h"
6
7 #include <string.h>
8
9 #include "base/logging.h"
10
11 namespace xwalk {
12 namespace extensions {
13
14 bool XWalkExtension::PermissionsDelegate::CheckAPIAccessControl(
15     const std::string& extension_name, const std::string& api_name) {
16   return false;
17 }
18
19 bool XWalkExtension::PermissionsDelegate::RegisterPermissions(
20     const std::string& extension_name, const std::string& perm_table) {
21   return false;
22 }
23
24 XWalkExtension::XWalkExtension() : permissions_delegate_(NULL) {}
25
26 XWalkExtension::~XWalkExtension() {}
27
28 const base::ListValue& XWalkExtension::entry_points() const {
29   return entry_points_;
30 }
31
32 bool XWalkExtension::CheckAPIAccessControl(const char* api_name) const {
33   if (!permissions_delegate_)
34     return false;
35
36   return permissions_delegate_->CheckAPIAccessControl(name(), api_name);
37 }
38
39 bool XWalkExtension::RegisterPermissions(const char* perm_table) const {
40   if (!permissions_delegate_)
41     return false;
42
43   return permissions_delegate_->RegisterPermissions(name(), perm_table);
44 }
45
46 XWalkExtensionInstance::XWalkExtensionInstance() {}
47
48 XWalkExtensionInstance::~XWalkExtensionInstance() {}
49
50 void XWalkExtensionInstance::SetPostMessageCallback(
51     const PostMessageCallback& callback) {
52   post_message_ = callback;
53 }
54
55 void XWalkExtensionInstance::SetSendSyncReplyCallback(
56     const SendSyncReplyCallback& callback) {
57   send_sync_reply_ = callback;
58 }
59
60 void XWalkExtensionInstance::HandleSyncMessage(
61     scoped_ptr<base::Value> msg) {
62   LOG(FATAL) << "Sending sync message to extension which doesn't support it!";
63 }
64
65 }  // namespace extensions
66 }  // namespace xwalk