2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
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.
19 #include "browser-class.h"
20 #include "browser-common-view.h"
21 #include "browser-view.h"
22 #include "browser-window.h"
24 Browser_Data_Manager *Browser_Common_View::m_data_manager;
25 Evas_Object *Browser_Common_View::m_win;
26 Evas_Object *Browser_Common_View::m_navi_bar;
27 Evas_Object *Browser_Common_View::m_bg;
28 Browser_Class *Browser_Common_View::m_browser;
30 Browser_Common_View::Browser_Common_View(void)
32 m_selection_info(NULL)
33 ,m_selection_info_layout(NULL)
34 ,m_selinfo_layout(NULL)
39 ,m_call_confirm_popup(NULL)
40 ,m_call_type(CALL_UNKNOWN)
42 BROWSER_LOGD("[%s]", __func__);
45 Browser_Common_View::~Browser_Common_View(void)
47 BROWSER_LOGD("[%s]", __func__);
48 if (m_selection_info_layout) {
49 evas_object_del(m_selection_info_layout);
50 m_selection_info_layout = NULL;
52 if (m_selection_info) {
53 evas_object_del(m_selection_info);
54 m_selection_info = NULL;
57 evas_object_del(m_popup);
61 evas_object_del(m_share_popup);
65 evas_object_del(m_share_list);
72 if (m_call_confirm_popup) {
73 evas_object_del(m_call_confirm_popup);
74 m_call_confirm_popup = NULL;
77 m_sns_path_list.clear();
78 m_sns_name_list.clear();
79 m_sns_icon_list.clear();
82 void Browser_Common_View::show_msg_popup(const char *msg, int timeout)
84 BROWSER_LOGD("[%s]", __func__);
86 evas_object_del(m_popup);
90 m_popup = elm_popup_add(m_navi_bar);
91 evas_object_size_hint_weight_set(m_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
92 elm_object_text_set(m_popup, msg);
93 elm_popup_timeout_set(m_popup, timeout);
94 evas_object_show(m_popup);
97 void Browser_Common_View::show_msg_popup(const char *title, const char *msg, int timeout)
99 BROWSER_LOGD("[%s]", __func__);
101 evas_object_del(m_popup);
105 m_popup = elm_popup_add(m_navi_bar);
106 evas_object_size_hint_weight_set(m_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
107 elm_object_part_text_set(m_popup, "title,text", title);
108 elm_object_text_set(m_popup, msg);
109 elm_popup_timeout_set(m_popup, timeout);
110 evas_object_show(m_popup);
113 void Browser_Common_View::hide_notify_popup(void)
115 if (m_selection_info_layout) {
116 evas_object_del(m_selection_info_layout);
117 m_selection_info_layout = NULL;
120 if (m_selection_info) {
121 evas_object_del(m_selection_info);
122 m_selection_info = NULL;
126 void Browser_Common_View::show_notify_popup(const char *msg, int timeout, Eina_Bool has_control_bar)
128 if (m_selection_info_layout) {
129 evas_object_del(m_selection_info_layout);
130 m_selection_info_layout = NULL;
133 if (m_selection_info) {
134 evas_object_del(m_selection_info);
135 m_selection_info = NULL;
139 angle = elm_win_rotation_get(m_win);
140 m_selection_info = elm_notify_add(m_navi_bar);
141 if (!m_selection_info) {
142 BROWSER_LOGD("elm_notify_add failed");
145 elm_notify_orient_set(m_selection_info, ELM_NOTIFY_ORIENT_BOTTOM);
146 evas_object_size_hint_weight_set(m_selection_info, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
147 evas_object_size_hint_align_set(m_selection_info, EVAS_HINT_FILL, EVAS_HINT_FILL);
148 m_selection_info_layout = elm_layout_add(m_selection_info);
149 if (!m_selection_info_layout) {
150 BROWSER_LOGD("elm_layout_add failed");
153 evas_object_size_hint_weight_set(m_selection_info_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
154 evas_object_size_hint_align_set(m_selection_info_layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
156 elm_object_content_set(m_selection_info, m_selection_info_layout);
158 if (has_control_bar) {
159 if(angle == 0 || angle == 180)
160 elm_layout_theme_set(m_selection_info_layout, "standard", "selectioninfo",
161 "vertical/bottom_64");
163 elm_layout_theme_set(m_selection_info_layout, "standard", "selectioninfo",
164 "horizontal/bottom_64");
166 if(angle == 0 || angle == 180)
167 elm_layout_theme_set(m_selection_info_layout, "standard", "selectioninfo",
168 "vertical/bottom_12");
170 elm_layout_theme_set(m_selection_info_layout, "standard", "selectioninfo",
171 "horizontal/bottom_12");
173 edje_object_part_text_set(elm_layout_edje_get(m_selection_info_layout), "elm.text", msg);
176 elm_notify_timeout_set(m_selection_info, timeout);
178 evas_object_show(m_selection_info);
181 void Browser_Common_View::show_notify_popup_layout(const char *msg, int timeout, Evas_Object *parent)
183 if (m_selinfo_layout) {
184 evas_object_del(m_selinfo_layout);
185 m_selinfo_layout = NULL;
188 m_selinfo_layout = elm_layout_add(parent);
189 if (!m_selinfo_layout) {
190 BROWSER_LOGD("elm_layout_add failed");
193 elm_object_part_content_set(parent,
194 "selinfo.swallow.contents",
196 evas_object_size_hint_weight_set(m_selinfo_layout,
199 evas_object_size_hint_align_set(m_selinfo_layout,
203 elm_object_content_set(m_selection_info, m_selection_info_layout);
205 /* Set the layout theme */
206 elm_layout_theme_set(m_selinfo_layout, "standard", "selectioninfo", "default");
208 elm_object_part_text_set(m_selinfo_layout, "elm.text", msg);
209 elm_object_signal_emit(parent, "show,selection,info", "elm");
212 void Browser_Common_View::hide_notify_popup_layout(Evas_Object *parent)
214 if (m_selinfo_layout) {
215 evas_object_del(m_selinfo_layout);
216 m_selinfo_layout = NULL;
219 elm_object_signal_emit(parent, "hide,selection,info", "elm");
222 Eina_Bool Browser_Common_View::find_word_with_text(const char *text_to_find)
224 BROWSER_LOGD("[%s], text_to_find[%s]", __func__, text_to_find);
229 Browser_View *browser_view = m_data_manager->get_browser_view();
230 return browser_view->launch_find_word_with_text(text_to_find);;
233 /* Capture snapshot with current focused ewk view. */
234 Evas_Object *Browser_Common_View::_capture_snapshot(Browser_Window *window, float scale)
236 BROWSER_LOGD("[%s]", __func__);
238 int focused_ewk_view_w = 0;
239 int focused_ewk_view_h = 0;
240 evas_object_geometry_get(window->m_ewk_view, NULL, NULL,
241 &focused_ewk_view_w, &focused_ewk_view_h);
243 Evas_Object *rectangle = evas_object_rectangle_add(evas_object_evas_get(m_navi_bar));
244 evas_object_size_hint_min_set(rectangle, focused_ewk_view_w * scale, focused_ewk_view_h * scale);
245 evas_object_resize(rectangle, focused_ewk_view_w * scale, focused_ewk_view_h * scale);
246 evas_object_color_set(rectangle, 255, 255, 255, 255);
250 void Browser_Common_View::__post_to_sns_cb(void *data, Evas_Object *obj, void *event_info)
255 Browser_Common_View *common_view = (Browser_Common_View *)data;
257 Elm_Object_Item *selected_item = elm_list_selected_item_get(common_view->m_share_list);
258 const char *sns_name = elm_object_item_text_get(selected_item);
259 BROWSER_LOGD("sns_name=[%s]", sns_name);
261 if (!common_view->_post_to_sns(std::string(sns_name), common_view->m_share_url))
262 BROWSER_LOGE("_post_to_sns failed");
264 __popup_response_cb(common_view, NULL, NULL);
267 Eina_Bool Browser_Common_View::_post_to_sns(std::string sns_name, std::string url)
269 BROWSER_LOGD("sns_name=[%s], url=[%s]", sns_name.c_str(), url.c_str());
270 if (url.empty() || sns_name.empty()) {
271 show_msg_popup(BR_STRING_EMPTY);
276 for (index = 0 ; index < m_sns_name_list.size() ; index++) {
277 if (m_sns_name_list[index].find(sns_name) != string::npos)
281 if (m_sns_path_list[index].find("twitter") != string::npos
282 || m_sns_path_list[index].find("facebook") != string::npos) {
285 service_h service_handle = NULL;
286 if (service_create(&service_handle) < 0) {
287 BROWSER_LOGE("Fail to create service handle");
290 if (!service_handle) {
291 BROWSER_LOGE("service handle is NULL");
294 if (service_set_operation(service_handle, SERVICE_OPERATION_SEND_TEXT) < 0) {
295 BROWSER_LOGE("Fail to set service operation");
296 service_destroy(service_handle);
299 if (service_add_extra_data(service_handle, SERVICE_DATA_TEXT, (char *)url.c_str()) < 0) {
300 BROWSER_LOGE("Fail to set post data");
301 service_destroy(service_handle);
304 if (service_set_package(service_handle, m_sns_path_list[index].c_str()) < 0) {
305 BROWSER_LOGE("Fail to set SNS");
306 service_destroy(service_handle);
309 if (service_send_launch_request(service_handle, NULL, NULL) < 0) {
310 BROWSER_LOGE("Fail to launch service operation");
311 service_destroy(service_handle);
314 service_destroy(service_handle);
320 void Browser_Common_View::__send_via_message_cb(void *data, Evas_Object *obj, void *event_info)
325 Browser_Common_View *common_view = (Browser_Common_View *)data;
326 if (!common_view->_send_via_message(common_view->m_share_url, std::string()))
327 BROWSER_LOGE("_send_via_message failed");
329 __popup_response_cb(common_view, NULL, NULL);
332 Eina_Bool Browser_Common_View::_send_via_message(std::string url, std::string to, Eina_Bool attach_file)
334 BROWSER_LOGD("[%s], url[%s], to[%s]", __func__, url.c_str(), to.c_str());
335 if (url.empty() && to.empty()) {
336 show_msg_popup(BR_STRING_EMPTY);
340 service_h service_handle = NULL;
341 if (service_create(&service_handle) < 0) {
342 BROWSER_LOGE("Fail to create service handle");
346 if (!service_handle) {
347 BROWSER_LOGE("Fail to create service handle");
353 if (service_set_operation(service_handle, SERVICE_OPERATION_SEND) < 0) {
354 BROWSER_LOGE("Fail to set service operation");
355 service_destroy(service_handle);
359 if (service_add_extra_data(service_handle, "ATTACHFILE", url.c_str())) {
360 BROWSER_LOGE("Fail to set extra data");
361 service_destroy(service_handle);
365 if (service_set_operation(service_handle, SERVICE_OPERATION_SEND_TEXT) < 0) {
366 BROWSER_LOGE("Fail to set service operation");
367 service_destroy(service_handle);
371 if (service_add_extra_data(service_handle, SERVICE_DATA_TEXT, url.c_str()) < 0) {
372 BROWSER_LOGE("Fail to set extra data");
373 service_destroy(service_handle);
381 if (service_set_operation(service_handle, SERVICE_OPERATION_SEND_TEXT) < 0) {
382 BROWSER_LOGE("Fail to set service operation");
383 service_destroy(service_handle);
388 if (service_add_extra_data(service_handle, SERVICE_DATA_TO , to.c_str()) < 0) {
389 BROWSER_LOGE("Fail to set extra data");
390 service_destroy(service_handle);
395 if (service_set_package(service_handle, SEC_MESSAGE) < 0) {//SEC_EMAIL
396 BROWSER_LOGE("Fail to launch service operation");
397 service_destroy(service_handle);
401 if (service_send_launch_request(service_handle, NULL, NULL) < 0) {
402 BROWSER_LOGE("Fail to launch service operation");
403 service_destroy(service_handle);
406 service_destroy(service_handle);
411 void Browser_Common_View::__send_via_email_cb(void *data, Evas_Object *obj, void *event_info)
413 BROWSER_LOGD("%s", __func__);
417 Browser_Common_View *common_view = (Browser_Common_View *)data;
418 if (!common_view->_send_via_email(common_view->m_share_url))
419 BROWSER_LOGE("_send_via_email failed");
421 __popup_response_cb(common_view, NULL, NULL);
424 void Browser_Common_View::__share_via_nfc_cb(void *data, Evas_Object *obj, void *event_info)
426 BROWSER_LOGD("%s", __func__);
430 Browser_Common_View *common_view = (Browser_Common_View *)data;
431 if (!common_view->_share_via_nfc(common_view->m_share_url))
432 BROWSER_LOGE("_share_via_nfc failed");
434 __popup_response_cb(common_view, NULL, NULL);
437 Eina_Bool Browser_Common_View::_launch_streaming_player(const char *url, const char *cookie)
439 BROWSER_LOGD("%s", __func__);
440 if (!url || strlen(url) == 0) {
441 BROWSER_LOGE("url is empty");
445 bool is_running = false;
446 if (app_manager_is_running(SEC_VT_CALL, &is_running) < 0) {
447 BROWSER_LOGE("Fail to get app running information\n");
451 BROWSER_LOGE("video-call is running......\n");
452 show_msg_popup(BR_STRING_WARNING_VIDEO_PLAYER);
456 service_h service_handle = NULL;
458 if (service_create(&service_handle) < 0) {
459 BROWSER_LOGE("Fail to create service handle");
463 if (!service_handle) {
464 BROWSER_LOGE("service handle is NULL");
468 BROWSER_LOGD("url=[%s]", url);
469 if (service_add_extra_data(service_handle, "path", url) < 0) {
470 BROWSER_LOGE("Fail to set extra data");
471 service_destroy(service_handle);
475 if (cookie && strlen(cookie)) {
476 if (service_add_extra_data(service_handle, "cookie", cookie) < 0) {
477 BROWSER_LOGE("Fail to set extra data");
478 service_destroy(service_handle);
483 if (service_set_package(service_handle,SEC_STREAMING_PLAYER) < 0) {
484 BROWSER_LOGE("Fail to set package");
485 service_destroy(service_handle);
489 if (service_send_launch_request(service_handle, NULL, NULL) < 0) {
490 BROWSER_LOGE("Fail to launch service operation");
491 service_destroy(service_handle);
495 service_destroy(service_handle);
500 Eina_Bool Browser_Common_View::_check_available_sns_account(void)
502 BROWSER_LOGD("%s", __func__);
504 int error_code = account_connect();
505 bool result = EINA_FALSE;
507 if(error_code != ACCOUNT_ERROR_NONE) {
508 BROWSER_LOGD("account_connect failed with error_code[%d].\n", error_code);
512 if (account_query_account_by_package_name(__check_available_sns_account_cb,
513 "org.tizen.facebook", NULL) == ACCOUNT_ERROR_NONE) {
514 BROWSER_LOGD("Account for Facebook was set\n");
515 } else if (account_query_account_by_package_name(__check_available_sns_account_cb,
516 "org.tizen.twitter", NULL) == ACCOUNT_ERROR_NONE) {
517 BROWSER_LOGD("Account for Twitter was set\n");
519 BROWSER_LOGD("Account Queried failed \n");
520 error_code = account_disconnect();
521 if(error_code != ACCOUNT_ERROR_NONE) {
522 BROWSER_LOGD("(%d)-[Account] ret = %d, \n", __LINE__, error_code);
527 error_code = account_disconnect();
528 if(error_code != ACCOUNT_ERROR_NONE) {
529 BROWSER_LOGD("(%d)-[Account] ret = %d, \n", __LINE__, error_code);
536 bool Browser_Common_View::__check_available_sns_account_cb(account_h handle, void *data)
538 BROWSER_LOGD("%s", __func__);
540 char *pkg_name = NULL;
541 account_get_package_name(handle, &pkg_name);
542 BROWSER_LOGD("pkg_name [%s]", pkg_name);
551 Eina_Bool Browser_Common_View::_get_available_sns_list(void)
553 BROWSER_LOGD("[%s]\n", __func__);
556 error_code = account_connect();
558 if (error_code == ACCOUNT_ERROR_RECORD_NOT_FOUND) {
559 show_msg_popup(BR_STRING_ERROR, BR_STRING_NOT_FOUND_URL, 2);
561 } else if (error_code == ACCOUNT_ERROR_NONE) {
562 error_code = account_foreach_account_from_db(__get_sns_list, this);
563 error_code = account_disconnect();
565 if (error_code !=ACCOUNT_ERROR_NONE) {
566 BROWSER_LOGD("account_svc_disconnect failed with error code [%d]\n", error_code);
570 BROWSER_LOGD("account_connect failed with error code [%d]\n", error_code);
578 bool Browser_Common_View::__get_sns_list(account_h account, void *data)
580 BROWSER_LOGD("[%s]\n", __func__);
585 Browser_Common_View *common_view = (Browser_Common_View *)data;
588 char *service_name = NULL;
589 char *lib_path = NULL;
590 char *icon_path = NULL;
592 Eina_Bool can_post = EINA_FALSE;
594 account_get_capability(account, __get_post_capability_cb, &can_post);
595 account_get_account_id(account, &account_id);
596 BROWSER_LOGD("account_id: %d\n", account_id);
598 account_get_domain_name(account, &service_name);
599 BROWSER_LOGD("service_name: %s\n", service_name);
602 BROWSER_LOGD("cannot post to : [%s] in browser\n", service_name);
608 account_get_package_name(account, &lib_path);
609 BROWSER_LOGD("lib_path: %s\n", lib_path);
611 account_get_icon_path(account, &icon_path);
612 BROWSER_LOGD("icon_path: %s\n", icon_path);
614 if (icon_path && strlen(icon_path) > 0) {
615 BROWSER_LOGD("icon_path: %s\n", icon_path);
616 Evas_Object *icon = elm_icon_add(common_view->m_share_popup);
618 elm_icon_file_set(icon, icon_path, NULL);
619 BROWSER_LOGD("icon_path: %s\n", icon_path);
620 common_view->m_sns_icon_list.push_back(icon);
624 if (service_name && strlen(service_name) && lib_path && strlen(lib_path)) {
625 common_view->m_sns_path_list.push_back(std::string(lib_path));
626 common_view->m_sns_name_list.push_back(std::string(service_name));
644 bool Browser_Common_View::__get_post_capability_cb(account_capability_type_e type,
645 account_capability_state_e state, void *data)
647 Eina_Bool *can_post = (Eina_Bool *)data;
649 BROWSER_LOGD("unable to post");
653 if (ACCOUNT_CAPABILITY_STATUS_POST != type)
656 if (ACCOUNT_CAPABILITY_DISABLED == state)
659 *can_post = EINA_TRUE;
664 Eina_Bool Browser_Common_View::_send_via_email(std::string url, Eina_Bool attach_file)
666 BROWSER_LOGD("[%s], url[%s]", __func__, url.c_str());
668 show_msg_popup(BR_STRING_EMPTY);
672 service_h service_handle = NULL;
673 if (service_create(&service_handle) < 0) {
674 BROWSER_LOGE("Fail to create service handle");
678 if (!service_handle) {
679 BROWSER_LOGE("Fail to create service handle");
684 if (service_set_operation(service_handle, SERVICE_OPERATION_SEND) < 0) {
685 BROWSER_LOGE("Fail to set service operation");
686 service_destroy(service_handle);
690 if (service_set_uri(service_handle, url.c_str()) < 0) {
691 BROWSER_LOGE("Fail to set uri");
692 service_destroy(service_handle);
696 if (service_set_operation(service_handle, SERVICE_OPERATION_SEND_TEXT) < 0) {
697 BROWSER_LOGE("Fail to set service operation");
698 service_destroy(service_handle);
702 if (strstr(url.c_str(), BROWSER_MAIL_TO_SCHEME)) {
703 if (service_add_extra_data(service_handle, SERVICE_DATA_TO, url.c_str() + strlen(BROWSER_MAIL_TO_SCHEME)) < 0) {
704 BROWSER_LOGE("Fail to set mailto data");
705 service_destroy(service_handle);
709 if (service_add_extra_data(service_handle, SERVICE_DATA_TEXT, url.c_str()) < 0) {
710 BROWSER_LOGE("Fail to set extra data");
711 service_destroy(service_handle);
717 if (service_set_package(service_handle, SEC_EMAIL) < 0) {
718 BROWSER_LOGE("Fail to launch service operation");
719 service_destroy(service_handle);
723 if (service_send_launch_request(service_handle, NULL, NULL) < 0) {
724 BROWSER_LOGE("Fail to launch service operation");
725 service_destroy(service_handle);
728 service_destroy(service_handle);
733 Eina_Bool Browser_Common_View::_add_to_contact(std::string number)
735 if (number.empty()) {
736 BROWSER_LOGE("number is null");
739 struct ug_cbs cbs = {0, };
740 cbs.layout_cb = __ug_layout_cb;
741 cbs.result_cb = NULL;//__ug_result_cb;
742 cbs.destroy_cb = __ug_destroy_cb;
743 cbs.priv = (void *)this;
745 char *phone_number = (char *)strdup(number.c_str());
747 BROWSER_LOGE("strdup failed");
751 service_h data = NULL;
752 service_create(&data);
754 BROWSER_LOGE("fail to service_create.");
759 CT_UG_REQUEST_ADD = 21,
760 CT_UG_REQUEST_ADD_WITH_NUM = 22,
761 CT_UG_REQUEST_ADD_WITH_EMAIL = 23,
762 CT_UG_REQUEST_ADD_WITH_WEB = 24,
764 if (service_add_extra_data(data, "type", "22")) {
765 BROWSER_LOGE("service_add_extra_data is failed.");
766 service_destroy(data);
769 if (service_add_extra_data(data, "ct_num", number.c_str())) {
770 BROWSER_LOGE("service_add_extra_data is failed.");
771 service_destroy(data);
775 if (!ug_create(NULL, "contacts-details-efl", UG_MODE_FULLVIEW, data, &cbs))
776 BROWSER_LOGE("ug_create is failed.");
778 if (service_destroy(data))
779 BROWSER_LOGE("service_destroy is failed.");
784 Eina_Bool Browser_Common_View::_share_via_nfc(std::string url)
786 BROWSER_LOGD("[%s]", __func__);
788 show_msg_popup(BR_STRING_EMPTY);
792 struct ug_cbs cbs = {0, };
793 cbs.layout_cb = __ug_layout_cb;
794 cbs.result_cb = NULL;//__ug_result_cb;
795 cbs.destroy_cb = __ug_destroy_cb;
796 cbs.priv = (void *)this;
798 char *share_url = (char *)strdup(url.c_str());
800 BROWSER_LOGE("strdup failed");
804 service_h data = NULL;
805 service_create(&data);
807 BROWSER_LOGE("fail to service_create.");
810 if (service_add_extra_data(data, "count", "1")) {
811 BROWSER_LOGE("service_add_extra_data is failed.");
812 service_destroy(data);
815 if (service_add_extra_data(data, "request_type", "data_buffer")) {
816 BROWSER_LOGE("service_add_extra_data is failed.");
817 service_destroy(data);
820 if (service_add_extra_data(data, "request_data", share_url)) {
821 BROWSER_LOGE("service_add_extra_data is failed.");
822 service_destroy(data);
828 if(!ug_create(NULL, "share-nfc-efl", UG_MODE_FULLVIEW, data, &cbs))
829 BROWSER_LOGE("ug_create is failed.");
831 if (service_destroy(data))
832 BROWSER_LOGE("service_destroy is failed.");
839 Eina_Bool Browser_Common_View::_show_share_popup(const char *url)
841 BROWSER_LOGE("url=[%s]", url);
842 if (!url || strlen(url) == 0) {
843 BROWSER_LOGE("url is empty");
847 m_share_url = std::string(url);
849 m_sns_path_list.clear();
850 m_sns_name_list.clear();
851 m_sns_icon_list.clear();
853 m_share_popup = elm_popup_add(m_navi_bar);
854 if (!m_share_popup) {
855 BROWSER_LOGE("elm_popup_add failed");
858 elm_object_style_set(m_share_popup, "menustyle");
859 elm_object_part_text_set(m_share_popup, "title,text", BR_STRING_SHARE);
860 evas_object_size_hint_weight_set(m_share_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
862 m_share_list = elm_list_add(m_share_popup);
864 BROWSER_LOGE("elm_list_add failed");
867 evas_object_size_hint_weight_set(m_share_list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
868 evas_object_size_hint_align_set(m_share_list, EVAS_HINT_FILL, EVAS_HINT_FILL);
870 elm_list_item_append(m_share_list, BR_STRING_MESSAGES, NULL, NULL, __send_via_message_cb, this);
871 elm_list_item_append(m_share_list, BR_STRING_EMAIL, NULL, NULL, __send_via_email_cb, this);
873 evas_object_show(m_share_list);
875 Evas_Object *cancel_button = elm_button_add(m_share_popup);
876 elm_object_text_set(cancel_button, BR_STRING_CANCEL);
877 elm_object_part_content_set(m_share_popup, "button1", cancel_button);
878 elm_object_style_set(cancel_button, "popup_button/default");
879 evas_object_smart_callback_add(cancel_button, "clicked", __popup_response_cb, this);
881 elm_object_content_set(m_share_popup, m_share_list);
883 evas_object_show(m_share_popup);
888 void Browser_Common_View::__popup_response_cb(void* data, Evas_Object* obj, void* event_info)
890 BROWSER_LOGD("%s, event_info=%d", __func__, (int)event_info);
895 Browser_Common_View *common_view = (Browser_Common_View *)data;
896 if (common_view->m_share_popup) {
897 evas_object_del(common_view->m_share_popup);
898 common_view->m_share_popup = NULL;
900 if (common_view->m_share_list) {
901 evas_object_del(common_view->m_share_list);
902 common_view->m_share_list = NULL;
905 common_view->m_sns_name_list.clear();
906 common_view->m_sns_path_list.clear();
910 char *Browser_Common_View::_trim(char *str)
914 while(*pos_bos == ' ')
917 char *pos_eos = pos_bos + strlen(pos_bos) - 1;
919 while((pos_eos >= str) && (*pos_eos == ' ')) {
927 #if defined(HORIZONTAL_UI)
928 Eina_Bool Browser_Common_View::is_landscape(void)
932 evas_object_geometry_get(m_win, NULL, NULL, &window_w, &window_h);
933 if (window_h > window_w) {
934 BROWSER_LOGD("portrait");
937 BROWSER_LOGD("landscape");
943 /* set focus to edit field idler callback to show ime. */
944 Eina_Bool Browser_Common_View::__set_focus_editfield_idler_cb(void *edit_field)
946 BROWSER_LOGD("[%s]", __func__);
948 return ECORE_CALLBACK_CANCEL;
949 elm_object_focus_set((Evas_Object *)edit_field, EINA_TRUE);
950 elm_object_signal_emit((Evas_Object *)edit_field, "clicked", "elm");
952 Evas_Object *entry = br_elm_editfield_entry_get((Evas_Object *)edit_field);
953 elm_entry_cursor_end_set(entry);
955 return ECORE_CALLBACK_CANCEL;
958 Eina_Bool Browser_Common_View::_has_url_sheme(const char *url)
960 if (url && strlen(url)
961 && (strstr(url, BROWSER_URL_SCHEME_CHECK) || strstr(url, BROWSER_MAIL_TO_SCHEME)))
967 void Browser_Common_View::__ug_layout_cb(ui_gadget_h ug, enum ug_mode mode, void *priv)
969 BROWSER_LOGD("[%s]", __func__);
973 Browser_Common_View *common_view = (Browser_Common_View *)priv;
974 Evas_Object *base = (Evas_Object*)ug_get_layout(ug);
978 common_view->m_ug = ug;
980 Evas_Object *win = (Evas_Object *)ug_get_window();
983 case UG_MODE_FULLVIEW:
984 evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
985 elm_win_resize_object_add(win, base);
986 evas_object_show(base);
993 void Browser_Common_View::__ug_result_cb(ui_gadget_h ug, bundle *result, void *priv)
999 void Browser_Common_View::__ug_destroy_cb(ui_gadget_h ug, void *priv)
1005 BROWSER_LOGD("ug_destroy is failed.\n");