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*
32 // FeatureManager::platformCallback(widgetHandler,
33 // static_cast<void*>(object), userParam);
36 void FeatureManager::OnRequestReceived(const Api::EventLoadFeaturePtr &event)
39 //EventWrapper *eventWrapper = new EventWrapper(this, event);
40 LogDebug("Call for dynamic feature: " << event->getFeature().c_str());
41 JSCallbackManagerPtr jsCallbackManager =
42 DPL::StaticPointerCast<JSCallbackManager,
43 Platform::IEventPrivateData>(
44 event->getPrivateData());
45 /* TODO uncomment - this function _will_ be available in new wrt-engine API
47 LogError("*** CRITICAL wrt_dynamic_feature_request is disable!");
48 // wrt_dynamic_feature_request(jsCallbackManager->getContext(),
49 // event->getFeature().c_str(), wrtPlatformCallback, eventWrapper);
52 void FeatureManager::platformCallback(int,
57 LogError("Request has been rejected.");
59 LogDebug("Request has been approved.");
61 EventWrapper *eventWrapper = static_cast<EventWrapper*>(userParam);
62 eventWrapper->m_event->setObject(object);
63 eventWrapper->m_event->setStatus((object == 0) ? false : true);
64 eventWrapper->m_featureManager->Platform::EventRequestReceiver<
65 EventLoadFeature>::ManualAnswer(eventWrapper->m_event);
68 } // namespace Platform
69 } // namespace WrtPlugins