2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 * @author Bartlomiej Grzelewski
20 #include <dpl/log/log.h>
21 #include <commons/JSCallbackManager.h>
23 #include "FeatureManager.h"
25 using namespace WrtPlugins::Api;
27 namespace WrtPlugins {
29 //static void wrtPlatformCallback(int widgetHandler, JSObjectRef object, void* userParam)
31 // FeatureManager::platformCallback(widgetHandler, static_cast<void*>(object), userParam);
34 void FeatureManager::OnRequestReceived(const Api::EventLoadFeaturePtr &event)
37 //EventWrapper *eventWrapper = new EventWrapper(this, event);
38 LogDebug("Call for dynamic feature: " << event->getFeature().c_str());
39 JSCallbackManagerPtr jsCallbackManager =
40 DPL::StaticPointerCast<JSCallbackManager,
41 Platform::IEventPrivateData>(
42 event->getPrivateData());
43 /* TODO uncomment - this function _will_ be available in new wrt-engine API */
44 LogError("*** CRITICAL wrt_dynamic_feature_request is disable!");
45 // wrt_dynamic_feature_request(jsCallbackManager->getContext(), event->getFeature().c_str(), wrtPlatformCallback, eventWrapper);
48 void FeatureManager::platformCallback(int,
53 LogError("Request has been rejected.");
55 LogDebug("Request has been approved.");
57 EventWrapper *eventWrapper = static_cast<EventWrapper*>(userParam);
58 eventWrapper->m_event->setObject(object);
59 eventWrapper->m_event->setStatus((object == 0) ? false : true);
60 eventWrapper->m_featureManager->Platform::EventRequestReceiver<
61 EventLoadFeature>::ManualAnswer(eventWrapper->m_event);
64 } // namespace Platform
65 } // namespace WrtPlugins