diff options
author | Yunchan Cho <yunchan.cho@samsung.com> | 2013-04-08 17:05:12 +0900 |
---|---|---|
committer | Yunchan Cho <yunchan.cho@samsung.com> | 2013-04-09 15:59:54 +0900 |
commit | 16b1e144dbae05e4df3b49867e5a40c15d9c242a (patch) | |
tree | 083e0aeaf278490057037cd2276d0fd1bc0a1ea7 | |
parent | f1a7a1150d662546cb9078ee623f821dccf6dbab (diff) | |
download | web-provider-16b1e144dbae05e4df3b49867e5a40c15d9c242a.tar.gz web-provider-16b1e144dbae05e4df3b49867e5a40c15d9c242a.tar.bz2 web-provider-16b1e144dbae05e4df3b49867e5a40c15d9c242a.zip |
[Release] livebox.web-provider-1.6
Change-Id: I2a677a5fbecd22c6439d73dcea2c2bdd3fbb3704
-rw-r--r-- | packaging/livebox.web-provider.spec | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | src/Core/BoxSchemeHandler.cpp | 30 | ||||
-rw-r--r-- | src/Core/BoxSchemeHandler.h | 1 | ||||
-rw-r--r-- | src/Core/Buffer/RenderBuffer.cpp | 6 | ||||
-rw-r--r-- | src/Core/Service/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/Core/Service/ScrollHolder.cpp | 42 | ||||
-rw-r--r-- | src/Core/Service/ScrollHolder.h | 29 | ||||
-rw-r--r-- | src/Core/View/InjectedScript.h | 8 |
8 files changed, 117 insertions, 3 deletions
diff --git a/packaging/livebox.web-provider.spec b/packaging/livebox.web-provider.spec index b062a2e..abc2bfe 100644 --- a/packaging/livebox.web-provider.spec +++ b/packaging/livebox.web-provider.spec @@ -1,6 +1,6 @@ Name: livebox.web-provider Summary: web framework for livebox -Version: 1.5 +Version: 1.6 Release: 1 Group: main/app License: Apache License, Version 2.0 diff --git a/src/Core/BoxSchemeHandler.cpp b/src/Core/BoxSchemeHandler.cpp index 56341d2..17a8ce7 100644..100755 --- a/src/Core/BoxSchemeHandler.cpp +++ b/src/Core/BoxSchemeHandler.cpp @@ -22,6 +22,7 @@ #include "Box.h" #include "Service/AppControl.h" #include "Service/PeriodChanger.h" +#include "Service/ScrollHolder.h" #include "Util/Log.h" #include "BoxSchemeHandler.h" @@ -29,6 +30,8 @@ static const std::string BOX_SCHEME("box://"); static const std::string BOX_SCHEME_RELOAD("box://reload"); static const std::string BOX_SCHEME_CHANGE_PERIOD("box://change-period"); static const std::string BOX_SCHEME_LAUNCH_BROWSER("box://launch-browser"); +static const std::string BOX_SCHEME_SCROLL_START("box://scroll-start"); +static const std::string BOX_SCHEME_SCROLL_STOP("box://scroll-stop"); static const std::string HTTP_SCHEME("http://"); static const std::string HTTPS_SCHEME("https://"); @@ -111,6 +114,14 @@ bool BoxSchemeHandler::process(std::string& instanceId, std::string& uri) return handleLaunchBrowser(instanceId, url); } + if (!uri.compare(BOX_SCHEME_SCROLL_START)) { + return handleScroll(instanceId, true); + } + + if (!uri.compare(BOX_SCHEME_SCROLL_STOP)) { + return handleScroll(instanceId, false); + } + LogD("unknown box scheme protocol"); return false; } @@ -138,6 +149,21 @@ Box* BoxSchemeHandler::getBox(std::string& instanceId) return NULL; } +bool BoxSchemeHandler::handleScroll(std::string& instanceId, bool start) +{ + using namespace Service::ScrollHolder; + + LogD("enter"); + Box* box = getBox(instanceId); + if (!box) { + LogD("unregistered instance"); + return false; + } + + holdHorizontalScroll(box->m_boxInfo->boxId, instanceId, start); + return true; +} + bool BoxSchemeHandler::handleReload(std::string& instanceId) { LogD("enter"); @@ -204,10 +230,10 @@ std::string BoxSchemeHandler::parse(std::string& uri, std::string& key) break; } - unsigned next = query.find_first_of("&", found + 1); + unsigned next = query.find_first_of("@", found + 1); if (!query.compare(found, key.size(), key)) { LogD("key matched!\n"); - value = std::string(query, seperator + 1, next - seperator); + value = std::string(query, seperator + 1, next - seperator - 1); break; } diff --git a/src/Core/BoxSchemeHandler.h b/src/Core/BoxSchemeHandler.h index 929abcd..fdeeb8a 100644 --- a/src/Core/BoxSchemeHandler.h +++ b/src/Core/BoxSchemeHandler.h @@ -44,6 +44,7 @@ class EXPORT_CLASS BoxSchemeHandler { bool handleReload(std::string& instanceId); bool handleChangePeriod(std::string& instanceId, float requestedPeriod = -1.0f); bool handleLaunchBrowser(std::string& instanceId, std::string& url); + bool handleScroll(std::string& instanceId, bool start); std::string parse(std::string& uri, std::string& key); BoxSchemeHandler(); diff --git a/src/Core/Buffer/RenderBuffer.cpp b/src/Core/Buffer/RenderBuffer.cpp index c8a31bb..7b5011f 100644 --- a/src/Core/Buffer/RenderBuffer.cpp +++ b/src/Core/Buffer/RenderBuffer.cpp @@ -229,8 +229,13 @@ Evas* RenderBuffer::getCanvas() void* RenderBuffer::allocateCallback(void* data, int size) { + LogD("enter"); RenderBuffer* buffer = static_cast<RenderBuffer*>(data); + if (buffer->m_bufferInfo) { + freeCallback(data, NULL); + } + buffer->m_bufferInfo = buffer->acquireBuffer(); if (!buffer->m_bufferInfo) { return NULL; @@ -257,6 +262,7 @@ void* RenderBuffer::allocateCallback(void* data, int size) void RenderBuffer::freeCallback(void* data, void *pix) { + LogD("enter"); RenderBuffer* buffer = static_cast<RenderBuffer*>(data); // destroy buffer diff --git a/src/Core/Service/CMakeLists.txt b/src/Core/Service/CMakeLists.txt index e1737b1..ec680e7 100644 --- a/src/Core/Service/CMakeLists.txt +++ b/src/Core/Service/CMakeLists.txt @@ -24,6 +24,7 @@ PKG_CHECK_MODULES(${DEPS} evas ecore-x elementary + provider REQUIRED ) ADD_DEFINITIONS(${${DEPS}_CFLAGS}) @@ -31,6 +32,7 @@ ADD_DEFINITIONS(${${DEPS}_CFLAGS}) SET(SRCS ${CMAKE_CURRENT_SOURCE_DIR}/AppControl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/PeriodChanger.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/ScrollHolder.cpp ) SET(HEADERS diff --git a/src/Core/Service/ScrollHolder.cpp b/src/Core/Service/ScrollHolder.cpp new file mode 100644 index 0000000..c366ab5 --- /dev/null +++ b/src/Core/Service/ScrollHolder.cpp @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file ScrollHolder.cpp + * @author Yunchan Cho (yunchan.cho@samsung.com) + */ + +#include <string> +#include <provider.h> +#include <Core/Util/Log.h> + +namespace Service { +namespace ScrollHolder { + +void holdHorizontalScroll(std::string& boxId, std::string& instanceId, bool start) +{ + LogD("enter"); + + if (start) { + LogD("scroll start"); + provider_send_hold_scroll(boxId.c_str(), instanceId.c_str(), 1); + } else { + LogD("scroll stop"); + provider_send_hold_scroll(boxId.c_str(), instanceId.c_str(), 0); + } +} + +} // AppControl +} // Service diff --git a/src/Core/Service/ScrollHolder.h b/src/Core/Service/ScrollHolder.h new file mode 100644 index 0000000..512d2f4 --- /dev/null +++ b/src/Core/Service/ScrollHolder.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file ScrollHolder.h + * @author Yunchan Cho (yunchan.cho@samsung.com) + */ + +#include <string> + +namespace Service { +namespace ScrollHolder { + +void holdHorizontalScroll(std::string& boxId, std::string& instanceId, bool start); + +} +} // Service diff --git a/src/Core/View/InjectedScript.h b/src/Core/View/InjectedScript.h index 267e411..4603f06 100644 --- a/src/Core/View/InjectedScript.h +++ b/src/Core/View/InjectedScript.h @@ -39,9 +39,17 @@ function launchBrowser(url) { \ window.location.href=\"box://launch-browser?url=\" + url; \ } \ + function scrollStart(){ \ + window.location.href=\"box://scroll-start\"; \ + } \ + function scrollStop(){ \ + window.location.href=\"box://scroll-stop\"; \ + } \ window.tizen = new Object(); \ window.tizen.appwidget = new Object(); \ window.tizen.appwidget.reload = reload; \ window.tizen.appwidget.changePeriod = changePeriod; \ window.tizen.appwidget.launchBrowser = launchBrowser; \ + window.tizen.appwidget.scrollStart = scrollStart; \ + window.tizen.appwidget.scrollStop = scrollStop; \ " |