diff options
author | Junghwan <junghwan.kang@samsung.com> | 2012-09-04 15:04:27 +0900 |
---|---|---|
committer | Junghwan <junghwan.kang@samsung.com> | 2012-09-04 15:06:52 +0900 |
commit | 695063683e3f8dd6f4b554365a40043f97fe0c3b (patch) | |
tree | 149db2726f53afe942a3eb858b8f1fccf675f02b | |
parent | 7465c5cabbb87b17833fc103d79d15e6ad000ee8 (diff) | |
download | browser-695063683e3f8dd6f4b554365a40043f97fe0c3b.tar.gz browser-695063683e3f8dd6f4b554365a40043f97fe0c3b.tar.bz2 browser-695063683e3f8dd6f4b554365a40043f97fe0c3b.zip |
Remove function of meta tag
[Title] Remove function of meta tag
[Issue#] N/A
[Problem] N/A
[Cause] N/A
[Solution] Remove function of meta tag
[Team] Browser UI
[Developer] Junghwan kang
[Request] N/A
Change-Id: Ib6e91c35b70566a75672128906ac2c63d86eba0b
-rwxr-xr-x | CMakeLists.txt | 7 | ||||
-rwxr-xr-x[-rw-r--r--] | src/browser-class.cpp | 10 | ||||
-rwxr-xr-x | src/browser-extension/browser-meta-tag.cpp | 302 | ||||
-rwxr-xr-x | src/browser-extension/browser-meta-tag.h | 58 | ||||
-rwxr-xr-x | src/browser-view/browser-view.cpp | 54 | ||||
-rwxr-xr-x | src/browser-view/browser-view.h | 15 |
6 files changed, 1 insertions, 445 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c41069f..f25baa82 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,13 +84,6 @@ FIND_LIBRARY(LIB_GNUTLS gnutls) FOREACH(flag ${pkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") ENDFOREACH(flag) -SET (USE_META_TAG ON) -IF (USE_META_TAG) - ADD_DEFINITIONS("-DUSE_META_TAG") - LIST(APPEND SRCS - src/browser-extension/browser-meta-tag.cpp - ) -ENDIF () # set extra defines SET(PREFIX ${CMAKE_INSTALL_PREFIX}) diff --git a/src/browser-class.cpp b/src/browser-class.cpp index c05ddace..00e0b25e 100644..100755 --- a/src/browser-class.cpp +++ b/src/browser-class.cpp @@ -19,9 +19,6 @@ #include "browser-context-menu.h" #include "browser-find-word.h" #include "browser-geolocation.h" -#ifdef USE_META_TAG -#include "browser-meta-tag.h" -#endif #include "browser-multi-window-view.h" #include "browser-network-manager.h" #include "browser-user-agent-db.h" @@ -382,10 +379,6 @@ void Browser_Class::ewk_view_deinit(Evas_Object *ewk_view) Browser_Geolocation::__geolocation_permission_request_cb); m_download_policy->deinit(); m_browser_view->m_context_menu->deinit(); -#ifdef USE_META_TAG - m_browser_view->m_meta_tag->deinit(); -#endif - m_browser_view->suspend_ewk_view(ewk_view); } @@ -437,9 +430,6 @@ void Browser_Class::ewk_view_init(Evas_Object *ewk_view) m_download_policy->init(ewk_view); m_browser_view->m_context_menu->init(ewk_view); -#ifdef USE_META_TAG - m_browser_view->m_meta_tag->init(ewk_view); -#endif m_geolocation->init(ewk_view); m_browser_view->resume_ewk_view(ewk_view); } diff --git a/src/browser-extension/browser-meta-tag.cpp b/src/browser-extension/browser-meta-tag.cpp deleted file mode 100755 index 03360689..00000000 --- a/src/browser-extension/browser-meta-tag.cpp +++ /dev/null @@ -1,302 +0,0 @@ -/* - * Copyright 2012 Samsung Electronics Co., Ltd - * - * Licensed under the Flora License, Version 1.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.tizenopensource.org/license - * - * 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. - * - */ - - -#include "browser-class.h" -#include "browser-meta-tag.h" - -#include <fcntl.h> -#include <libsoup/soup.h> -#include <package-manager.h> - -#define TIME_STAMP_MAX_LENGTH 255 -#define XML_RAW_DATA_MAX_SIZE 4096 -#define PATH_CONFIGURE_SAMPLE_XML "/opt/apps/org.tizen.browser/data/config_sample.xml" -#define PATH_CONFIGURE_XML "/opt/apps/org.tizen.browser/data/config.xml" -#define PATH_ICON_PNG "/opt/apps/org.tizen.browser/data/icon.png" - -Browser_Meta_Tag::Browser_Meta_Tag(void) -: - m_ewk_view(NULL) -{ - BROWSER_LOGD("[%s]", __func__); -} - -Browser_Meta_Tag::~Browser_Meta_Tag(void) -{ - BROWSER_LOGD("[%s]", __func__); -} - -Eina_Bool Browser_Meta_Tag::init(Evas_Object *ewk_view) -{ - BROWSER_LOGD("[%s]", __func__); - - deinit(); - - m_ewk_view = ewk_view; - - m_xml_path = std::string(PATH_CONFIGURE_XML); - m_icon_path = std::string(PATH_ICON_PNG); - - remove_config_xml(m_xml_path.c_str()); - - evas_object_smart_callback_add(m_ewk_view, "webapp,metatag,standalone", __webapp_metatag_standalone_cb, this); - - return EINA_TRUE; -} - -void Browser_Meta_Tag::deinit() -{ - evas_object_smart_callback_del(m_ewk_view, "webapp,metatag,standalone", __webapp_metatag_standalone_cb); -} - -Eina_Bool Browser_Meta_Tag::create_config_xml(const char *url, const char *title, const char *xml_path_attempt) -{ - BROWSER_LOGD("[%s]", __func__); - - char *xml_data = NULL; - FILE *file_read = NULL; - FILE *file_write = NULL; - long xml_data_size = 0; - long xml_extra_data_size = 0; - - /* Read raw data from default config_sample.xml */ - file_read = fopen(PATH_CONFIGURE_SAMPLE_XML, "r"); - - if (!file_read) { - BROWSER_LOGE("failed to open config_sample.xml"); - return EINA_FALSE; - } - - fseek(file_read, 0, SEEK_END); - xml_data_size = ftell(file_read); - rewind(file_read); - - xml_extra_data_size = strlen(url) + strlen(title); - xml_data = (char *)malloc(sizeof(char) * (xml_data_size + xml_extra_data_size)); - - if (!xml_data) { - BROWSER_LOGE("Failed to allocate memory to read files"); - fclose(file_read); - return EINA_FALSE; - } - memset(xml_data, 0x00, (xml_data_size + xml_extra_data_size)); - - size_t result = fread(xml_data, sizeof(char), (xml_data_size + xml_extra_data_size), file_read); - fclose(file_read); - - if (result != xml_data_size) { - BROWSER_LOGD("Reading error\n, result[%d]", result); - free (xml_data); - xml_data = NULL; - return EINA_FALSE; - } - - /* write xml raw data as config.xml */ - if (xml_path_attempt && strlen(xml_path_attempt) > 0) { - m_xml_path = std::string(xml_path_attempt); - } - - BROWSER_LOGD("m_xml_path[%s]", m_xml_path.c_str()); - - char *markup_converted_url = elm_entry_utf8_to_markup(url); - - if(!markup_converted_url) { - BROWSER_LOGE("failed to convert url to markup"); - return EINA_FALSE; - } - std::string url_string = std::string(markup_converted_url); - BROWSER_LOGD("url_string[%s]", url_string.c_str()); - free(markup_converted_url); - - double time_stamp = ecore_loop_time_get(); - char time_stamp_string[TIME_STAMP_MAX_LENGTH] = {0, }; - snprintf(time_stamp_string, TIME_STAMP_MAX_LENGTH, "%lf", time_stamp); - - std::string title_string = std::string(title); - std::string id_string = url_string + std::string("/") + std::string(time_stamp_string); - std::string::size_type pos = std::string::npos; - m_xml_law_data = std::string(xml_data); - BROWSER_LOGD("id_string[%s]", id_string.c_str()); - free(xml_data); - xml_data = NULL; - - while ((pos = m_xml_law_data.find("id_need")) != std::string::npos) - m_xml_law_data.replace(pos, strlen("id_need"), id_string); - - while ((pos = m_xml_law_data.find("url_need")) != std::string::npos) - m_xml_law_data.replace(pos, strlen("url_need"), url_string); - - while ((pos = m_xml_law_data.find("title_need")) != std::string::npos) - m_xml_law_data.replace(pos, strlen("title_need"), title_string); - - BROWSER_LOGD("xml_raw_data - changed[%s]", m_xml_law_data.c_str()); - - file_write = fopen(m_xml_path.c_str(), "w"); - - if (!file_write) { - BROWSER_LOGD("fopen failed", __func__); - return EINA_FALSE; - } else { - BROWSER_LOGD("fopen success"); - } - - fwrite(m_xml_law_data.c_str(), sizeof(char), m_xml_law_data.length(), file_write); - fclose(file_write); - - return EINA_TRUE; -} - -Eina_Bool Browser_Meta_Tag::remove_config_xml(const char *xml_path_attempt) -{ - if (xml_path_attempt && strlen(xml_path_attempt) > 0) - m_xml_path = std::string(xml_path_attempt); - - BROWSER_LOGD("xml_path[%s]", m_xml_path.c_str()); - - if (unlink(m_xml_path.c_str()) == -1) { - BROWSER_LOGE("Failed to remove config.xml in the path"); - return EINA_FALSE; - } - - return EINA_TRUE; -} -/* junghwankang_Native_APIs */ -Eina_Bool Browser_Meta_Tag::request_download_icon(const char *url) -{ - BROWSER_LOGD("[%s], request url[%s]", __func__, url); - SoupSession *soup_session = NULL; - SoupMessage *soup_msg = NULL; - SoupMessageHeaders *headers = NULL; - - soup_session = soup_session_async_new(); - g_object_set(soup_session, SOUP_SESSION_TIMEOUT, 15, NULL); - soup_msg = soup_message_new("GET", url); - - BROWSER_LOGD("request url[%s]", url); - headers = soup_msg->request_headers; - - soup_session_queue_message(soup_session, soup_msg, __download_icon_finished_cb, (void *)this); -} - -void Browser_Meta_Tag::__download_icon_finished_cb(SoupSession *session, SoupMessage *msg, gpointer data) -{ - BROWSER_LOGD("[%s]", __func__); - if (!data) - return; - - Browser_Meta_Tag *browser_meta_tag = NULL; - browser_meta_tag = (Browser_Meta_Tag *)data; - - SoupBuffer *body = soup_message_body_flatten(msg->response_body); - - int fd; - int write_len = 0; - browser_meta_tag->icon_remove(browser_meta_tag->m_icon_path.c_str()); - - if (!body->data || body->length <= 0) { - soup_buffer_free(body); - return; - } - if ((fd = open((browser_meta_tag->m_icon_path.c_str()), O_CREAT | O_WRONLY, S_IRUSR|S_IWUSR | S_IRGRP | S_IROTH)) < 0) { - soup_buffer_free(body); - return; - } - - write_len = write(fd, body->data, body->length); - close(fd); - - soup_buffer_free(body); - - if (write_len != body->length) { - browser_meta_tag->icon_remove((browser_meta_tag->m_icon_path.c_str())); - return; - } - - /* send pkgmgr the wgt file */ - browser_meta_tag->wgt_install(NULL); -} - -Eina_Bool Browser_Meta_Tag::icon_remove(const char *icon_path_attempt) -{ - if (icon_path_attempt && strlen(icon_path_attempt) > 0) - m_icon_path = std::string(icon_path_attempt); - - BROWSER_LOGD("m_icon_path[%s]", m_icon_path.c_str()); - - if (unlink(m_icon_path.c_str()) == -1) { - BROWSER_LOGE("Failed to remove icon.png in the path"); - return EINA_FALSE; - } - - return EINA_TRUE; -} - -Eina_Bool Browser_Meta_Tag::zip(const char *file_path_for_xml, const char* file_path_for_icon, const char* file_path_for_zipped_data) -{ - BROWSER_LOGD("[%s]", __func__); -} - -Eina_Bool Browser_Meta_Tag::unzip(const char *file_path_for_zipped_data) -{ - BROWSER_LOGD("[%s]", __func__); -} - -Eina_Bool Browser_Meta_Tag::wgt_install(const char *file_path) -{ - BROWSER_LOGD("[%s]", __func__); - - std::string wgt_file_path; - - if (file_path && strlen(file_path) > 0) - wgt_file_path = std::string(file_path); - else - wgt_file_path = std::string("/opt/apps/org.tizen.browser/data/config.xml"); - - BROWSER_LOGD("wgt_file_path[%s]", wgt_file_path.c_str()); - - pkgmgr_client *pc = pkgmgr_client_new(PC_REQUEST); - - if (!pc) - BROWSER_LOGD("pkgmgr_client_new is failed"); - - pkgmgr_client_install(pc, "wgt", NULL, wgt_file_path.c_str(), NULL, PM_QUIET, __wgt_install_ret_cb, this); - pkgmgr_client_free(pc); -} - -int Browser_Meta_Tag::__wgt_install_ret_cb(int req_id, const char *pkg_type, const char *pkg_name, const char *key, - const char *val, const void *pmsg, void *data) -{ - BROWSER_LOGD("[%s]", __func__); - - Browser_Meta_Tag *browser_meta_tag = NULL; - browser_meta_tag = (Browser_Meta_Tag *)data; - - browser_meta_tag->remove_config_xml(NULL); - unlink((browser_meta_tag->m_icon_path).c_str()); -} - -void Browser_Meta_Tag::__webapp_metatag_standalone_cb(void *data, Evas_Object *obj, void *event_info) -{ - BROWSER_LOGD("[%s]", __func__); - - if (!data) { - BROWSER_LOGE("__webapp_metatag_standalone_cb - data is null"); - return; - } -} - diff --git a/src/browser-extension/browser-meta-tag.h b/src/browser-extension/browser-meta-tag.h deleted file mode 100755 index 49f0d098..00000000 --- a/src/browser-extension/browser-meta-tag.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2012 Samsung Electronics Co., Ltd - * - * Licensed under the Flora License, Version 1.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.tizenopensource.org/license - * - * 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. - * - */ - - -#ifndef BROWSER_META_TAG_H -#define BROWSER_META_TAG_H - -#include <sstream> -#include <stdio.h> -#include <string> -#include <vector> -#include <zlib.h> - -#include "browser-config.h" -#include "browser-view.h" - -class Browser_Meta_Tag { -public: - Browser_Meta_Tag(void); - ~Browser_Meta_Tag(void); - Eina_Bool init(Evas_Object *ewk_view); - void deinit(void); - - Eina_Bool create_config_xml(const char *url, const char *title, const char *xml_path_attempt); - Eina_Bool remove_config_xml(const char *xml_path_attempt); - Eina_Bool request_download_icon(const char *url); - Eina_Bool icon_remove(const char *icon_path_attempt); - Eina_Bool wgt_install(const char *file_path); -private: - Eina_Bool zip(const char *file_path_for_xml, const char* file_path_for_icon, const char* file_path_for_zipped_data); - Eina_Bool unzip(const char *file_path_for_zipped_data); - - static void __download_icon_finished_cb(SoupSession *session, SoupMessage *msg, gpointer data); - static void __webapp_metatag_standalone_cb(void *data, Evas_Object *obj, void *event_info); - static int __wgt_install_ret_cb(int req_id, const char *pkg_type,const char *pkg_name, const char *key, - const char *val, const void *pmsg, void *data); - std::string m_xml_path; - std::string m_xml_law_data; - std::string m_icon_path; - - Evas_Object *m_ewk_view; -}; - -#endif diff --git a/src/browser-view/browser-view.cpp b/src/browser-view/browser-view.cpp index ac81d56f..9489ba0d 100755 --- a/src/browser-view/browser-view.cpp +++ b/src/browser-view/browser-view.cpp @@ -90,9 +90,6 @@ Browser_View::Browser_View(Evas_Object *win, Evas_Object *navi_bar, Evas_Object ,m_find_word(NULL) ,m_scissorbox_view(NULL) ,m_share_controlbar_button(NULL) -#ifdef USE_META_TAG - ,m_meta_tag(NULL) -#endif ,m_context_menu(NULL) ,m_multi_window_button(NULL) ,m_new_window_button(NULL) @@ -181,12 +178,6 @@ Browser_View::~Browser_View() m_multi_window_rotate_timer = NULL; } #endif -#ifdef USE_META_TAG - if (m_meta_tag) { - delete m_meta_tag; - m_meta_tag = NULL; - } -#endif #ifdef ZOOM_BUTTON if (m_zoom_in_button) evas_object_del(m_zoom_in_button); @@ -242,13 +233,7 @@ Eina_Bool Browser_View::init(void) BROWSER_LOGE("new Browser_Context_Menu failed"); return EINA_FALSE; } -#ifdef USE_META_TAG - m_meta_tag = new(nothrow) Browser_Meta_Tag(); - if (!m_meta_tag) { - BROWSER_LOGE("new Browser_Meta_Tag failed"); - return EINA_FALSE; - } -#endif + UG_INIT_EFL(m_win, UG_OPT_INDICATOR_ENABLE); char *last_url = NULL; @@ -1934,43 +1919,6 @@ void Browser_View::__forward_cb(void *data, Evas_Object *obj, void *event_info) ewk_view_forward(browser_view->m_focused_window->m_ewk_view); } -#ifdef USE_META_TAG -void Browser_View::__web_app_capable_get_cb(Eina_Bool capable, void* user_data) -{ - BROWSER_LOGD("[%s]", __func__); - - if (!user_data) - return; - - Browser_View *browser_view = (Browser_View *)user_data; - Evas_Object *webkit = browser_view->m_focused_window->m_ewk_view; - if (capable) { - ewk_view_web_application_icon_url_get(webkit, __web_app_icon_url_get_cb, browser_view); - } -} - -void Browser_View::__web_app_icon_url_get_cb(const char* icon_url, void* user_data) -{ - BROWSER_LOGD("icon_url:%s", icon_url); - - if (!user_data) - return; - - Browser_View *browser_view = (Browser_View *)user_data; - - /* make configure file */ - browser_view->m_meta_tag->create_config_xml((browser_view->get_url()).c_str(), browser_view->get_title().c_str(), NULL); - if (!icon_url || strlen(icon_url) == 0) { - BROWSER_LOGD("Failed to get webapp icon url, make widget with default icon"); - browser_view->m_meta_tag->wgt_install(NULL); - } else { - BROWSER_LOGD("Succeed to get webapp icon url, make widget after icon downloaded"); - /* get icon */ - browser_view->m_meta_tag->request_download_icon(icon_url); - } -} -#endif - void Browser_View::__url_editfield_share_clicked_cb(void *data, Evas_Object *obj, void *event_info) { BROWSER_LOGD("[%s]", __func__); diff --git a/src/browser-view/browser-view.h b/src/browser-view/browser-view.h index 2dfe5945..bfdba80e 100755 --- a/src/browser-view/browser-view.h +++ b/src/browser-view/browser-view.h @@ -19,9 +19,6 @@ #define BROWSER_VIEW_H #include "browser-common-view.h" -#ifdef USE_META_TAG -#include "browser-meta-tag.h" -#endif #include "browser-config.h" #if defined(FEATURE_MOST_VISITED_SITES) #include "browser-most-visited.h" @@ -32,9 +29,6 @@ class Browser_Bookmark_DB; class Browser_Context_Menu; class Browser_Class; class Browser_Find_Word; -#ifdef USE_META_TAG -class Browser_Meta_Tag; -#endif class Browser_Multi_Window_View; class Browser_Scissorbox_View; class Browser_Settings_Class; @@ -216,12 +210,6 @@ private: /* elm transit callback functions */ static void __new_window_transit_finished_cb(void *data, Elm_Transit *transit); -#ifdef USE_META_TAG - static void __web_app_capable_get_cb(Eina_Bool capable, void* user_data); - static void __web_app_icon_url_get_cb(const char* icon_url, void* user_data); - -#endif - /* normal member functions */ Eina_Bool _create_main_layout(void); Evas_Object *_create_url_layout(void); @@ -353,9 +341,6 @@ private: Ecore_Timer *m_multi_window_rotate_timer; Eina_Bool m_is_rotated; #endif -#ifdef USE_META_TAG - Browser_Meta_Tag *m_meta_tag; -#endif Eina_Bool m_is_full_screen; #ifdef ZOOM_BUTTON Evas_Object *m_zoom_in_button; |