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.
18 #include "browser-add-to-bookmark-view.h"
19 #include "browser-bookmark-view.h"
20 #include "browser-class.h"
21 #include "browser-config.h"
22 #include "browser-context-menu.h"
23 #include "browser-history-db.h"
24 #include "browser-find-word.h"
25 #include "browser-multi-window-view.h"
26 #include "browser-scissorbox-view.h"
27 #include "browser-settings-class.h"
28 #if defined(FEATURE_MOST_VISITED_SITES)
29 #include "most-visited-sites.h"
30 #include "most-visited-sites-db.h"
32 #include "browser-string.h"
33 #include "browser-view.h"
34 #include "browser-window.h"
41 Browser_View::Browser_View(Evas_Object *win, Evas_Object *navi_bar, Evas_Object *bg, Browser_Class *browser)
46 ,m_dummy_loading_progressbar(NULL)
49 ,m_url_entry_layout(NULL)
50 ,m_url_edit_field(NULL)
51 ,m_url_progressbar(NULL)
52 ,m_url_progresswheel(NULL)
53 ,m_cancel_button(NULL)
56 ,m_forward_button(NULL)
57 ,m_add_bookmark_button(NULL)
59 ,m_option_header_url_layout(NULL)
60 ,m_find_word_entry_layout(NULL)
61 ,m_find_word_edit_field(NULL)
62 ,m_option_header_layout(NULL)
63 ,m_find_word_cancel_button(NULL)
64 ,m_option_header_find_word_layout(NULL)
65 ,m_option_header_url_entry_layout(NULL)
66 ,m_option_header_cancel_button(NULL)
67 ,m_find_word_prev_button(NULL)
68 ,m_find_word_next_button(NULL)
69 ,m_option_header_url_progressbar(NULL)
70 ,m_option_header_url_progresswheel(NULL)
71 ,m_edit_mode(BR_NO_EDIT_MODE)
72 ,m_homepage_mode(BR_START_MODE_UNKOWN)
73 #if defined(HORIZONTAL_UI)
75 ,m_multi_window_rotate_timer(NULL)
76 ,m_is_rotated(EINA_FALSE)
78 ,m_scroller_region_y(0)
79 ,m_is_scrolling(EINA_FALSE)
80 ,m_focused_window(NULL)
81 ,m_more_context_popup(NULL)
82 #if defined(FEATURE_MOST_VISITED_SITES)
83 ,m_most_visited_sites(NULL)
84 ,m_most_visited_sites_db(NULL)
86 ,m_new_window_transit(NULL)
87 ,m_created_new_window(NULL)
88 ,m_browser_settings(NULL)
91 ,m_scissorbox_view(NULL)
92 ,m_share_controlbar_button(NULL)
97 ,m_multi_window_button(NULL)
98 ,m_new_window_button(NULL)
99 ,m_is_full_screen(EINA_FALSE)
101 ,m_zoom_in_button(NULL)
102 ,m_zoom_out_button(NULL)
103 ,m_zoom_button_timer(NULL)
105 ,m_title_backward_button(NULL)
106 ,m_title_forward_button(NULL)
107 ,m_option_header_title_backward_button(NULL)
108 ,m_option_header_title_forward_button(NULL)
109 ,m_resize_idler(NULL)
110 ,m_is_private(EINA_FALSE)
111 ,m_private_check(NULL)
112 ,m_is_private_item_pressed(EINA_FALSE)
113 ,m_bookmark_on_off_icon(NULL)
114 ,m_brightness_control_bar(NULL)
115 ,m_brightness_auto_it(NULL)
116 ,m_brightness_manual_it(NULL)
117 ,m_default_seg_it(NULL)
119 ,m_medium_seg_it(NULL)
121 ,m_vibration_device_handle_id(-1)
122 ,m_is_multi_window_grid_mode(EINA_FALSE)
124 BROWSER_LOGD("[%s]", __func__);
126 m_navi_bar = navi_bar;
131 Browser_View::~Browser_View()
133 BROWSER_LOGD("[%s]", __func__);
134 if (m_title_back_button)
135 evas_object_del(m_title_back_button);
139 br_preference_set_str(LAST_VISITED_URL_KEY, m_last_visited_url.c_str());
141 m_data_manager->destroy_history_db();
142 m_data_manager->destroy_geolocation_db();
144 if (m_data_manager) {
145 delete m_data_manager;
146 m_data_manager = NULL;
148 #if defined(FEATURE_MOST_VISITED_SITES)
149 if (m_most_visited_sites) {
150 delete m_most_visited_sites;
151 m_most_visited_sites = NULL;
153 if (m_most_visited_sites_db) {
154 delete m_most_visited_sites_db;
155 m_most_visited_sites_db = NULL;
158 if (m_new_window_transit) {
159 elm_transit_del(m_new_window_transit);
160 m_new_window_transit = NULL;
162 if (m_browser_settings) {
163 delete m_browser_settings;
164 m_browser_settings = NULL;
170 if (m_context_menu) {
171 delete m_context_menu;
172 m_context_menu = NULL;
174 if (m_scissorbox_view) {
175 delete m_scissorbox_view;
176 m_scissorbox_view = NULL;
178 #if defined(HORIZONTAL_UI)
179 if (m_multi_window_rotate_timer) {
180 ecore_timer_del(m_multi_window_rotate_timer);
181 m_multi_window_rotate_timer = NULL;
191 if (m_zoom_in_button)
192 evas_object_del(m_zoom_in_button);
193 if (m_zoom_out_button)
194 evas_object_del(m_zoom_out_button);
195 if (m_zoom_button_timer) {
196 ecore_timer_del(m_zoom_button_timer);
197 m_zoom_button_timer = NULL;
202 Eina_Bool Browser_View::init(void)
204 BROWSER_LOGD("[%s]", __func__);
205 /* set homepage from homepage vconf */
206 _set_homepage_mode();
208 m_data_manager = new(nothrow) Browser_Data_Manager;
209 if (!m_data_manager) {
210 BROWSER_LOGE("new Browser_Data_Manager failed");
214 m_data_manager->set_browser_view(this);
216 if (!m_data_manager->create_history_db()) {
217 BROWSER_LOGE("m_data_manager->create_history_db failed");
221 if (!m_data_manager->create_geolocation_db()) {
222 BROWSER_LOGE("m_data_manager->create_geolocation_db failed");
226 #if defined(FEATURE_MOST_VISITED_SITES)
227 m_most_visited_sites_db = new(nothrow) Most_Visited_Sites_DB;
228 if (!m_most_visited_sites_db) {
229 BROWSER_LOGE("new Most_Visited_Sites_DB failed");
234 m_find_word = new(nothrow) Browser_Find_Word(this);
236 BROWSER_LOGE("new Browser_Find_Word failed");
240 m_context_menu = new(nothrow) Browser_Context_Menu(this);
241 if (!m_context_menu) {
242 BROWSER_LOGE("new Browser_Context_Menu failed");
246 m_meta_tag = new(nothrow) Browser_Meta_Tag();
248 BROWSER_LOGE("new Browser_Meta_Tag failed");
252 UG_INIT_EFL(m_win, UG_OPT_INDICATOR_ENABLE);
254 char *last_url = NULL;
255 if (br_preference_get_str(LAST_VISITED_URL_KEY, &last_url) == false) {
256 BROWSER_LOGE("failed to get %s preference", LAST_VISITED_URL_KEY);
260 m_last_visited_url = std::string(last_url);
263 if (_haptic_device_init() == EINA_FALSE) {
264 BROWSER_LOGE("Failed to init haptic device");
268 /* create brower view layout */
269 return _create_main_layout();
272 void Browser_View::launch(const char *url)
274 /* Destroy all other views except browser view. */
278 * When keypad is running via url entry, if browser goes to background by home key.
279 * Then relaunch the browser by aul. The webpage is loading but the keypad is still running.
280 * So give focus to cancel button not to invoke the keypad. */
281 elm_object_focus_set(m_cancel_button, EINA_TRUE);
283 if (url && strlen(url))
285 #if defined(FEATURE_MOST_VISITED_SITES)
286 else if (m_homepage_mode == BR_START_MODE_MOST_VISITED_SITES)
287 load_url(BROWSER_MOST_VISITED_SITES_URL);
289 else if (m_homepage_mode == BR_START_MODE_RECENTLY_VISITED_SITE) {
290 char *homepage = NULL;
291 if (br_preference_get_str(LAST_VISITED_URL_KEY, &homepage) == false) {
292 BROWSER_LOGD("failed to get %s preference", LAST_VISITED_URL_KEY);
299 #if defined(FEATURE_MOST_VISITED_SITES)
300 load_url(BROWSER_MOST_VISITED_SITES_URL);
302 load_url(BROWSER_BLANK_PAGE_URL);
304 } else if (m_homepage_mode == BR_START_MODE_CUSTOMIZED_URL) {
305 char *user_homepage = NULL;
306 if (br_preference_get_str(USER_HOMEPAGE_KEY, &user_homepage) ==false) {
307 BROWSER_LOGE("failed to get %s preference\n", USER_HOMEPAGE_KEY);
311 load_url(user_homepage);
314 #if defined(FEATURE_MOST_VISITED_SITES)
315 load_url(BROWSER_MOST_VISITED_SITES_URL);
317 load_url(BROWSER_BLANK_PAGE_URL);
319 } else if (m_homepage_mode == BR_START_MODE_EMPTY_PAGE) {
320 load_url(BROWSER_BLANK_PAGE_URL);
325 void Browser_View::set_full_sreen(Eina_Bool enable)
327 BROWSER_LOGD("[%s]", __func__);
329 if (m_is_full_screen == enable)
332 m_is_full_screen = enable;
334 if (m_is_full_screen) {
335 elm_win_indicator_mode_set(m_win, ELM_WIN_INDICATOR_HIDE);
336 _hide_scroller_url_layout();
337 edje_object_signal_emit(elm_layout_edje_get(m_main_layout), "enter,full_screen,signal", "");
338 _enable_webview_scroll();
340 elm_object_part_content_unset(m_focused_window->m_ewk_view_layout, "elm.swallow.webview");
342 evas_object_move(m_focused_window->m_ewk_view, 0, 0);
344 elm_win_indicator_mode_set(m_win, ELM_WIN_INDICATOR_SHOW);
346 edje_object_signal_emit(elm_layout_edje_get(m_main_layout), "exit,full_screen,signal", "");
348 elm_object_part_content_set(m_focused_window->m_ewk_view_layout, "elm.swallow.webview", m_focused_window->m_ewk_view);
350 _navigationbar_visible_set_signal(EINA_TRUE);
353 ecore_idler_add(__webview_layout_resize_idler_cb, this);
356 #if defined(FEATURE_MOST_VISITED_SITES)
357 Eina_Bool Browser_View::is_most_visited_sites_running(void)
359 if (m_most_visited_sites)
366 void Browser_View::return_to_browser_view(Eina_Bool saved_most_visited_sites_item)
368 BROWSER_LOGD("[%s]", __func__);
370 if (!_is_loading()) {
371 if (get_title().empty())
372 _set_navigationbar_title(get_url().c_str());
374 _set_navigationbar_title(get_title().c_str());
376 #if defined(FEATURE_MOST_VISITED_SITES)
377 if (is_most_visited_sites_running()) {
378 edje_object_signal_emit(elm_layout_edje_get(m_main_layout),
379 "show,control_bar,no_animation,signal", "");
380 _set_navigationbar_title(BR_STRING_MOST_VISITED_SITES);
382 if (saved_most_visited_sites_item && is_most_visited_sites_running())
383 /* If longpress on speed dial item, then add to bookmark. */
384 edje_object_signal_emit(elm_layout_edje_get(m_most_visited_sites->m_selected_item->layout),
385 "bookmark_icon", "");
391 void Browser_View::_pop_other_views(void)
393 BROWSER_LOGD("[%s]", __func__);
394 _destroy_more_context_popup();
396 /* if browser is runing background behind ug which browser invoked,
397 destroy the previous ug and show the browser view. */
400 /* If multi-window is running, destroy it to show browser view. */
401 if (m_data_manager->is_in_view_stack(BR_MULTI_WINDOW_VIEW))
402 m_data_manager->get_multi_window_view()->close_multi_window();
404 /* Pop all other views except browser view. */
405 elm_naviframe_item_pop_to(m_navi_it);
407 if (m_scissorbox_view)
408 _destroy_scissorbox_view();
411 /* set homepage from homepage vconf */
412 void Browser_View::_set_homepage_mode(void)
414 char *homepage = NULL;
415 if (br_preference_get_str(HOMEPAGE_KEY, &homepage) == false) {
416 BROWSER_LOGE("failed to get %s preference\n", HOMEPAGE_KEY);
419 BROWSER_LOGD("homepage=[%s]", homepage);
422 BROWSER_LOGE("homepage is null");
423 #if defined(FEATURE_MOST_VISITED_SITES)
424 m_homepage_mode = BR_START_MODE_MOST_VISITED_SITES;
426 m_homepage_mode = BR_START_MODE_EMPTY_PAGE;
431 #if defined(FEATURE_MOST_VISITED_SITES)
432 if (!strncmp(homepage, MOST_VISITED_SITES,
433 strlen(MOST_VISITED_SITES)))
434 m_homepage_mode = BR_START_MODE_MOST_VISITED_SITES;
437 if (!strncmp(homepage, RECENTLY_VISITED_SITE,
438 strlen(RECENTLY_VISITED_SITE)))
439 m_homepage_mode = BR_START_MODE_RECENTLY_VISITED_SITE;
440 else if (!strncmp(homepage, EMPTY_PAGE,
442 m_homepage_mode = BR_START_MODE_EMPTY_PAGE;
444 m_homepage_mode = BR_START_MODE_CUSTOMIZED_URL;
447 BROWSER_LOGD("m_homepage_mode=%d", m_homepage_mode);
450 void Browser_View::__new_window_transit_finished_cb(void *data, Elm_Transit *transit)
452 BROWSER_LOGD("[%s]", __func__);
456 Browser_View *browser_view = (Browser_View *)data;
457 if (!browser_view->m_new_window_transit)
460 browser_view->m_new_window_transit = NULL;
461 browser_view->m_browser->set_focused_window(browser_view->m_created_new_window
462 #if defined(FEATURE_MOST_VISITED_SITES)
466 browser_view->m_created_new_window = NULL;
469 Eina_Bool Browser_View::_show_new_window_effect(Evas_Object *current_ewk_view,
470 Evas_Object *new_ewk_view)
476 elm_scroller_region_get(m_scroller, &scroller_x, &scroller_y, &scroller_w, &scroller_h);
477 elm_scroller_region_show(m_scroller ,scroller_x, 0, scroller_w, scroller_h);
479 m_browser->set_focused_window(m_created_new_window
480 #if defined(FEATURE_MOST_VISITED_SITES)
488 Evas_Object *Browser_View::get_favicon(const char *url)
490 if (!url || !strlen(url))
493 Ewk_Context* context = ewk_view_context_get(m_focused_window->m_ewk_view);
494 Evas_Object *favicon = ewk_context_icon_database_icon_object_add(context, url, evas_object_evas_get(m_focused_window->m_ewk_view));
499 Eina_Bool Browser_View::_set_favicon(void)
501 BROWSER_LOGD("[%s]", __func__);
503 if (m_edit_mode == BR_URL_ENTRY_EDIT_MODE
504 || m_edit_mode == BR_URL_ENTRY_EDIT_MODE_WITH_NO_IMF) {
505 BROWSER_LOGD("Edit mode");
509 #if defined(FEATURE_MOST_VISITED_SITES)
510 if (is_most_visited_sites_running()) {
511 BROWSER_LOGD("is_most_visited_sites_running");
516 double progress = ewk_view_load_progress_get(m_focused_window->m_ewk_view);
517 if (progress < 1.0f && progress > 0.05f) {
518 BROWSER_LOGD("loadin status");
522 Evas_Object *favicon = get_favicon(get_url().c_str());
523 Evas_Object *option_header_favicon = get_favicon(get_url().c_str());
526 if (m_focused_window->m_favicon)
527 evas_object_del(m_focused_window->m_favicon);
529 m_focused_window->m_favicon = favicon;
531 Evas_Object *default_icon = elm_icon_add(m_focused_window->m_ewk_view);
533 BROWSER_LOGE("elm_icon_add is failed.");
536 if (!elm_icon_file_set(default_icon, BROWSER_IMAGE_DIR"/faviconDefault.png", NULL)) {
537 BROWSER_LOGE("elm_icon_file_set is failed.");
540 evas_object_size_hint_aspect_set(default_icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
541 if (m_focused_window->m_favicon)
542 evas_object_del(m_focused_window->m_favicon);
544 m_focused_window->m_favicon = default_icon;
547 if (option_header_favicon) {
548 if (m_focused_window->m_option_header_favicon)
549 evas_object_del(m_focused_window->m_option_header_favicon);
551 m_focused_window->m_option_header_favicon = option_header_favicon;
553 Evas_Object *default_icon = elm_icon_add(m_focused_window->m_ewk_view);
555 BROWSER_LOGE("elm_icon_add is failed.");
558 if (!elm_icon_file_set(default_icon, BROWSER_IMAGE_DIR"/faviconDefault.png", NULL)) {
559 BROWSER_LOGE("elm_icon_file_set is failed.");
562 evas_object_size_hint_aspect_set(default_icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
563 if (m_focused_window->m_option_header_favicon)
564 evas_object_del(m_focused_window->m_option_header_favicon);
566 m_focused_window->m_option_header_favicon = default_icon;
569 if (elm_object_part_content_get(m_url_entry_layout, "elm.swallow.favicon"))
570 elm_object_part_content_unset(m_url_entry_layout, "elm.swallow.favicon");
571 if (elm_object_part_content_get(m_option_header_url_entry_layout,
572 "elm.swallow.favicon"))
573 elm_object_part_content_unset(m_option_header_url_entry_layout,
574 "elm.swallow.favicon");
576 elm_object_part_content_set(m_url_entry_layout, "elm.swallow.favicon",
577 m_focused_window->m_favicon);
578 elm_object_part_content_set(m_option_header_url_entry_layout, "elm.swallow.favicon",
579 m_focused_window->m_option_header_favicon);
581 edje_object_signal_emit(elm_layout_edje_get(m_url_entry_layout),
582 "show,favicon,signal", "");
583 edje_object_signal_emit(elm_layout_edje_get(m_option_header_url_entry_layout),
584 "show,favicon,signal", "");
591 Eina_Bool Browser_View::__close_window_idler_cb(void *data)
593 BROWSER_LOGD("[%s]", __func__);
595 return ECORE_CALLBACK_CANCEL;
597 Browser_View *browser_view = (Browser_View *)data;
598 Browser_Class *browser = browser_view->m_browser;
600 if (browser_view->m_focused_window->m_parent)
601 browser->delete_window(browser_view->m_focused_window,
602 browser_view->m_focused_window->m_parent);
604 browser->delete_window(browser_view->m_focused_window);
609 elm_scroller_region_get(browser_view->m_scroller, &scroller_x, NULL, &scroller_w, &scroller_h);
610 elm_scroller_region_show(browser_view->m_scroller ,scroller_x, 0,
611 scroller_w, scroller_h);
612 return ECORE_CALLBACK_CANCEL;
615 void Browser_View::__close_window_cb(void *data, Evas_Object *obj, void *event_info)
617 BROWSER_LOGD("[%s]", __func__);
621 Browser_View *browser_view = (Browser_View *)data;
622 Browser_Class *browser = browser_view->m_browser;
624 /* The window should be deleted by idler. The webkit recommands to delete by idler. */
625 ecore_idler_add(__close_window_idler_cb, browser_view);
628 Eina_Bool Browser_View::_haptic_device_init(void)
630 BROWSER_LOGD("[%s]", __func__);
632 if (m_vibration_device_handle_id == BROWSER_HAPTIC_DEVICE_HANDLE) {
633 BROWSER_LOGD("device handle for haptic is already set");
637 if (haptic_initialize() != HAPTIC_ERROR_NONE) {
638 BROWSER_LOGD("failed to initiate haptic device");
642 m_vibration_device_handle_id = BROWSER_HAPTIC_DEVICE_HANDLE;
647 Eina_Bool Browser_View::_haptic_device_play(long haptic_play_time)
649 BROWSER_LOGD("[%s], requested time is [%dms]", __func__, haptic_play_time);
651 if (m_vibration_device_handle_id != BROWSER_HAPTIC_DEVICE_HANDLE) {
652 BROWSER_LOGD("device handle for haptic is not set. Unable to play haptic");
656 if (haptic_vibrate_monotone(BROWSER_HAPTIC_DEVICE_HANDLE, haptic_play_time, HAPTIC_LEVEL_AUTO) != HAPTIC_ERROR_NONE) {
657 BROWSER_LOGD("haptic_vibrate_monotone failed.");
664 Eina_Bool Browser_View::_haptic_device_stop(void)
666 BROWSER_LOGD("[%s]", __func__);
668 if (m_vibration_device_handle_id != BROWSER_HAPTIC_DEVICE_HANDLE) {
669 BROWSER_LOGD("device handle for haptic is not set. Unable to play haptic");
673 if (haptic_stop_device(BROWSER_HAPTIC_DEVICE_HANDLE) != HAPTIC_ERROR_NONE) {
674 BROWSER_LOGD("haptic_stop_device failed.");
681 Eina_Bool Browser_View::_haptic_device_close(void)
683 BROWSER_LOGD("[%s]", __func__);
685 if (haptic_deinitialize() != HAPTIC_ERROR_NONE) {
686 BROWSER_LOGD("haptic_deinitialize failed.");
693 void Browser_View::__create_window_cb(void *data, Evas_Object *obj, void *event_info)
695 BROWSER_LOGD("[%s]", __func__);
699 Browser_View *browser_view = (Browser_View *)data;
700 Browser_Class *browser = browser_view->m_browser;
702 std::vector<Browser_Window *> window_list = browser->get_window_list();
703 if (window_list.size() >= BROWSER_MULTI_WINDOW_MAX_COUNT) {
704 /* If the multi window is max, delete the first one. */
705 /* if the first window is focused, delete second one(oldest one except first one) */
706 if (browser_view->m_focused_window != window_list[0])
707 browser->delete_window(window_list[0]);
709 browser->delete_window(window_list[1]);
712 browser_view->m_created_new_window = browser->create_new_window();
713 if (!browser_view->m_created_new_window) {
714 BROWSER_LOGE("create_new_window failed");
717 /* initialize the created webview first to connect ewk event callback functions such as load start, progress etc. */
718 browser->ewk_view_init(browser_view->m_created_new_window->m_ewk_view);
720 /* Set the caller window. */
721 browser_view->m_created_new_window->m_parent = browser_view->m_focused_window;
723 /* Destroy previous multi window item snapshot.
724 * This is because the snapshot of multi window item can't be captured in this case. */
725 #if defined(HORIZONTAL_UI)
726 if (browser_view->m_focused_window->m_landscape_snapshot_image) {
727 evas_object_del(browser_view->m_focused_window->m_landscape_snapshot_image);
728 browser_view->m_focused_window->m_landscape_snapshot_image = NULL;
731 if (browser_view->m_focused_window->m_portrait_snapshot_image) {
732 evas_object_del(browser_view->m_focused_window->m_portrait_snapshot_image);
733 browser_view->m_focused_window->m_portrait_snapshot_image = NULL;
736 if (!browser_view->_show_new_window_effect(browser_view->m_focused_window->m_ewk_view,
737 browser_view->m_created_new_window->m_ewk_view))
738 BROWSER_LOGE("_show_new_window_effect failed");
740 *((Evas_Object **)event_info) = browser_view->m_created_new_window->m_ewk_view;
743 void Browser_View::__load_started_cb(void *data, Evas_Object *obj, void *event_info)
745 BROWSER_LOGD("[%s]", __func__);
749 Browser_View *browser_view = (Browser_View *)data;
750 Evas_Object *url_progressbar = browser_view->m_url_progressbar;
751 Evas_Object *progressbar_wheel = browser_view->m_url_progresswheel;
752 Evas_Object *option_header_url_progressbar = browser_view->m_option_header_url_progressbar;
753 Evas_Object *option_header_progressbar_wheel = browser_view->m_option_header_url_progresswheel;
755 double progress = ewk_view_load_progress_get(browser_view->m_focused_window->m_ewk_view);
756 if (progress <= 0.0f)
758 elm_progressbar_pulse(progressbar_wheel, EINA_TRUE);
759 elm_progressbar_pulse(option_header_progressbar_wheel, EINA_TRUE);
761 elm_progressbar_value_set(url_progressbar, progress);
762 elm_progressbar_value_set(option_header_url_progressbar, progress);
764 browser_view->_load_start();
767 void Browser_View::_navigationbar_visible_set_signal(Eina_Bool visible)
769 BROWSER_LOGD("visible=%d", visible);
771 if (visible && (m_data_manager->is_in_view_stack(BR_MULTI_WINDOW_VIEW) || m_is_full_screen || m_brightness_control_bar))
774 if (m_navi_it != elm_naviframe_top_item_get(m_navi_bar))
777 evas_object_data_set(m_navi_bar, "visible", (Eina_Bool *)visible);
779 Elm_Object_Item *top_it = elm_naviframe_top_item_get(m_navi_bar);
782 elm_object_item_signal_emit(top_it, ELM_NAVIFRAME_ITEM_SIGNAL_OPTIONHEADER_INSTANT_OPEN);
784 elm_object_item_signal_emit(top_it, ELM_NAVIFRAME_ITEM_SIGNAL_OPTIONHEADER_INSTANT_CLOSE);
787 void Browser_View::_navigationbar_visible_set(Eina_Bool visible)
789 if (visible && (m_data_manager->is_in_view_stack(BR_MULTI_WINDOW_VIEW) || m_is_full_screen))
792 if (m_navi_it != elm_naviframe_top_item_get(m_navi_bar))
795 evas_object_data_set(m_navi_bar, "visible", (Eina_Bool *)visible);
797 Elm_Object_Item *top_it = elm_naviframe_top_item_get(m_navi_bar);
799 elm_object_item_signal_emit(top_it, ELM_NAVIFRAME_ITEM_SIGNAL_OPTIONHEADER_OPEN);
801 elm_object_item_signal_emit(top_it, ELM_NAVIFRAME_ITEM_SIGNAL_OPTIONHEADER_CLOSE);
804 Eina_Bool Browser_View::_navigationbar_visible_get(void)
806 Eina_Bool* visible = (Eina_Bool *)evas_object_data_get(m_navi_bar, "visible");
807 BROWSER_LOGD("visible = %d", visible);
808 if (visible == (Eina_Bool *)EINA_TRUE)
814 void Browser_View::_load_start(void)
816 BROWSER_LOGD("[%s]", __func__);
818 if (m_dummy_loading_progressbar) {
819 elm_object_part_content_unset(m_main_layout, "elm.swallow.waiting_progress");
820 evas_object_del(m_dummy_loading_progressbar);
821 m_dummy_loading_progressbar = NULL;
822 edje_object_signal_emit(elm_layout_edje_get(m_main_layout),
823 "hide,waiting_progressbar,signal", "");
826 if (!m_data_manager->is_in_view_stack(BR_MULTI_WINDOW_VIEW))
827 _set_navigationbar_title(BR_STRING_LOADING);
829 edje_object_signal_emit(elm_layout_edje_get(m_url_entry_layout), "loading,on,signal", "");
830 edje_object_signal_emit(elm_layout_edje_get(m_option_header_url_entry_layout),
831 "loading,on,signal", "");
833 _navigationbar_visible_set_signal(EINA_TRUE);
835 /* Hide the secure lock icon in title bar. */
836 elm_object_item_part_content_set(m_navi_it, ELM_NAVIFRAME_ITEM_ICON, NULL);
838 /* Destroy & hide favicon when load start. */
839 edje_object_signal_emit(elm_layout_edje_get(m_url_entry_layout),
840 "hide,favicon,signal", "");
841 edje_object_signal_emit(elm_layout_edje_get(m_option_header_url_entry_layout),
842 "hide,favicon,signal", "");
843 if (elm_object_part_content_get(m_url_entry_layout, "elm.swallow.favicon"))
844 elm_object_part_content_unset(m_url_entry_layout, "elm.swallow.favicon");
845 if (elm_object_part_content_get(m_option_header_url_entry_layout,
846 "elm.swallow.favicon"))
847 elm_object_part_content_unset(m_option_header_url_entry_layout,
848 "elm.swallow.favicon");
850 if (m_focused_window->m_favicon) {
851 evas_object_del(m_focused_window->m_favicon);
852 m_focused_window->m_favicon = NULL;
854 if (m_focused_window->m_option_header_favicon) {
855 evas_object_del(m_focused_window->m_option_header_favicon);
856 m_focused_window->m_option_header_favicon = NULL;
859 /* This makes the ewk view unfocused so that the ime can't be invoked. */
860 evas_object_focus_set(m_focused_window->m_ewk_view_layout, EINA_TRUE);
862 if (_get_edit_mode() != BR_NO_EDIT_MODE)
863 _set_edit_mode(BR_NO_EDIT_MODE);
865 /* For deleted window because of unused case like low memory. */
866 m_focused_window->m_url.clear();
867 m_focused_window->m_title.clear();
869 set_full_sreen(EINA_FALSE);
871 elm_object_focus_set(m_option_header_cancel_button, EINA_TRUE);
872 elm_object_signal_emit(m_option_header_url_edit_field, "ellipsis_show,signal", "elm");
873 elm_object_signal_emit(m_url_edit_field, "ellipsis_show,signal", "elm");
875 if (m_scissorbox_view)
876 _destroy_scissorbox_view();
877 _destroy_more_context_popup();
880 void Browser_View::__load_committed_cb(void *data, Evas_Object *obj, void *event_info)
882 BROWSER_LOGD("[%s]", __func__);
886 Browser_View *browser_view = (Browser_View *)data;
887 if (browser_view->_get_edit_mode() != BR_NO_EDIT_MODE)
890 browser_view->_set_url_entry(browser_view->get_url().c_str());
893 void Browser_View::__load_nonempty_layout_finished_cb(void *data, Evas_Object *obj, void *event_info)
895 BROWSER_LOGD("[%s]", __func__);
899 Browser_View *browser_view = (Browser_View *)data;
901 if (!browser_view->_is_loading())
904 #ifdef BROWSER_SCROLLER_BOUNCING
905 /* If the first content is displayed, hide the url layout in browser scroller like safari. */
909 elm_scroller_region_get(browser_view->m_scroller, &scroller_x, NULL, &scroller_w, &scroller_h);
910 elm_scroller_region_show(browser_view->m_scroller ,scroller_x, 0,
911 scroller_w, scroller_h);
915 void Browser_View::__title_changed_cb(void *data, Evas_Object *obj, void *event_info)
917 BROWSER_LOGD("[%s]", __func__);
921 Browser_View *browser_view = (Browser_View *)data;
922 if (browser_view->_get_edit_mode() != BR_NO_EDIT_MODE)
925 if (!m_data_manager->is_in_view_stack(BR_MULTI_WINDOW_VIEW))
926 browser_view->_set_navigationbar_title(browser_view->get_title().c_str());
929 void Browser_View::__load_finished_cb(void *data, Evas_Object *obj, void *event_info)
931 BROWSER_LOGD("[%s]", __func__);
935 Browser_View *browser_view = (Browser_View *)data;
936 Evas_Object *progressbar_wheel = browser_view->m_url_progresswheel;
937 Evas_Object *option_header_progressbar_wheel = browser_view->m_option_header_url_progresswheel;
939 elm_progressbar_pulse(progressbar_wheel, EINA_FALSE);
940 elm_progressbar_pulse(option_header_progressbar_wheel, EINA_FALSE);
943 * For the first time, the background color is white initially.
944 * If the background is not displayed yet, show the grey background.
945 * This code is executed only one time at launching time.
947 const char* state = edje_object_part_state_get(elm_layout_edje_get(browser_view->m_main_layout),
948 "contents_bg", NULL);
949 if(state && !strncmp(state, "default", strlen("default")))
950 edje_object_signal_emit(elm_layout_edje_get(browser_view->m_main_layout),
951 "show,grey_background,signal", "");
953 if (browser_view->m_edit_mode != BR_URL_ENTRY_EDIT_MODE
954 && browser_view->m_edit_mode != BR_URL_ENTRY_EDIT_MODE_WITH_NO_IMF) {
955 /* change the url layout for normal mode. (change the reload icon etc) */
956 edje_object_signal_emit(elm_layout_edje_get(browser_view->m_url_entry_layout), "loading,off,signal", "");
957 edje_object_signal_emit(elm_layout_edje_get(browser_view->m_option_header_url_entry_layout),
958 "loading,off,signal", "");
961 if (!m_data_manager->is_in_view_stack(BR_MULTI_WINDOW_VIEW))
962 browser_view->_set_navigationbar_title(browser_view->get_title().c_str());
965 * finish progress event can be come after finish progress frame event at some pages.
966 * In this case, the title & favicon display error happens, becaue these are handled in finish progress frame.
967 * So do that again here. */
968 if (!browser_view->_set_favicon())
969 BROWSER_LOGE("_set_favicon failed");
970 browser_view->_set_secure_icon();
971 browser_view->_load_finished();
974 static Eina_Bool __kill_browser_timer_cb(void *data)
977 return ECORE_CALLBACK_CANCEL;
980 void Browser_View::__process_crashed_cb(void *data, Evas_Object *obj, void *event_info)
982 BROWSER_LOGD("[%s]", __func__);
986 Browser_View *browser_view = (Browser_View *)data;
987 browser_view->show_msg_popup(BR_STRING_WEBPROCESS_CRASH, 3);
988 ecore_timer_add(3, __kill_browser_timer_cb, NULL);
991 void Browser_View::__did_finish_load_for_frame_cb(void *data, Evas_Object *obj, void *event_info)
996 Browser_View *browser_view = (Browser_View *)data;
998 if (!m_data_manager->is_in_view_stack(BR_MULTI_WINDOW_VIEW))
999 browser_view->_set_navigationbar_title(browser_view->get_title().c_str());
1001 browser_view->_load_finished();
1004 void Browser_View::_set_secure_icon(void)
1006 std::string url = get_url();
1007 BROWSER_LOGD("url=[%s]", url.c_str());
1009 if (m_focused_window->m_secure_icon == NULL) {
1010 m_focused_window->m_secure_icon = elm_icon_add(m_focused_window->m_ewk_view);
1011 if (!m_focused_window->m_secure_icon) {
1012 BROWSER_LOGE("elm_icon_add is failed.");
1016 if (!elm_icon_file_set(m_focused_window->m_secure_icon, BROWSER_IMAGE_DIR"/lock.png", NULL)) {
1017 BROWSER_LOGE("elm_icon_file_set is failed.");
1020 evas_object_size_hint_aspect_set(m_focused_window->m_secure_icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
1021 elm_object_part_content_set(m_url_entry_layout, "elm.swallow.secure_icon",
1022 m_focused_window->m_secure_icon);
1025 if (m_focused_window->m_option_header_secure_icon == NULL) {
1026 m_focused_window->m_option_header_secure_icon = elm_icon_add(m_focused_window->m_ewk_view);
1027 if (!m_focused_window->m_option_header_secure_icon) {
1028 BROWSER_LOGE("elm_icon_add is failed.");
1032 if (!elm_icon_file_set(m_focused_window->m_option_header_secure_icon, BROWSER_IMAGE_DIR"/lock.png", NULL)) {
1033 BROWSER_LOGE("elm_icon_file_set is failed.");
1036 evas_object_size_hint_aspect_set(m_focused_window->m_option_header_secure_icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
1037 elm_object_part_content_set(m_option_header_url_entry_layout, "elm.swallow.secure_icon",
1038 m_focused_window->m_option_header_secure_icon);
1041 if (url.c_str() && url.length()) {
1042 if (!strncmp(url.c_str(), BROWSER_HTTPS_SCHEME, strlen(BROWSER_HTTPS_SCHEME))) {
1043 edje_object_signal_emit(elm_layout_edje_get(m_url_entry_layout),
1044 "show,secure_icon,signal", "");
1045 edje_object_signal_emit(elm_layout_edje_get(m_option_header_url_entry_layout),
1046 "show,secure_icon,signal", "");
1050 edje_object_signal_emit(elm_layout_edje_get(m_url_entry_layout), "hide,secure_icon,signal", "");
1051 edje_object_signal_emit(elm_layout_edje_get(m_option_header_url_entry_layout),
1052 "hide,secure_icon,signal", "");
1055 #if defined(FEATURE_MOST_VISITED_SITES)
1056 Eina_Bool Browser_View::_capture_most_visited_sites_item_screen_shot(void)
1058 BROWSER_LOGD("[%s]", __func__);
1060 Eina_Bool is_ranked = EINA_FALSE;
1061 std::string screen_shot_path;
1062 std::string current_url = get_url();
1063 screen_shot_path.clear();
1065 if (!m_selected_most_visited_sites_item_info.url.empty()) {
1066 std::string history_id;
1067 history_id = m_most_visited_sites_db->get_history_id_by_url(get_url().c_str());
1068 if (!history_id.empty()) {
1069 std::string history_title;
1070 history_title = m_most_visited_sites_db->get_history_title_by_id(history_id.c_str());
1071 if (!history_title.empty()) {
1072 if (!m_most_visited_sites_db->save_most_visited_sites_item(m_selected_most_visited_sites_item_info.index,
1073 get_url().c_str(), history_title.c_str(), history_id.c_str()))
1074 BROWSER_LOGE("save_most_visited_sites_item failed");
1076 if (!m_most_visited_sites_db->save_most_visited_sites_item(m_selected_most_visited_sites_item_info.index,
1077 get_url().c_str(), m_selected_most_visited_sites_item_info.title.c_str(),
1078 history_id.c_str()))
1079 BROWSER_LOGE("save_most_visited_sites_item failed");
1083 m_selected_most_visited_sites_item_info.url.clear();
1084 m_selected_most_visited_sites_item_info.title.clear();
1085 m_selected_most_visited_sites_item_info.id.clear();
1088 std::vector<Most_Visited_Sites_DB::most_visited_sites_entry> most_visited_sites_list;
1089 if (!m_most_visited_sites_db->get_most_visited_sites_list(most_visited_sites_list)) {
1090 BROWSER_LOGE("get_most_visited_sites_list failed");
1094 for (int i = 0 ; i < most_visited_sites_list.size() ; i++) {
1095 if (!current_url.empty() && !most_visited_sites_list[i].url.empty()
1096 && (current_url.length() == most_visited_sites_list[i].url.length())
1097 && !strncmp(most_visited_sites_list[i].url.c_str(), current_url.c_str(), current_url.length())) {
1098 is_ranked = EINA_TRUE;
1099 screen_shot_path = std::string(BROWSER_SCREEN_SHOT_DIR)
1100 + most_visited_sites_list[i].id;
1101 if (most_visited_sites_list[i].id.length() > strlen(DEFAULT_ICON_PREFIX) &&
1102 !strncmp(DEFAULT_ICON_PREFIX, most_visited_sites_list[i].id.c_str(),
1103 strlen(DEFAULT_ICON_PREFIX))) {
1104 /* If default icon */
1105 std::string history_id;
1106 history_id = m_most_visited_sites_db->get_history_id_by_url(most_visited_sites_list[i].url.c_str());
1107 if (!history_id.empty()) {
1108 if (m_most_visited_sites_db->save_most_visited_sites_item(most_visited_sites_list[i].index,
1109 most_visited_sites_list[i].url.c_str(), most_visited_sites_list[i].title.c_str(),
1110 history_id.c_str())) {
1111 screen_shot_path = std::string(BROWSER_SCREEN_SHOT_DIR)
1112 + most_visited_sites_list[i].id;
1113 remove(screen_shot_path.c_str());
1114 screen_shot_path = std::string(BROWSER_SCREEN_SHOT_DIR)
1124 std::vector<Most_Visited_Sites_DB::most_visited_sites_entry> most_visited_list;
1125 if (!m_most_visited_sites_db->get_most_visited_list(most_visited_list, most_visited_sites_list,
1126 BROWSER_MOST_VISITED_SITES_ITEM_MAX * 2)) {
1127 BROWSER_LOGE("get_most_visited_list failed");
1130 for (int i = 0; i < most_visited_list.size(); i++)
1132 if (most_visited_list[i].url == current_url) {
1133 is_ranked = EINA_TRUE;
1134 screen_shot_path = std::string(BROWSER_SCREEN_SHOT_DIR)
1135 + most_visited_list[i].id;
1141 if (is_ranked && screen_shot_path.size() > 0) {
1142 int focused_ewk_view_w = 0;
1143 int focused_ewk_view_h = 0;
1144 evas_object_geometry_get(m_focused_window->m_ewk_view, NULL, NULL,
1145 &focused_ewk_view_w, &focused_ewk_view_h);
1148 evas_object_geometry_get(m_win, NULL, NULL, &window_w, NULL);
1149 int item_w = window_w / 3;
1150 int item_h = item_w + 10 * elm_scale_get();
1152 double ratio = (double)((double)item_h / (double)item_w);
1154 Eina_Rectangle snapshot_rect;
1155 snapshot_rect.x = snapshot_rect.y = 0;
1156 snapshot_rect.w = focused_ewk_view_w;
1157 snapshot_rect.h = focused_ewk_view_w * ratio;
1159 Evas_Object *snapshot = ewk_view_screenshot_contents_get(m_focused_window->m_ewk_view,
1160 snapshot_rect, 0.33, evas_object_evas_get(m_navi_bar));
1162 BROWSER_LOGE("ewk_view_screenshot_contents_get failed");
1165 uint8_t *pixels = (uint8_t *)(evas_object_image_data_get(snapshot, EINA_TRUE));
1167 int surface_width = 0;
1168 int surface_height = 0;
1169 evas_object_image_size_get(snapshot, &surface_width, &surface_height);
1170 BROWSER_LOGD("<<<< surface_width = %d, surface_height = %d >>>", surface_width, surface_height);
1172 cairo_surface_t *snapshot_surface = cairo_image_surface_create_for_data(pixels, CAIRO_FORMAT_RGB24,
1173 surface_width, surface_height,
1174 cairo_format_stride_for_width(CAIRO_FORMAT_RGB24, surface_width));
1175 if (!snapshot_surface) {
1176 BROWSER_LOGE("cairo_image_surface_create_for_data failed");
1180 if (cairo_surface_write_to_png(snapshot_surface, screen_shot_path.c_str())
1181 != CAIRO_STATUS_SUCCESS)
1182 BROWSER_LOGD("cairo_surface_write_to_png FAILED");
1183 cairo_surface_destroy(snapshot_surface);
1188 Eina_Bool Browser_View::__capture_most_visited_sites_screen_shot_idler_cb(void *data)
1190 BROWSER_LOGD("[%s]", __func__);
1192 return ECORE_CALLBACK_CANCEL;
1194 Browser_View *browser_view = (Browser_View *)data;
1195 if (!browser_view->_capture_most_visited_sites_item_screen_shot())
1196 BROWSER_LOGE("_capture_most_visited_sites_item_screen_shot failed");
1198 return ECORE_CALLBACK_CANCEL;
1202 void Browser_View::_load_finished(void)
1204 BROWSER_LOGD("[%s]", __func__);
1206 /* enable or disable back,forward controlbar buttons */
1207 _set_controlbar_back_forward_status();
1209 if (!_set_favicon())
1210 BROWSER_LOGE("_set_favicon failed");
1213 /* Add current url to history */
1214 Eina_Bool is_full = EINA_FALSE;
1216 /* Save last visited url to save this when browser exits. */
1217 m_last_visited_url = get_url();
1219 if (m_data_manager->get_history_db() && !m_is_private) {
1220 m_data_manager->get_history_db()->save_history(m_last_visited_url.c_str(),
1221 get_title().c_str(), &is_full);
1223 BROWSER_LOGE("history is full, delete the first one");
1226 _hide_scroller_url_layout();
1228 #if defined(FEATURE_MOST_VISITED_SITES)
1229 ecore_idler_add(__capture_most_visited_sites_screen_shot_idler_cb, this);
1232 elm_object_focus_set(m_option_header_cancel_button, EINA_TRUE);
1233 elm_object_signal_emit(m_option_header_url_edit_field, "ellipsis_show,signal", "elm");
1234 elm_object_signal_emit(m_url_edit_field, "ellipsis_show,signal", "elm");
1236 _update_back_forward_buttons();
1239 void Browser_View::_hide_scroller_url_layout(void)
1241 BROWSER_LOGD("[%s]", __func__);
1243 if (_get_edit_mode() != BR_NO_EDIT_MODE
1244 #if defined(FEATURE_MOST_VISITED_SITES)
1245 || is_most_visited_sites_running()
1250 _navigationbar_visible_set_signal(EINA_FALSE);
1252 int browser_scroller_x = 0;
1253 int browser_scroller_w = 0;
1254 int browser_scroller_h = 0;
1255 elm_scroller_region_get(m_scroller, &browser_scroller_x, NULL,
1256 &browser_scroller_w, &browser_scroller_h);
1258 int url_layout_h = 0;
1259 evas_object_geometry_get(m_url_layout, NULL, NULL, NULL, &url_layout_h);
1260 elm_scroller_region_show(m_scroller, browser_scroller_x, url_layout_h,
1261 browser_scroller_w, browser_scroller_h);
1264 void Browser_View::__load_progress_cb(void *data, Evas_Object *obj, void *event_info)
1269 Browser_View *browser_view = (Browser_View *)data;
1270 Evas_Object *url_progressbar = browser_view->m_url_progressbar;
1271 Evas_Object *option_header_url_progressbar = browser_view->m_option_header_url_progressbar;
1273 double progress = ewk_view_load_progress_get(browser_view->m_focused_window->m_ewk_view);
1274 elm_progressbar_value_set(url_progressbar, progress);
1275 elm_progressbar_value_set(option_header_url_progressbar, progress);
1277 if (progress == 1.0f)
1278 __load_finished_cb(data, obj, NULL);
1281 void Browser_View::__ewk_view_mouse_down_cb(void* data, Evas* evas, Evas_Object* obj, void* ev)
1286 Browser_View *browser_view = (Browser_View *)data;
1287 Evas_Event_Mouse_Down event = *(Evas_Event_Mouse_Down *)ev;
1288 Evas_Object *main_layout = browser_view->m_main_layout;
1289 Evas_Object *ewk_view = browser_view->m_focused_window->m_ewk_view;
1291 #if defined(FEATURE_MOST_VISITED_SITES)
1292 if (browser_view->is_most_visited_sites_running())
1296 #ifdef BROWSER_SCROLLER_BOUNCING
1297 /* activate webview firstly when user starts to touch. */
1298 browser_view->_enable_webview_scroll();
1301 if (!browser_view->_is_loading() && browser_view->_get_edit_mode() != BR_FIND_WORD_MODE)
1302 browser_view->_navigationbar_visible_set(EINA_FALSE);
1304 browser_view->m_is_scrolling = EINA_TRUE;
1306 BROWSER_LOGD("__ewk_view_mouse_down_cb");
1309 double scale_factor = ewk_view_scale_get(browser_view->m_focused_window->m_ewk_view);
1310 double min_scale = 0;
1311 double max_scale = 0;
1313 bool zoom_button_flag = true;
1314 if (br_preference_get_bool(ZOOM_BUTTON_KEY, &zoom_button_flag) == false)
1315 BROWSER_LOGE("failed to get ZOOM_BUTTON_KEY value\n");
1317 BROWSER_LOGD("zoom_button_flag =%d", zoom_button_flag);
1319 if (zoom_button_flag == false)
1323 ewk_view_scale_range_get(browser_view->m_focused_window->m_ewk_view,
1324 &min_scale, &max_scale);
1325 if (scale_factor > min_scale && scale_factor < max_scale) {
1326 if (browser_view->m_zoom_button_timer)
1327 ecore_timer_del(browser_view->m_zoom_button_timer);
1328 browser_view->m_zoom_button_timer = ecore_timer_add(3, __zoom_button_timeout_cb, browser_view);
1329 edje_object_signal_emit(elm_layout_edje_get(browser_view->m_main_layout), "show,zoom_buttons,signal", "");
1334 void Browser_View::__ewk_view_enter_full_screen_cb(void *data, Evas_Object *obj, void *event_info)
1339 Browser_View *browser_view = (Browser_View *)data;
1340 browser_view->set_full_sreen(EINA_TRUE);
1343 void Browser_View::__ewk_view_exit_full_screen_cb(void *data, Evas_Object *obj, void *event_info)
1348 Browser_View *browser_view = (Browser_View *)data;
1349 browser_view->set_full_sreen(EINA_FALSE);
1352 void Browser_View::__ewk_view_vibration_vibrate_cb(void *data, Evas_Object *obj, void *event_info)
1354 Browser_View *browser_view = (Browser_View*)data;
1355 const long vibration_time = *((const long *)event_info);
1357 BROWSER_LOGD("__ewk_view_vibration_vibrate_cb : play time is [%ld]", vibration_time);
1359 browser_view->_haptic_device_play(vibration_time);
1362 void Browser_View::__ewk_view_vibration_cancel_cb(void *data, Evas_Object *obj, void *event_info)
1364 BROWSER_LOGD("[%s]", __func__);
1366 Browser_View *browser_view = (Browser_View*)data;
1368 browser_view->_haptic_device_stop();
1371 void Browser_View::__ewk_view_mouse_up_cb(void* data, Evas* evas, Evas_Object* obj, void* ev)
1376 Browser_View *browser_view = (Browser_View *)data;
1378 browser_view->m_is_scrolling = EINA_FALSE;
1381 void Browser_View::__ewk_view_edge_top_cb(void *data, Evas_Object *obj, void *event_info)
1383 #ifdef BROWSER_SCROLLER_BOUNCING
1384 BROWSER_LOGD("[%s]", __func__);
1388 Browser_View *browser_view = (Browser_View *)data;
1389 browser_view->_enable_browser_scroller_scroll();
1391 /* If user do flicking the mouse with scroll up, bring in the browser scroller to y=0. */
1392 if (!browser_view->m_is_scrolling) {
1393 BROWSER_LOGD("<< elm_scroller_region_bring_in >>");
1394 int browser_scroller_x = 0;
1395 int browser_scroller_w = 0;
1396 int browser_scroller_h = 0;
1397 elm_scroller_region_get(browser_view->m_scroller, &browser_scroller_x, NULL,
1398 &browser_scroller_w, &browser_scroller_h);
1400 elm_scroller_region_bring_in(browser_view->m_scroller, browser_scroller_x, 0,
1401 browser_scroller_w, browser_scroller_h);
1406 void Browser_View::__ewk_view_scroll_down_cb(void *data, Evas_Object *obj, void *event_info)
1408 #ifdef BROWSER_SCROLLER_BOUNCING
1411 Browser_View *browser_view = (Browser_View *)data;
1417 int url_layout_h = 0;
1418 elm_scroller_region_get(browser_view->m_scroller, &scroller_x, &scroller_y, &scroller_w, &scroller_h);
1419 evas_object_geometry_get(browser_view->m_url_layout, NULL, NULL, NULL, &url_layout_h);
1421 if (scroller_y < url_layout_h) {
1422 /* We have to hide urlbar when webview's contents are scrolled down by flicking. */
1423 if (!browser_view->m_is_scrolling)
1424 elm_scroller_region_show(browser_view->m_scroller, scroller_x, url_layout_h, scroller_w, scroller_h);
1426 browser_view->_enable_browser_scroller_scroll();
1428 browser_view->_enable_webview_scroll();
1433 void Browser_View::__ewk_view_scroll_up_cb(void *data, Evas_Object *obj, void *event_info)
1435 #ifdef BROWSER_SCROLLER_BOUNCING
1439 Browser_View *browser_view = (Browser_View *)data;
1440 browser_view->_enable_webview_scroll();
1444 void Browser_View::_set_navigationbar_title(const char *title)
1446 BROWSER_LOGD("title=[%s]", title);
1447 edje_object_part_text_set(elm_layout_edje_get(m_url_layout),
1448 "title_text", title);
1449 edje_object_part_text_set(elm_layout_edje_get(m_option_header_url_layout),
1450 "title_text", title);
1454 void Browser_View::_set_url_entry(const char *url, Eina_Bool set_secrue_icon)
1456 BROWSER_LOGD("url=[%s]", url);
1457 if (url && strlen(url)) {
1458 std::string url_without_http_scheme;
1459 if (strstr(url, BROWSER_HTTP_SCHEME) && strlen(url) > strlen(BROWSER_HTTP_SCHEME))
1460 url_without_http_scheme = std::string(url + strlen(BROWSER_HTTP_SCHEME));
1462 url_without_http_scheme = std::string(url);
1464 char *mark_up_url = elm_entry_utf8_to_markup(url_without_http_scheme.c_str());
1466 Evas_Object *entry = br_elm_editfield_entry_get(m_url_edit_field);
1467 elm_entry_entry_set(entry, mark_up_url);
1468 entry = br_elm_editfield_entry_get(m_option_header_url_edit_field);
1469 elm_entry_entry_set(entry, mark_up_url);
1471 edje_object_part_text_set(elm_layout_edje_get(m_option_header_url_edit_field),
1472 "elm.text.ellipsis", mark_up_url);
1473 edje_object_part_text_set(elm_layout_edje_get(m_url_edit_field),
1474 "elm.text.ellipsis", mark_up_url);
1478 Evas_Object *entry = br_elm_editfield_entry_get(m_url_edit_field);
1479 #if defined(FEATURE_MOST_VISITED_SITES)
1480 elm_entry_entry_set(entry, BROWSER_MOST_VISITED_SITES_URL);
1482 elm_entry_entry_set(entry, BROWSER_BLANK_PAGE_URL);
1484 entry = br_elm_editfield_entry_get(m_option_header_url_edit_field);
1485 #if defined(FEATURE_MOST_VISITED_SITES)
1486 elm_entry_entry_set(entry, BROWSER_MOST_VISITED_SITES_URL);
1488 edje_object_part_text_set(elm_layout_edje_get(m_option_header_url_edit_field),
1489 "elm.text.ellipsis", BROWSER_MOST_VISITED_SITES_URL);
1490 edje_object_part_text_set(elm_layout_edje_get(m_url_edit_field),
1491 "elm.text.ellipsis", BROWSER_MOST_VISITED_SITES_URL);
1493 elm_entry_entry_set(entry, BROWSER_BLANK_PAGE_URL);
1495 edje_object_part_text_set(elm_layout_edje_get(m_option_header_url_edit_field),
1496 "elm.text.ellipsis", BROWSER_BLANK_PAGE_URL);
1497 edje_object_part_text_set(elm_layout_edje_get(m_url_edit_field),
1498 "elm.text.ellipsis", BROWSER_BLANK_PAGE_URL);
1502 if (set_secrue_icon)
1506 void Browser_View::_stop_loading(void)
1508 BROWSER_LOGD("[%s]", __func__);
1509 if (m_focused_window->m_ewk_view)
1510 ewk_view_stop(m_focused_window->m_ewk_view);
1513 void Browser_View::_reload(void)
1515 BROWSER_LOGD("[%s]", __func__);
1516 if (m_focused_window->m_ewk_view)
1517 ewk_view_reload_bypass_cache(m_focused_window->m_ewk_view);
1520 void Browser_View::set_focused_window(Browser_Window *window
1521 #if defined(FEATURE_MOST_VISITED_SITES)
1522 ,Eina_Bool show_most_visited_sites
1526 BROWSER_LOGD("[%s]", __func__);
1527 if (m_focused_window && m_focused_window->m_ewk_view_layout) {
1528 elm_box_unpack(m_content_box, m_focused_window->m_ewk_view_layout);
1529 evas_object_hide(m_focused_window->m_ewk_view_layout);
1532 if (m_focused_window && m_focused_window->m_favicon) {
1533 if (elm_object_part_content_get(m_url_entry_layout, "elm.swallow.favicon"))
1534 elm_object_part_content_unset(m_url_entry_layout, "elm.swallow.favicon");
1536 evas_object_hide(m_focused_window->m_favicon);
1538 if (m_focused_window && m_focused_window->m_option_header_favicon) {
1539 if (elm_object_part_content_get(m_option_header_url_entry_layout, "elm.swallow.favicon"))
1540 elm_object_part_content_unset(m_option_header_url_entry_layout, "elm.swallow.favicon");
1542 evas_object_hide(m_focused_window->m_option_header_favicon);
1545 m_focused_window = window;
1547 if (!m_focused_window->m_ewk_view_layout) {
1548 m_focused_window->m_ewk_view_layout = elm_layout_add(m_navi_bar);
1549 if (!m_focused_window->m_ewk_view_layout) {
1550 BROWSER_LOGE("elm_layout_add failed!");
1553 if (!elm_layout_file_set(m_focused_window->m_ewk_view_layout,
1554 BROWSER_EDJE_DIR"/browser-view-main.edj",
1555 "browser/browser-view-webview")) {
1556 BROWSER_LOGE("elm_layout_file_set failed", BROWSER_EDJE_DIR);
1559 evas_object_size_hint_weight_set(m_focused_window->m_ewk_view_layout,
1560 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1561 evas_object_size_hint_align_set(m_focused_window->m_ewk_view_layout,
1562 EVAS_HINT_FILL, EVAS_HINT_FILL);
1563 elm_box_pack_end(m_content_box, m_focused_window->m_ewk_view_layout);
1564 evas_object_show(m_focused_window->m_ewk_view_layout);
1566 elm_object_part_content_set(m_focused_window->m_ewk_view_layout, "elm.swallow.webview",
1567 m_focused_window->m_ewk_view);
1568 evas_object_show(m_focused_window->m_ewk_view);
1572 * If launch the browser by aul, the grey bg is displayed shortly. */
1573 edje_object_signal_emit(elm_layout_edje_get(m_main_layout),
1574 "hide,grey_background,signal", "");
1576 * The webview layout is not resized whenever repack to content box.
1577 * So resize the webview layout whenever repack. */
1578 m_resize_idler = ecore_idler_add(__webview_layout_resize_idler_cb, this);
1580 elm_box_pack_end(m_content_box, m_focused_window->m_ewk_view_layout);
1581 evas_object_show(m_focused_window->m_ewk_view_layout);
1582 evas_object_show(m_focused_window->m_ewk_view);
1585 if (!_is_loading()) {
1586 edje_object_signal_emit(elm_layout_edje_get(m_url_entry_layout), "loading,off,signal", "");
1587 edje_object_signal_emit(elm_layout_edje_get(m_option_header_url_entry_layout),
1588 "loading,off,signal", "");
1589 elm_progressbar_pulse(m_url_progresswheel, EINA_FALSE);
1590 elm_progressbar_pulse(m_option_header_url_progresswheel, EINA_FALSE);
1593 /* show or hide favicon in url layout. */
1594 if (m_focused_window->m_favicon
1595 #if defined(FEATURE_MOST_VISITED_SITES)
1596 && !is_most_visited_sites_running()
1599 if (elm_object_part_content_get(m_url_entry_layout, "elm.swallow.favicon"))
1600 elm_object_part_content_unset(m_url_entry_layout, "elm.swallow.favicon");
1602 elm_object_part_content_set(m_url_entry_layout, "elm.swallow.favicon",
1603 m_focused_window->m_favicon);
1604 edje_object_signal_emit(elm_layout_edje_get(m_url_entry_layout),
1605 "show,favicon,signal", "");
1606 evas_object_show(m_focused_window->m_favicon);
1609 edje_object_signal_emit(elm_layout_edje_get(m_url_entry_layout),
1610 "hide,favicon,signal", "");
1613 /* show or hide favicon in option header url layout. */
1614 if (m_focused_window->m_option_header_favicon
1615 #if defined(FEATURE_MOST_VISITED_SITES)
1616 && !is_most_visited_sites_running()
1619 if (elm_object_part_content_get(m_option_header_url_entry_layout, "elm.swallow.favicon"))
1620 elm_object_part_content_unset(m_option_header_url_entry_layout, "elm.swallow.favicon");
1622 elm_object_part_content_set(m_option_header_url_entry_layout, "elm.swallow.favicon",
1623 m_focused_window->m_option_header_favicon);
1624 edje_object_signal_emit(elm_layout_edje_get(m_option_header_url_entry_layout),
1625 "show,favicon,signal", "");
1627 evas_object_show(m_focused_window->m_option_header_favicon);
1629 edje_object_signal_emit(elm_layout_edje_get(m_option_header_url_entry_layout),
1630 "hide,favicon,signal", "");
1633 #if defined(FEATURE_MOST_VISITED_SITES)
1634 if (show_most_visited_sites) {
1635 if (get_url().empty())
1636 _show_most_visited_sites(EINA_TRUE);
1638 _show_most_visited_sites(EINA_FALSE);
1642 std::vector<Browser_Window *> window_list = m_browser->get_window_list();
1643 _set_multi_window_controlbar_text(window_list.size());
1645 if (!_set_favicon())
1646 BROWSER_LOGE("_set_favicon failed");
1648 _update_back_forward_buttons();
1650 /* Without this code, the url is empty shortly when create deleted-window in multi window. */
1651 if (get_url().empty() && !m_focused_window->m_url.empty())
1652 _set_url_entry(m_focused_window->m_url.c_str());
1654 _set_url_entry(get_url().c_str());
1656 if (window_list.size() >= BROWSER_MULTI_WINDOW_MAX_COUNT)
1657 elm_object_item_disabled_set(m_new_window_button, EINA_TRUE);
1659 elm_object_item_disabled_set(m_new_window_button, EINA_FALSE);
1662 #if defined(FEATURE_MOST_VISITED_SITES)
1663 Eina_Bool Browser_View::_show_most_visited_sites(Eina_Bool is_show)
1665 BROWSER_LOGD("[%s]is_show=%d", __func__, is_show);
1667 m_selected_most_visited_sites_item_info.url.clear();
1668 m_selected_most_visited_sites_item_info.title.clear();
1669 m_selected_most_visited_sites_item_info.id.clear();
1671 if (!m_most_visited_sites) {
1672 m_most_visited_sites = new(nothrow) Most_Visited_Sites(m_navi_bar, this, m_most_visited_sites_db);
1673 if (!m_most_visited_sites) {
1674 BROWSER_LOGE("new Most_Visited_Sites failed");
1678 Evas_Object *most_visited_sites_layout = m_most_visited_sites->create_most_visited_sites_main_layout();
1679 if (!most_visited_sites_layout) {
1680 BROWSER_LOGE("create_most_visited_sites_main_layout failed");
1681 if (m_most_visited_sites) {
1682 delete m_most_visited_sites;
1683 m_most_visited_sites = NULL;
1687 elm_object_part_content_set(m_main_layout, "elm.swallow.most_visited_sites", most_visited_sites_layout);
1688 edje_object_signal_emit(elm_layout_edje_get(m_main_layout),
1689 "show,most_visited_sites,signal", "");
1690 edje_object_signal_emit(elm_layout_edje_get(m_main_layout),
1691 "show,control_bar,no_animation,signal", "");
1693 /* change the url layout for normal mode. (change the reload icon etc) */
1694 edje_object_signal_emit(elm_layout_edje_get(m_url_entry_layout), "loading,off,signal", "");
1695 edje_object_signal_emit(elm_layout_edje_get(m_option_header_url_entry_layout),
1696 "loading,off,signal", "");
1698 edje_object_part_text_set(elm_layout_edje_get(m_url_entry_layout),
1699 "url_guide_text", BR_STRING_URL_GUIDE_TEXT);
1700 edje_object_part_text_set(elm_layout_edje_get(m_option_header_url_entry_layout),
1701 "url_guide_text", BR_STRING_URL_GUIDE_TEXT);
1703 edje_object_signal_emit(elm_layout_edje_get(m_url_entry_layout), "url_guide_text,on,signal", "");
1704 edje_object_signal_emit(elm_layout_edje_get(m_option_header_url_entry_layout),
1705 "url_guide_text,on,signal", "");
1707 _set_navigationbar_title(BR_STRING_MOST_VISITED_SITES);
1708 _set_url_entry(BROWSER_MOST_VISITED_SITES_URL);
1710 /* If the speed dial is displayed for the first time, destroy the progress wheel. */
1711 if (m_dummy_loading_progressbar) {
1712 elm_object_part_content_unset(m_main_layout, "elm.swallow.waiting_progress");
1713 evas_object_del(m_dummy_loading_progressbar);
1714 m_dummy_loading_progressbar = NULL;
1715 edje_object_signal_emit(elm_layout_edje_get(m_main_layout),
1716 "hide,waiting_progressbar,signal", "");
1719 elm_object_item_disabled_set(m_add_bookmark_button, EINA_TRUE);
1725 elm_scroller_region_get(m_scroller, &scroller_x, NULL, &scroller_w, &scroller_h);
1726 elm_scroller_region_show(m_scroller ,scroller_x, 0, scroller_w, scroller_h);
1728 _navigationbar_visible_set_signal(EINA_TRUE);
1730 edje_object_signal_emit(elm_layout_edje_get(m_url_entry_layout),
1731 "hide,favicon,signal", "");
1732 edje_object_signal_emit(elm_layout_edje_get(m_option_header_url_entry_layout),
1733 "hide,favicon,signal", "");
1735 #ifdef BROWSER_SCROLLER_BOUNCING
1736 BROWSER_LOGD("<< lock browser scroller >>");
1737 elm_object_scroll_freeze_pop(m_scroller);
1738 elm_object_scroll_freeze_push(m_scroller);
1741 if (m_most_visited_sites) {
1742 if (elm_object_part_content_get(m_main_layout, "elm.swallow.most_visited_sites"))
1743 elm_object_part_content_unset(m_main_layout, "elm.swallow.most_visited_sites");
1744 edje_object_signal_emit(elm_layout_edje_get(m_main_layout),
1745 "hide,most_visited_sites,signal", "");
1746 edje_object_signal_emit(elm_layout_edje_get(m_main_layout),
1747 "hide,most_visited_sites_guide_text,signal", "");
1749 edje_object_signal_emit(elm_layout_edje_get(m_url_entry_layout), "url_guide_text,off,signal", "");
1750 edje_object_signal_emit(elm_layout_edje_get(m_option_header_url_entry_layout),
1751 "url_guide_text,off,signal", "");
1753 delete m_most_visited_sites;
1754 m_most_visited_sites = NULL;
1756 elm_object_item_disabled_set(m_add_bookmark_button, EINA_FALSE);
1763 void Browser_View::load_url(const char *url)
1765 BROWSER_LOGD("[%s]", __func__);
1766 #if defined(FEATURE_MOST_VISITED_SITES)
1767 if (!url || !strlen(url)) {
1768 if (!_show_most_visited_sites(EINA_TRUE))
1769 BROWSER_LOGE("_show_most_visited_sites EINA_TRUE failed");
1773 if (!_show_most_visited_sites(EINA_FALSE))
1774 BROWSER_LOGE("_show_most_visited_sites EINA_FALSE failed");
1778 Evas_Object *edit_field_entry = br_elm_editfield_entry_get(_get_activated_url_entry());
1779 evas_object_smart_callback_del(edit_field_entry, "changed", __url_entry_changed_cb);
1781 std::string full_url;
1782 if (_has_url_sheme(url))
1785 full_url = std::string(BROWSER_HTTP_SCHEME) + std::string(url);
1787 BROWSER_LOGD("full_url = [%s]", full_url.c_str());
1789 _set_url_entry(full_url.c_str());
1791 ewk_view_uri_set(m_focused_window->m_ewk_view, full_url.c_str());
1794 string Browser_View::get_title(Browser_Window *window)
1796 const char *title = ewk_view_title_get(window->m_ewk_view);
1797 BROWSER_LOGD("title = [%s]", title);
1799 if (!window->m_ewk_view && !window->m_title.empty())
1800 return window->m_title;
1802 if (!window->m_ewk_view)
1803 return std::string();
1806 if (!window->m_title.empty())
1807 return window->m_title;
1809 return std::string();
1812 return std::string(title);
1815 string Browser_View::get_title(void)
1817 const char *title = ewk_view_title_get(m_focused_window->m_ewk_view);
1818 BROWSER_LOGD("title = [%s]", title);
1820 if (!title && m_focused_window->m_title.empty())
1821 return std::string();
1822 else if (!title && !m_focused_window->m_title.empty())
1823 return m_focused_window->m_title;
1825 if (title && strlen(title))
1826 return std::string(title);
1828 return std::string();
1831 string Browser_View::get_url(Browser_Window *window)
1833 BROWSER_LOGD("[%s]", __func__);
1835 if (!window->m_ewk_view && !window->m_url.empty())
1836 return window->m_url;
1838 if (!window->m_ewk_view)
1839 return std::string();
1841 const char *uri = ewk_view_uri_get(window->m_ewk_view);
1842 BROWSER_LOGD("uri = [%s]", uri);
1844 if (!uri || strlen(uri) == 0)
1845 return std::string();
1847 return std::string(uri);
1850 string Browser_View::get_url(void)
1852 if (!m_focused_window) {
1853 BROWSER_LOGE("m_focused_window is NULL");
1854 return std::string();
1857 const char *uri = ewk_view_uri_get(m_focused_window->m_ewk_view);
1858 BROWSER_LOGD("uri = [%s]", uri);
1860 if (!uri || strlen(uri) == 0)
1861 return std::string();
1863 return std::string(uri);
1866 /* If multi window is running, unset the navigation title object,
1867 * else set the navigation title object to show title object arrow. */
1868 void Browser_View::unset_navigationbar_title_object(Eina_Bool is_unset)
1870 BROWSER_LOGD("[%s] is_unset =%d", __func__, is_unset);
1871 Elm_Object_Item *top_it = elm_naviframe_top_item_get(m_navi_bar);
1873 _navigationbar_visible_set_signal(EINA_FALSE);
1874 elm_object_item_part_content_unset(top_it, ELM_NAVIFRAME_ITEM_OPTIONHEADER);
1875 evas_object_hide(m_option_header_layout);
1877 Evas_Object *title_object = NULL;
1878 title_object = elm_object_item_part_content_get(top_it, ELM_NAVIFRAME_ITEM_OPTIONHEADER);
1879 if (!title_object) {
1880 elm_object_item_part_content_set(top_it, ELM_NAVIFRAME_ITEM_OPTIONHEADER,
1881 m_option_header_layout);
1882 evas_object_show(m_option_header_layout);
1884 #if defined(FEATURE_MOST_VISITED_SITES)
1885 if (!is_most_visited_sites_running())
1886 _navigationbar_visible_set_signal(EINA_FALSE);
1891 void Browser_View::__go_to_bookmark_cb(void *data, Evas_Object *obj, void *event_info)
1893 BROWSER_LOGD("[%s]", __func__);
1897 Browser_View *browser_view = (Browser_View *)data;
1899 if (!m_data_manager->create_bookmark_view()) {
1900 BROWSER_LOGE("m_data_manager->create_bookmark_view failed");
1904 if (!m_data_manager->get_bookmark_view()->init()) {
1905 BROWSER_LOGE("m_data_manager->get_bookmark_view()->init failed");
1906 m_data_manager->destroy_bookmark_view();
1909 browser_view->_destroy_more_context_popup();
1912 void Browser_View::__backward_cb(void *data, Evas_Object *obj, void *event_info)
1914 BROWSER_LOGD("[%s]", __func__);
1918 Browser_View *browser_view = (Browser_View *)data;
1919 __title_back_button_clicked_cb(data, NULL, NULL);
1921 browser_view->_destroy_more_context_popup();
1924 void Browser_View::__forward_cb(void *data, Evas_Object *obj, void *event_info)
1926 BROWSER_LOGD("[%s]", __func__);
1930 Browser_View *browser_view = (Browser_View *)data;
1931 browser_view->_destroy_more_context_popup();
1932 if (browser_view->m_focused_window->m_ewk_view
1933 && ewk_view_forward_possible(browser_view->m_focused_window->m_ewk_view))
1934 ewk_view_forward(browser_view->m_focused_window->m_ewk_view);
1938 void Browser_View::__web_app_capable_get_cb(Eina_Bool capable, void* user_data)
1940 BROWSER_LOGD("[%s]", __func__);
1945 Browser_View *browser_view = (Browser_View *)user_data;
1946 Evas_Object *webkit = browser_view->m_focused_window->m_ewk_view;
1948 ewk_view_web_application_icon_url_get(webkit, __web_app_icon_url_get_cb, browser_view);
1952 void Browser_View::__web_app_icon_url_get_cb(const char* icon_url, void* user_data)
1954 BROWSER_LOGD("icon_url:%s", icon_url);
1959 Browser_View *browser_view = (Browser_View *)user_data;
1961 /* make configure file */
1962 browser_view->m_meta_tag->create_config_xml((browser_view->get_url()).c_str(), browser_view->get_title().c_str(), NULL);
1963 if (!icon_url || strlen(icon_url) == 0) {
1964 BROWSER_LOGD("Failed to get webapp icon url, make widget with default icon");
1965 browser_view->m_meta_tag->wgt_install(NULL);
1967 BROWSER_LOGD("Succeed to get webapp icon url, make widget after icon downloaded");
1969 browser_view->m_meta_tag->request_download_icon(icon_url);
1974 void Browser_View::__url_editfield_share_clicked_cb(void *data, Evas_Object *obj, void *event_info)
1976 BROWSER_LOGD("[%s]", __func__);
1980 Browser_View *browser_view = (Browser_View *)data;
1981 const char *selected_text = elm_entry_selection_get(br_elm_editfield_entry_get(browser_view->m_option_header_url_edit_field));
1983 if (browser_view->_show_share_popup(selected_text))
1984 BROWSER_LOGE("_show_share_popup failed");
1987 Eina_Bool Browser_View::__show_scissorbox_view_idler_cb(void *data)
1990 return ECORE_CALLBACK_CANCEL;
1992 Browser_View *browser_view = (Browser_View *)data;
1994 if (browser_view->m_scissorbox_view)
1995 delete browser_view->m_scissorbox_view;
1997 browser_view->m_scissorbox_view = new(nothrow) Browser_Scissorbox_View(browser_view);
1998 if (!browser_view->m_scissorbox_view) {
1999 BROWSER_LOGE("new Browser_Scissorbox_View failed");
2000 return ECORE_CALLBACK_CANCEL;
2002 if (!browser_view->m_scissorbox_view->init()) {
2003 BROWSER_LOGE("m_scissorbox_view->init failed");
2004 delete browser_view->m_scissorbox_view;
2005 browser_view->m_scissorbox_view = NULL;
2006 return ECORE_CALLBACK_CANCEL;
2009 elm_object_part_content_set(browser_view->m_main_layout, "elm.swallow.scissorbox",
2010 browser_view->m_scissorbox_view->get_layout());
2011 edje_object_signal_emit(elm_layout_edje_get(browser_view->m_main_layout),
2012 "show,scissorbox,signal", "");
2014 edje_object_signal_emit(elm_layout_edje_get(browser_view->m_url_layout),
2015 "show,scissorbox,signal", "");
2016 edje_object_signal_emit(elm_layout_edje_get(browser_view->m_option_header_url_layout),
2017 "show,scissorbox,signal", "");
2020 elm_object_part_content_unset(browser_view->m_main_layout, "elm.swallow.control_bar");
2021 evas_object_hide(browser_view->m_control_bar);
2023 return ECORE_CALLBACK_CANCEL;
2026 Eina_Bool Browser_View::_show_scissorbox_view(void)
2028 BROWSER_LOGD("[%s]", __func__);
2030 // _hide_scroller_url_layout();
2032 ecore_idler_add(__show_scissorbox_view_idler_cb, this);
2037 void Browser_View::_destroy_scissorbox_view(void)
2039 elm_object_part_content_unset(m_main_layout, "elm.swallow.scissorbox");
2040 edje_object_signal_emit(elm_layout_edje_get(m_main_layout), "hide,scissorbox,signal", "");
2042 edje_object_signal_emit(elm_layout_edje_get(m_url_layout),
2043 "hide,scissorbox,signal", "");
2044 edje_object_signal_emit(elm_layout_edje_get(m_option_header_url_layout),
2045 "hide,scissorbox,signal", "");
2047 elm_object_part_content_unset(m_main_layout, "elm.swallow.control_bar");
2049 if (m_scissorbox_view) {
2050 delete m_scissorbox_view;
2051 m_scissorbox_view = NULL;
2054 elm_object_part_content_set(m_main_layout, "elm.swallow.control_bar", m_control_bar);
2055 evas_object_show(m_control_bar);
2058 void Browser_View::__share_cb(void *data, Evas_Object *obj, void *event_info)
2060 BROWSER_LOGD("[%s]", __func__);
2064 Browser_View *browser_view = (Browser_View *)data;
2065 browser_view->_destroy_more_context_popup();
2066 browser_view->_show_share_popup(browser_view->get_url().c_str());
2070 void Browser_View::__private_cb(void *data, Evas_Object *obj, void *event_info)
2072 BROWSER_LOGD("[%s]", __func__);
2076 Browser_View *browser_view = (Browser_View *)data;
2077 browser_view->m_is_private = !browser_view->m_is_private;
2079 browser_view->m_is_private_item_pressed = EINA_TRUE;
2081 elm_check_state_set(browser_view->m_private_check, browser_view->m_is_private);
2083 if (browser_view->m_is_private) {
2084 edje_object_signal_emit(elm_layout_edje_get(browser_view->m_url_entry_layout), "private,on,signal", "");
2085 edje_object_signal_emit(elm_layout_edje_get(browser_view->m_option_header_url_entry_layout), "private,on,signal", "");
2087 edje_object_signal_emit(elm_layout_edje_get(browser_view->m_url_entry_layout), "private,off,signal", "");
2088 edje_object_signal_emit(elm_layout_edje_get(browser_view->m_option_header_url_entry_layout), "private,off,signal", "");
2091 Ewk_Setting *setting = ewk_view_setting_get(browser_view->m_focused_window->m_ewk_view);
2092 ewk_setting_private_browsing_set(setting, browser_view->m_is_private);
2095 void Browser_View::__bookmark_cb(void *data, Evas_Object *obj, void *event_info)
2097 BROWSER_LOGD("[%s]", __func__);
2101 Browser_View *browser_view = (Browser_View *)data;
2102 int bookmark_id = -1;
2103 if(!m_data_manager->get_history_db()->is_in_bookmark(browser_view->get_url().c_str(), &bookmark_id)) {
2104 if (!elm_icon_file_set(browser_view->m_bookmark_on_off_icon, BROWSER_IMAGE_DIR"/I01_icon_bookmark_on.png", NULL)) {
2105 BROWSER_LOGE("elm_icon_file_set is failed.\n");
2108 m_data_manager->create_bookmark_db()->save_bookmark(BROWSER_BOOKMARK_MAIN_FOLDER_ID,
2109 browser_view->get_title().c_str(), browser_view->get_url().c_str());
2110 browser_view->show_notify_popup(BR_STRING_ADDED_TO_BOOKMARKS, 3, EINA_TRUE);
2112 if (!elm_icon_file_set(browser_view->m_bookmark_on_off_icon, BROWSER_IMAGE_DIR"/I01_icon_bookmark_off.png", NULL)) {
2113 BROWSER_LOGE("elm_icon_file_set is failed.\n");
2116 m_data_manager->create_bookmark_db()->delete_bookmark(bookmark_id);
2117 browser_view->show_notify_popup(BR_STRING_REMOVED_TO_BOOKMARKS, 3, EINA_TRUE);
2120 m_data_manager->destroy_bookmark_db();
2123 void Browser_View::__bookmark_icon_changed_cb(void *data, Evas_Object *obj, void *event_info)
2125 BROWSER_LOGD("[%s]", __func__);
2129 Browser_View *browser_view = (Browser_View *)data;
2132 void Browser_View::__private_check_change_cb(void *data, Evas_Object *obj, void *event_info)
2134 BROWSER_LOGD("[%s]", __func__);
2138 Browser_View *browser_view = (Browser_View *)data;
2139 Eina_Bool state = elm_check_state_get((Evas_Object*)obj);
2140 browser_view->m_is_private = state;
2142 if (browser_view->m_is_private_item_pressed) {
2143 browser_view->m_is_private = !browser_view->m_is_private;
2144 elm_check_state_set(browser_view->m_private_check, browser_view->m_is_private);
2145 browser_view->m_is_private_item_pressed = EINA_FALSE;
2148 if (browser_view->m_is_private) {
2149 edje_object_signal_emit(elm_layout_edje_get(browser_view->m_url_entry_layout), "private,on,signal", "");
2150 edje_object_signal_emit(elm_layout_edje_get(browser_view->m_option_header_url_entry_layout), "private,on,signal", "");
2152 edje_object_signal_emit(elm_layout_edje_get(browser_view->m_url_entry_layout), "private,off,signal", "");
2153 edje_object_signal_emit(elm_layout_edje_get(browser_view->m_option_header_url_entry_layout), "private,off,signal", "");
2156 Ewk_Setting *setting = ewk_view_setting_get(browser_view->m_focused_window->m_ewk_view);
2157 ewk_setting_private_browsing_set(setting, browser_view->m_is_private);
2160 void Browser_View::__expand_option_header_cb(void *data, Evas_Object *obj, void *event_info)
2162 BROWSER_LOGD("[%s]", __func__);
2166 Browser_View *browser_view = (Browser_View *)data;
2168 browser_view->_navigationbar_title_clicked();
2171 void Browser_View::__add_bookmark_cb(void *data, Evas_Object *obj, void *event_info)
2173 BROWSER_LOGD("[%s]", __func__);
2177 Browser_View *browser_view = (Browser_View *)data;
2178 if (!m_data_manager->create_add_to_bookmark_view(browser_view->get_title(), browser_view->get_url())) {
2179 BROWSER_LOGE("m_data_manager->create_add_to_bookmark_view failed");
2183 if (!m_data_manager->get_add_to_bookmark_view()->init())
2184 m_data_manager->destroy_add_to_bookmark_view();
2187 #if defined(HORIZONTAL_UI)
2188 void Browser_View::_rotate_multi_window(void)
2190 BROWSER_LOGD("[%s]", __func__);
2192 if (!m_data_manager->create_multi_window_view()) {
2193 BROWSER_LOGE("m_data_manager->create_multi_window_view failed");
2197 if (!m_data_manager->get_multi_window_view()->init(0.0, m_is_multi_window_grid_mode)) {
2198 m_data_manager->destroy_multi_window_view();
2199 BROWSER_LOGE("get_multi_window_view()->init failed");
2203 ewk_view_suspend(m_focused_window->m_ewk_view);
2205 _navigationbar_visible_set_signal(EINA_FALSE);
2207 /* Hide the secure lock icon in title bar. */
2208 Elm_Object_Item *top_it = elm_naviframe_top_item_get(m_navi_bar);
2209 elm_object_item_part_content_set(top_it, ELM_NAVIFRAME_ITEM_ICON, NULL);
2211 if (_get_edit_mode() != BR_NO_EDIT_MODE)
2212 _set_edit_mode(BR_NO_EDIT_MODE);
2214 m_is_multi_window_grid_mode = EINA_FALSE;
2218 void Browser_View::__multi_window_cb(void *data, Evas_Object *obj, void *event_info)
2220 BROWSER_LOGD("[%s]", __func__);
2222 Browser_View *browser_view = (Browser_View *)data;
2223 browser_view->_destroy_more_context_popup();
2225 #if defined(FEATURE_MOST_VISITED_SITES)
2226 if (browser_view->m_most_visited_sites && browser_view->m_most_visited_sites->is_guide_text_running())
2230 if (m_data_manager->is_in_view_stack(BR_MULTI_WINDOW_VIEW)) {
2231 BROWSER_LOGD("close multi window");
2232 m_data_manager->get_multi_window_view()->close_multi_window();
2236 if (!m_data_manager->create_multi_window_view()) {
2237 BROWSER_LOGE("m_data_manager->create_multi_window_view failed");
2241 if (!m_data_manager->get_multi_window_view()->init()) {
2242 m_data_manager->destroy_multi_window_view();
2243 BROWSER_LOGE("get_multi_window_view()->init failed");
2247 /* Exception case to call ewk_view_suspend directly.
2248 * That's because the webpage is cleared, when call ewk_view_visibility_set suspend_ewk_view */
2249 ewk_view_suspend(browser_view->m_focused_window->m_ewk_view);
2250 ewk_view_visibility_set(browser_view->m_focused_window->m_ewk_view, EINA_FALSE);
2252 browser_view->_navigationbar_visible_set_signal(EINA_FALSE);
2254 /* Hide the secure lock icon in title bar. */
2255 Elm_Object_Item *top_it = elm_naviframe_top_item_get(m_navi_bar);
2256 elm_object_item_part_content_set(top_it, ELM_NAVIFRAME_ITEM_ICON, NULL);
2258 if (browser_view->_get_edit_mode() != BR_NO_EDIT_MODE)
2259 browser_view->_set_edit_mode(BR_NO_EDIT_MODE);
2262 void Browser_View::__new_window_cb(void *data, Evas_Object *obj, void *event_info)
2264 BROWSER_LOGD("[%s]", __func__);
2268 Browser_View *browser_view = (Browser_View *)data;
2269 Browser_Class *browser = browser_view->m_browser;
2271 if (browser_view->m_resize_idler)
2274 std::vector<Browser_Window *> window_list = browser->get_window_list();
2275 if (window_list.size() >= BROWSER_MULTI_WINDOW_MAX_COUNT) {
2276 /* If the multi window is max, delete the first one. */
2277 /* if the first window is focused, delete second one(oldest one except first one) */
2278 if (browser_view->m_focused_window != window_list[0])
2279 browser->delete_window(window_list[0]);
2281 browser->delete_window(window_list[1]);
2284 browser_view->m_created_new_window = browser->create_new_window(EINA_TRUE);
2285 if (!browser_view->m_created_new_window) {
2286 BROWSER_LOGE("create_new_window failed");
2289 /* initialize the created webview first to connect ewk event callback functions such as load start, progress etc. */
2290 ewk_view_suspend(browser_view->m_focused_window->m_ewk_view);
2292 #if defined(HORIZONTAL_UI)
2293 if (browser_view->m_focused_window->m_landscape_snapshot_image) {
2294 evas_object_del(browser_view->m_focused_window->m_landscape_snapshot_image);
2295 browser_view->m_focused_window->m_landscape_snapshot_image = NULL;
2298 if (browser_view->m_focused_window->m_portrait_snapshot_image) {
2299 evas_object_del(browser_view->m_focused_window->m_portrait_snapshot_image);
2300 browser_view->m_focused_window->m_portrait_snapshot_image = NULL;
2303 #if defined(HORIZONTAL_UI)
2304 if (browser_view->is_landscape())
2305 browser_view->m_focused_window->m_landscape_snapshot_image = browser_view->_capture_snapshot(browser_view->m_focused_window, BROWSER_MULTI_WINDOW_ITEM_RATIO);
2308 browser_view->m_focused_window->m_portrait_snapshot_image = browser_view->_capture_snapshot(browser_view->m_focused_window, BROWSER_MULTI_WINDOW_ITEM_RATIO);
2310 #if defined(FEATURE_MOST_VISITED_SITES)
2311 if (!browser_view->_show_most_visited_sites(EINA_FALSE))
2312 BROWSER_LOGE("_show_most_visited_sites EINA_FALSE failed");
2315 /* initialize the created webview first to connect ewk event callback functions such as load start, progress etc. */
2316 browser->ewk_view_init(browser_view->m_created_new_window->m_ewk_view);
2318 if (!browser_view->_show_new_window_effect(browser_view->m_focused_window->m_ewk_view,
2319 browser_view->m_created_new_window->m_ewk_view))
2320 BROWSER_LOGE("_show_new_window_effect failed");
2322 #if defined(FEATURE_MOST_VISITED_SITES)
2323 browser_view->load_url(BROWSER_MOST_VISITED_SITES_URL);
2325 browser_view->load_url(BROWSER_BLANK_PAGE_URL);
2330 Eina_Bool Browser_View::_call_internet_settings(void)
2332 BROWSER_LOGD("[%s]", __func__);
2334 m_browser_settings = new(nothrow) Browser_Settings_Class;
2335 if (!m_browser_settings) {
2336 BROWSER_LOGE("new Browser_Settings_Class failed");
2339 if (!m_browser_settings->init()) {
2340 BROWSER_LOGE("m_browser_settings->init failed");
2341 delete m_browser_settings;
2342 m_browser_settings = NULL;
2349 void Browser_View::__internet_settings_cb(void *data, Evas_Object *obj, void *event_info)
2351 BROWSER_LOGD("[%s]", __func__);
2355 Browser_View *browser_view = (Browser_View *)data;
2356 browser_view->_destroy_more_context_popup();
2358 if (!browser_view->_call_internet_settings())
2359 BROWSER_LOGE("_call_internet_settings failed");
2362 void Browser_View::_update_find_word_index_text(const char *index_text, int index, int max_match_cnt)
2364 BROWSER_LOGD("[%s]", __func__);
2366 edje_object_part_text_set(elm_layout_edje_get(m_option_header_find_word_layout), "elm.index_text", index_text);
2368 if (max_match_cnt == 0 || max_match_cnt == 1) {
2369 elm_object_disabled_set(m_find_word_prev_button, EINA_TRUE);
2370 elm_object_disabled_set(m_find_word_next_button, EINA_TRUE);
2371 } else if (index == 0 || index == 1) {
2372 elm_object_disabled_set(m_find_word_prev_button, EINA_TRUE);
2373 elm_object_disabled_set(m_find_word_next_button, EINA_FALSE);
2374 if (index == 0 || (index == 1 && elm_object_focus_get(m_find_word_cancel_button)))
2375 elm_object_focus_set(m_find_word_cancel_button, EINA_TRUE);
2376 } else if (index == max_match_cnt) {
2377 elm_object_disabled_set(m_find_word_prev_button, EINA_FALSE);
2378 elm_object_disabled_set(m_find_word_next_button, EINA_TRUE);
2379 elm_object_focus_set(m_find_word_cancel_button, EINA_TRUE);
2381 if (elm_object_disabled_get(m_find_word_prev_button))
2382 elm_object_disabled_set(m_find_word_prev_button, EINA_FALSE);
2383 if (elm_object_disabled_get(m_find_word_next_button))
2384 elm_object_disabled_set(m_find_word_next_button, EINA_FALSE);
2387 void Browser_View::__find_word_cb(void *data, Evas_Object *obj, void *event_info)
2389 BROWSER_LOGD("[%s]", __func__);
2393 Browser_View *browser_view = (Browser_View *)data;
2394 browser_view->_destroy_more_context_popup();
2396 if (browser_view->_get_edit_mode() == BR_FIND_WORD_MODE)
2399 /* find word layout is only in naviframe optino header.
2400 * So expand the option header to show find word layout. */
2401 browser_view->_navigationbar_visible_set_signal(EINA_TRUE);
2403 browser_view->_set_edit_mode(BR_FIND_WORD_MODE);
2405 elm_object_focus_set(browser_view->m_find_word_edit_field, EINA_TRUE);
2407 edje_object_part_text_set(elm_layout_edje_get(browser_view->m_option_header_find_word_layout), "elm.index_text", "0/0");
2410 Eina_Bool Browser_View::_call_download_manager(void)
2412 service_h service_handle = NULL;
2413 BROWSER_LOGD("[%s]", __func__);
2415 if (service_create(&service_handle) < 0) {
2416 BROWSER_LOGE("Fail to create service handle");
2420 if (!service_handle) {
2421 BROWSER_LOGE("service handle is NULL");
2425 if (service_set_operation(service_handle, SERVICE_OPERATION_DOWNLOAD) < 0) {
2426 BROWSER_LOGE("Fail to set service operation");
2427 service_destroy(service_handle);
2431 if (service_add_extra_data(service_handle, "mode", "view") < 0) {
2432 BROWSER_LOGE("Fail to set extra data");
2433 service_destroy(service_handle);
2437 if (service_send_launch_request(service_handle, NULL, NULL) < 0) {
2438 BROWSER_LOGE("Fail to launch service operation");
2439 service_destroy(service_handle);
2443 service_destroy(service_handle);
2448 void Browser_View::__download_manager_cb(void *data, Evas_Object *obj, void *event_info)
2450 BROWSER_LOGD("[%s]", __func__);
2454 Browser_View *browser_view = (Browser_View *)data;
2455 browser_view->_destroy_more_context_popup();
2457 if (!browser_view->_call_download_manager())
2458 BROWSER_LOGE("_call_download_manager failed");
2461 void Browser_View::__send_via_message_cb(void *data, Evas_Object *obj, void *event_info)
2463 BROWSER_LOGD("[%s]", __func__);
2467 Browser_View *browser_view = (Browser_View *)data;
2468 browser_view->_destroy_more_context_popup();
2470 if (!browser_view->_send_via_message(browser_view->get_url(), std::string()))
2471 BROWSER_LOGE("_send_via_message failed");
2474 void Browser_View::__send_via_email_cb(void *data, Evas_Object *obj, void *event_info)
2476 BROWSER_LOGD("[%s]", __func__);
2480 Browser_View *browser_view = (Browser_View *)data;
2481 browser_view->_destroy_more_context_popup();
2483 if (!browser_view->_send_via_email(browser_view->get_url()))
2484 BROWSER_LOGE("_send_via_email failed");
2487 void Browser_View::__post_to_sns_cb(void *data, Evas_Object *obj, void *event_info)
2489 BROWSER_LOGD("[%s]", __func__);
2493 Browser_View *browser_view = (Browser_View*)data;
2495 Elm_Object_Item *it = (Elm_Object_Item *)event_info;
2496 const char *label = elm_object_item_text_get(it);
2497 BROWSER_LOGD("label=[%s]", label);
2498 if (label && strlen(label)) {
2499 if (!browser_view->_post_to_sns(std::string(label), browser_view->get_url()))
2500 BROWSER_LOGE("_post_to_sns failed");
2503 browser_view->_destroy_more_context_popup();
2506 void Browser_View::_destroy_more_context_popup(void)
2508 if (m_more_context_popup) {
2509 evas_object_del(m_more_context_popup);
2510 m_more_context_popup = NULL;
2513 edje_object_signal_emit(elm_layout_edje_get(m_main_layout), "hide,more_context_bg,signal", "");
2516 void Browser_View::__more_context_popup_dismissed_cb(void *data, Evas_Object *obj,
2519 BROWSER_LOGD("[%s]", __func__);
2523 Browser_View *browser_view = (Browser_View *)data;
2524 browser_view->_destroy_more_context_popup();
2527 void Browser_View::__clean_up_windows_test_cb(void *data, Evas_Object *obj, void *event_info)
2532 Browser_View *browser_view = (Browser_View *)data;
2533 browser_view->_destroy_more_context_popup();
2535 m_browser->clean_up_windows();
2538 Eina_Bool Browser_View::_show_more_context_popup(void)
2540 BROWSER_LOGD("[%s]", __func__);
2542 _destroy_more_context_popup();
2544 m_more_context_popup = elm_ctxpopup_add(m_win);
2545 if (!m_more_context_popup) {
2546 BROWSER_LOGE("elm_ctxpopup_add failed");
2550 elm_object_style_set(m_more_context_popup, "pass_event");
2552 edje_object_signal_emit(elm_layout_edje_get(m_main_layout), "show,more_context_bg,signal", "");
2554 evas_object_size_hint_weight_set(m_more_context_popup, EVAS_HINT_EXPAND,
2556 evas_object_smart_callback_add(m_more_context_popup, "dismissed",
2557 __more_context_popup_dismissed_cb, this);
2559 Elm_Object_Item *sub_menu = NULL;
2560 elm_ctxpopup_item_append(m_more_context_popup, BR_STRING_DOWNLOAD_MANAGER, NULL,
2561 __download_manager_cb, this);
2563 sub_menu = elm_ctxpopup_item_append(m_more_context_popup, BR_STRING_FIND_ON_PAGE, NULL,
2564 __find_word_cb, this);
2566 #if defined(FEATURE_MOST_VISITED_SITES)
2567 is_most_visited_sites_running() ||
2570 || _get_edit_mode() == BR_FIND_WORD_MODE)
2571 elm_object_item_disabled_set(sub_menu, EINA_TRUE);
2573 sub_menu = elm_ctxpopup_item_append(m_more_context_popup, BR_STRING_SHARE, NULL,
2576 m_bookmark_on_off_icon = elm_icon_add(m_more_context_popup);
2578 if(m_data_manager->get_history_db()->is_in_bookmark(get_url().c_str(), NULL)) {
2579 if (!elm_icon_file_set(m_bookmark_on_off_icon, BROWSER_IMAGE_DIR"/I01_icon_bookmark_on.png", NULL)) {
2580 BROWSER_LOGE("elm_icon_file_set is failed.\n");
2584 if (!elm_icon_file_set(m_bookmark_on_off_icon, BROWSER_IMAGE_DIR"/I01_icon_bookmark_off.png", NULL)) {
2585 BROWSER_LOGE("elm_icon_file_set is failed.\n");
2589 evas_object_size_hint_aspect_set(m_bookmark_on_off_icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
2591 evas_object_propagate_events_set(m_bookmark_on_off_icon, EINA_FALSE);
2592 evas_object_repeat_events_set(m_bookmark_on_off_icon, EINA_FALSE);
2593 evas_object_smart_callback_add(m_bookmark_on_off_icon, "clicked", __bookmark_icon_changed_cb, this);
2595 sub_menu = elm_ctxpopup_item_append(m_more_context_popup, BR_STRING_BOOKMARK, m_bookmark_on_off_icon,
2596 __bookmark_cb, this);
2598 #if defined(FEATURE_MOST_VISITED_SITES)
2599 is_most_visited_sites_running() ||
2602 || _get_edit_mode() == BR_FIND_WORD_MODE)
2603 elm_object_item_disabled_set(sub_menu, EINA_TRUE);
2605 m_private_check = elm_check_add(m_more_context_popup);
2606 elm_object_style_set(m_private_check, "on&off");
2607 evas_object_smart_callback_add(m_private_check, "changed", __private_check_change_cb, this);
2609 elm_check_state_set(m_private_check, m_is_private);
2610 evas_object_propagate_events_set(m_private_check, EINA_FALSE);
2611 evas_object_show(m_private_check);
2613 elm_ctxpopup_item_append(m_more_context_popup, BR_STRING_PRIVATE, m_private_check,
2614 __private_cb, this);
2616 elm_ctxpopup_item_append(m_more_context_popup, BR_STRING_SETTINGS, NULL,
2617 __internet_settings_cb, this);
2619 elm_ctxpopup_hover_parent_set(m_more_context_popup, m_navi_bar);
2621 int controlbar_x = 0;
2622 int controlbar_y = 0;
2623 int controlbar_w = 0;
2624 int controlbar_h = 0;
2625 evas_object_geometry_get(m_control_bar, &controlbar_x, &controlbar_y, &controlbar_w, &controlbar_h);
2627 evas_object_move(m_more_context_popup, (controlbar_w / 5) * 3 + controlbar_w / 10, controlbar_y + (controlbar_h / 2));
2629 evas_object_show(m_more_context_popup);
2634 void Browser_View::__more_cb(void *data, Evas_Object *obj, void *event_info)
2636 BROWSER_LOGD("[%s]", __func__);
2640 Browser_View *browser_view = (Browser_View *)data;
2641 if (browser_view->m_more_context_popup == NULL) {
2642 if (!browser_view->_show_more_context_popup())
2643 BROWSER_LOGE("_show_more_context_popup failed");
2645 browser_view->_destroy_more_context_popup();
2648 browser_view->_navigationbar_visible_set(EINA_TRUE);
2651 void Browser_View::_set_controlbar_back_forward_status(void)
2653 BROWSER_LOGD("[%s]", __func__);
2654 Evas_Object *ewk_view = m_focused_window->m_ewk_view;
2659 #if defined(FEATURE_MOST_VISITED_SITES)
2660 is_most_visited_sites_running() ||
2663 elm_object_item_disabled_set(m_share_controlbar_button, EINA_TRUE);
2665 elm_object_item_disabled_set(m_share_controlbar_button, EINA_FALSE);
2668 void Browser_View::_set_multi_window_controlbar_text(int count)
2670 BROWSER_LOGD("[%s]", __func__);
2672 elm_toolbar_item_icon_set(m_multi_window_button, BROWSER_IMAGE_DIR"/01_controlbar_icon_multiview.png");
2674 char icon_path[100] = {0, };
2675 snprintf(icon_path, sizeof(icon_path) - 1, "%s/01_controlbar_icon_multiview_0%d.png", BROWSER_IMAGE_DIR, count);
2676 elm_toolbar_item_icon_set(m_multi_window_button, icon_path);
2680 Evas_Object *Browser_View::_create_control_bar(void)
2682 BROWSER_LOGD("[%s]", __func__);
2683 Evas_Object *controlbar_layout;
2684 controlbar_layout = elm_layout_add(m_navi_bar);
2685 if (!controlbar_layout) {
2686 BROWSER_LOGE("elm_layout_add failed");
2689 if (!elm_layout_file_set(controlbar_layout, BROWSER_EDJE_DIR"/browser-view-control-bar.edj",
2690 "browser-view-controlbar")) {
2691 BROWSER_LOGE("Can not set layout browser-view-controlbar\n");
2694 evas_object_size_hint_weight_set(controlbar_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2695 evas_object_size_hint_align_set(controlbar_layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
2696 evas_object_show(controlbar_layout);
2698 Evas_Object *control_bar;
2699 control_bar = elm_toolbar_add(m_navi_bar);
2701 elm_object_style_set(control_bar, "browser/browser-view");
2703 elm_toolbar_shrink_mode_set(control_bar, ELM_TOOLBAR_SHRINK_EXPAND);
2705 /* New Window Button */
2706 m_new_window_button = elm_toolbar_item_append(control_bar,
2707 BROWSER_IMAGE_DIR"/I01_controlbar_icon_new_window.png", NULL, __new_window_cb, this);
2708 if (!m_new_window_button) {
2709 BROWSER_LOGE("elm_toolbar_item_append failed");
2713 /* Multi Window Button */
2714 m_multi_window_button = elm_toolbar_item_append(control_bar,
2715 BROWSER_IMAGE_DIR"/01_controlbar_icon_multiview.png", NULL, __multi_window_cb, this);
2716 /* Bookmark Button */
2717 elm_toolbar_item_append(control_bar, BROWSER_IMAGE_DIR"/I01_controlbar_icon_bookmark.png",
2718 NULL, __go_to_bookmark_cb, this);
2719 /* More menu Button */
2720 m_more_button = elm_toolbar_item_append(control_bar,
2721 BROWSER_IMAGE_DIR"/I01_controlbar_icon_more.png", NULL, __more_cb, this);
2722 if (!m_more_button) {
2723 BROWSER_LOGE("elm_toolbar_item_append failed");
2727 elm_object_part_content_set(controlbar_layout, "elm.swallow.controlbar", control_bar);
2729 m_back_button = elm_button_add(control_bar);
2730 if (!m_back_button) {
2731 BROWSER_LOGE("elm_button_add failed");
2734 elm_object_style_set(m_back_button, "browser/browser_view_controlbar_back");
2736 elm_object_part_content_set(controlbar_layout, "elm.swallow.back_button", m_back_button);
2737 evas_object_smart_callback_add(m_back_button, "clicked", __backward_cb, this);
2738 evas_object_show(m_back_button);
2739 evas_object_show(control_bar);
2742 return controlbar_layout;
2746 * Create two same url layouts similar with other browsers like android & safari.
2747 * The one(by _create_url_layout) is in the browser scroller and
2748 * the other(by _create_option_header_url_layout) is in the navigation bar option header.
2750 Evas_Object *Browser_View::_create_option_header_url_layout(void)
2752 BROWSER_LOGD("[%s]", __func__);
2753 Evas_Object *url_layout;
2754 url_layout = elm_layout_add(m_navi_bar);
2756 if (!elm_layout_file_set(url_layout, BROWSER_EDJE_DIR"/browser-view-url-layout.edj",
2757 "browser/url_layout")) {
2758 BROWSER_LOGE("Can not set layout theme[browser/url_layout]\n");
2761 evas_object_size_hint_weight_set(url_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2762 evas_object_size_hint_align_set(url_layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
2763 evas_object_show(url_layout);
2765 m_option_header_url_entry_layout = elm_layout_add(m_navi_bar);
2766 if (!m_option_header_url_entry_layout) {
2767 BROWSER_LOGE("elm_layout_add failed");
2770 if (!elm_layout_file_set(m_option_header_url_entry_layout, BROWSER_EDJE_DIR"/browser-view-url-layout.edj",
2771 "elm/browser/urlentry/default")) {
2772 BROWSER_LOGE("Can not set layout theme[browser, urlentry, default]\n");
2775 elm_object_part_content_set(url_layout, "elm.swallow.url", m_option_header_url_entry_layout);
2776 edje_object_signal_callback_add(elm_layout_edje_get(m_option_header_url_entry_layout),
2777 "mouse,clicked,1", "elm.swallow.entry", __url_entry_clicked_cb, this);
2779 edje_object_signal_callback_add(elm_layout_edje_get(m_option_header_url_entry_layout),
2780 "refresh_stop", "*", __refresh_button_clicked_cb, this);
2782 evas_object_show(m_option_header_url_entry_layout);
2784 m_option_header_url_edit_field = br_elm_url_editfield_add(m_navi_bar);
2785 if (!m_option_header_url_edit_field) {
2786 BROWSER_LOGE("elm_editfield_add failed");
2789 elm_entry_context_menu_item_add(br_elm_editfield_entry_get(m_option_header_url_edit_field),
2790 BR_STRING_CTXMENU_SHARE, NULL, ELM_ICON_NONE, __url_editfield_share_clicked_cb, this);
2792 elm_object_part_content_set(m_option_header_url_entry_layout, "elm.swallow.entry", m_option_header_url_edit_field);
2793 // br_elm_editfield_entry_single_line_set(m_option_header_url_edit_field, EINA_TRUE);
2794 br_elm_editfield_eraser_set(m_option_header_url_edit_field, EINA_FALSE);
2796 Evas_Object *edit_field_entry = br_elm_editfield_entry_get(m_option_header_url_edit_field);
2797 elm_entry_input_panel_layout_set(edit_field_entry, ELM_INPUT_PANEL_LAYOUT_URL);
2798 ecore_imf_context_input_panel_event_callback_add((Ecore_IMF_Context *)elm_entry_imf_context_get(edit_field_entry),
2799 ECORE_IMF_INPUT_PANEL_STATE_EVENT, __url_entry_imf_event_cb, this);
2801 evas_object_smart_callback_add(edit_field_entry, "activated", __url_entry_enter_key_cb, this);
2802 evas_event_callback_add(evas_object_evas_get(m_option_header_url_edit_field), EVAS_CALLBACK_CANVAS_FOCUS_OUT,
2803 __url_entry_focus_out_cb, this);
2804 evas_object_show(m_option_header_url_edit_field);
2806 m_option_header_url_progressbar = elm_progressbar_add(m_navi_bar);
2807 if (!m_option_header_url_progressbar) {
2808 BROWSER_LOGE("elm_progressbar_add failed");
2811 elm_object_style_set(m_option_header_url_progressbar, "browser/loading");
2812 elm_object_part_content_set(m_option_header_url_entry_layout, "elm.swallow.progressbar", m_option_header_url_progressbar);
2813 elm_progressbar_value_set(m_option_header_url_progressbar, 0);
2814 evas_object_show(m_option_header_url_progressbar);
2816 m_option_header_url_progresswheel = elm_progressbar_add(m_navi_bar);
2817 if (!m_option_header_url_progresswheel) {
2818 BROWSER_LOGE("elm_progressbar_add failed");
2822 elm_object_style_set(m_option_header_url_progresswheel, "UIActivityIndicatorStyleWhite");
2824 elm_progressbar_pulse(m_option_header_url_progresswheel, EINA_FALSE);
2825 elm_object_part_content_set(m_option_header_url_entry_layout, "elm.swallow.progress", m_option_header_url_progresswheel);
2826 evas_object_show(m_option_header_url_progresswheel);
2828 m_option_header_cancel_button = elm_button_add(m_navi_bar);
2829 if (!m_option_header_cancel_button) {
2830 BROWSER_LOGE("elm_button_add failed");
2833 evas_object_size_hint_weight_set(m_option_header_cancel_button, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2834 evas_object_size_hint_align_set(m_option_header_cancel_button, EVAS_HINT_FILL, EVAS_HINT_FILL);
2835 elm_object_style_set(m_option_header_cancel_button, "browser/cancel_button");
2836 elm_object_text_set(m_option_header_cancel_button, BR_STRING_CANCEL);
2837 elm_object_part_content_set(url_layout, "elm.swallow.cancel", m_option_header_cancel_button);
2838 evas_object_smart_callback_add(m_option_header_cancel_button, "clicked", __cancel_button_clicked_cb, this);
2839 evas_object_show(m_option_header_cancel_button);
2841 m_option_header_title_backward_button = elm_button_add(m_navi_bar);
2842 if (!m_option_header_title_backward_button) {
2843 BROWSER_LOGE("elm_button_add failed");
2846 elm_object_style_set(m_option_header_title_backward_button, "browser/backward");
2847 elm_object_part_content_set(url_layout, "elm.swallow.backward_button", m_option_header_title_backward_button);
2848 evas_object_smart_callback_add(m_option_header_title_backward_button, "clicked", __backward_button_clicked_cb, this);
2849 elm_object_focus_allow_set(m_option_header_title_backward_button, EINA_FALSE);
2850 evas_object_show(m_option_header_title_backward_button);
2851 elm_object_disabled_set(m_option_header_title_backward_button, EINA_TRUE);
2853 m_option_header_title_forward_button = elm_button_add(m_navi_bar);
2854 if (!m_option_header_title_forward_button) {
2855 BROWSER_LOGE("elm_button_add failed");
2858 elm_object_style_set(m_option_header_title_forward_button, "browser/forward");
2859 elm_object_part_content_set(url_layout, "elm.swallow.forward_button", m_option_header_title_forward_button);
2860 evas_object_smart_callback_add(m_option_header_title_forward_button, "clicked", __forward_button_clicked_cb, this);
2861 elm_object_focus_allow_set(m_option_header_title_forward_button, EINA_FALSE);
2862 evas_object_show(m_option_header_title_forward_button);
2863 elm_object_disabled_set(m_option_header_title_forward_button, EINA_TRUE);
2865 /* for jump to top. */
2866 evas_object_event_callback_add(url_layout, EVAS_CALLBACK_MOUSE_DOWN, __option_header_url_layout_mouse_down_cb, this);
2872 Evas_Object *Browser_View::_get_activated_url_entry(void)
2874 /* The edit field in option header url layout is only valid for edit.
2875 * If the edit field in browser scroller can have focus, there is so many focus issue.
2876 * So just make the edit field in option header editable. */
2877 return m_option_header_url_edit_field;
2880 void Browser_View::__url_entry_imf_event_cb(void *data, Ecore_IMF_Context *ctx, int value)
2882 BROWSER_LOGD("value=%d", value);
2886 Browser_View *browser_view = (Browser_View *)data;
2887 if (value == ECORE_IMF_INPUT_PANEL_STATE_HIDE) {
2888 Evas_Object *edit_field_entry;
2889 edit_field_entry = br_elm_editfield_entry_get(browser_view->_get_activated_url_entry());
2890 elm_object_focus_set(edit_field_entry, EINA_FALSE);
2892 if (browser_view->m_edit_mode != BR_URL_ENTRY_EDIT_MODE_WITH_NO_IMF
2893 && browser_view->m_edit_mode != BR_FIND_WORD_MODE)
2894 browser_view->_set_edit_mode(BR_NO_EDIT_MODE);
2897 } else if (value == ECORE_IMF_INPUT_PANEL_STATE_SHOW)
2898 /* If the focus of url entry is set automatically, the keypad is also displayed automatically. */
2899 /* eg. At url edit mode, lock the screen -> then unlock, the url entry will get focus. */
2900 /* The keypad is also invoked, so set the edit mode. */
2901 browser_view->_set_edit_mode(BR_URL_ENTRY_EDIT_MODE);
2904 void Browser_View::__url_entry_focus_out_cb(void *data, Evas *e, void *event_info)
2906 BROWSER_LOGD("[%s]", __func__);
2910 Browser_View *browser_view = (Browser_View *)data;
2911 Evas_Object *edit_field_entry;
2912 edit_field_entry = br_elm_editfield_entry_get(browser_view->_get_activated_url_entry());
2914 Ecore_IMF_Context *ic = (Ecore_IMF_Context *)elm_entry_imf_context_get(edit_field_entry);
2918 ecore_imf_context_input_panel_hide(ic);
2920 if (browser_view->m_edit_mode != BR_FIND_WORD_MODE)
2921 browser_view->_set_edit_mode(BR_NO_EDIT_MODE);
2924 void Browser_View::_set_edit_mode(edit_mode mode)
2926 BROWSER_LOGD("mode = %d", mode);
2928 if (m_edit_mode == mode)
2931 #if defined(FEATURE_MOST_VISITED_SITES)
2932 if (mode == BR_NO_EDIT_MODE) {
2933 if (m_most_visited_sites) {
2934 edje_object_signal_emit(elm_layout_edje_get(m_url_entry_layout), "url_guide_text,on,signal", "");
2935 edje_object_signal_emit(elm_layout_edje_get(m_option_header_url_entry_layout),
2936 "url_guide_text,on,signal", "");
2939 if (m_most_visited_sites) {
2940 edje_object_signal_emit(elm_layout_edje_get(m_url_entry_layout), "url_guide_text,off,signal", "");
2941 edje_object_signal_emit(elm_layout_edje_get(m_option_header_url_entry_layout),
2942 "url_guide_text,off,signal", "");
2947 if (mode == BR_URL_ENTRY_EDIT_MODE || mode == BR_FIND_WORD_MODE
2948 || mode == BR_URL_ENTRY_EDIT_MODE_WITH_NO_IMF) {
2949 #ifdef BROWSER_SCROLLER_BOUNCING
2950 /* If edit mode, lock the browser scroller */
2951 _enable_webview_scroll();
2953 /* Make the browser scroller region y = 0 to show url bar all at edit mode. */
2957 elm_scroller_region_get(m_scroller, &scroller_x, NULL, &scroller_w, &scroller_h);
2958 elm_scroller_region_show(m_scroller ,scroller_x, 0, scroller_w, scroller_h);
2961 if (mode == BR_URL_ENTRY_EDIT_MODE) {
2962 /* change layout of url layout for edit mode. */
2963 edje_object_signal_emit(elm_layout_edje_get(m_url_layout), "edit,url,on,signal", "");
2964 edje_object_signal_emit(elm_layout_edje_get(m_option_header_url_layout),
2965 "edit,url,on,signal", "");
2967 /* change refresh icon in url entry for edit mode. */
2968 edje_object_signal_emit(elm_layout_edje_get(m_url_entry_layout), "edit,url,on,signal", "");
2969 edje_object_signal_emit(elm_layout_edje_get(m_option_header_url_entry_layout),
2970 "edit,url,on,signal", "");
2972 edje_object_signal_emit(elm_layout_edje_get(m_url_entry_layout), "hide,favicon,signal", "");
2973 edje_object_signal_emit(elm_layout_edje_get(m_option_header_url_entry_layout),
2974 "hide,favicon,signal", "");
2975 edje_object_signal_emit(elm_layout_edje_get(m_main_layout),
2976 "edit,url,on,signal", "");
2977 } else if (mode == BR_NO_EDIT_MODE || mode == BR_URL_ENTRY_EDIT_MODE_WITH_NO_IMF) {
2978 if (m_edit_mode == BR_FIND_WORD_MODE) {
2979 edje_object_signal_emit(elm_layout_edje_get(m_option_header_layout), "hide,find_word_layout,signal", "");
2980 m_find_word->find_word("", Browser_Find_Word::BROWSER_FIND_WORD_FORWARD);
2982 /* change layout of url layout for normal mode. */
2983 edje_object_signal_emit(elm_layout_edje_get(m_url_layout), "edit,url,off,signal", "");
2984 edje_object_signal_emit(elm_layout_edje_get(m_option_header_url_layout),
2985 "edit,url,off,signal", "");
2987 /* change refresh icon in url entry for normal mode. */
2988 edje_object_signal_emit(elm_layout_edje_get(m_url_entry_layout), "edit,url,off,signal", "");
2989 edje_object_signal_emit(elm_layout_edje_get(m_option_header_url_entry_layout),
2990 "edit,url,off,signal", "");
2992 #if defined(FEATURE_MOST_VISITED_SITES)
2993 if (!is_most_visited_sites_running())
2996 if (m_focused_window->m_favicon)
2997 edje_object_signal_emit(elm_layout_edje_get(m_url_entry_layout),
2998 "show,favicon,signal", "");
2999 if (m_focused_window->m_option_header_favicon)
3000 edje_object_signal_emit(elm_layout_edje_get(m_option_header_url_entry_layout),
3001 "show,favicon,signal", "");
3005 edje_object_signal_emit(elm_layout_edje_get(m_main_layout),
3006 "edit,url,off,signal", "");
3007 if (_is_loading()) {
3008 edje_object_signal_emit(elm_layout_edje_get(m_url_entry_layout), "loading,on,signal", "");
3009 edje_object_signal_emit(elm_layout_edje_get(m_option_header_url_entry_layout),
3010 "loading,on,signal", "");
3013 } else if (mode == BR_FIND_WORD_MODE) {
3014 Evas_Object *find_word_edit_field_entry = br_elm_editfield_entry_get(m_find_word_edit_field);
3015 elm_entry_entry_set(find_word_edit_field_entry, "");
3017 evas_object_smart_callback_del(find_word_edit_field_entry, "changed", __find_word_entry_changed_cb);
3018 evas_object_smart_callback_add(find_word_edit_field_entry, "changed", __find_word_entry_changed_cb, this);
3020 edje_object_signal_emit(elm_layout_edje_get(m_option_header_layout), "show,find_word_layout,signal", "");
3025 /* To show favicon, if click url entry while loading, then cancel case. */
3030 * The url entry of option header can't be focusable in case of switch TEXTBLOCK & elm entry.
3031 * So focus the url entry in idler callback.
3033 static Eina_Bool __url_entry_focus_idler_cb(void *data)
3035 Evas_Object *edit_field = (Evas_Object *)data;
3036 elm_object_focus_set(edit_field, EINA_TRUE);
3038 Evas_Object *entry = br_elm_editfield_entry_get(edit_field);
3039 elm_entry_cursor_end_set(entry);
3041 return ECORE_CALLBACK_CANCEL;
3044 void Browser_View::__url_entry_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
3046 BROWSER_LOGD("[%s]", __func__);
3050 Browser_View *browser_view = (Browser_View *)data;
3052 if (browser_view->_is_loading())
3053 browser_view->_stop_loading();
3055 if (!browser_view->_navigationbar_visible_get()) {
3056 /* The edit field in option header is only for edit url. */
3057 browser_view->_navigationbar_visible_set_signal(EINA_TRUE);
3060 browser_view->_destroy_more_context_popup();
3062 edit_mode mode = browser_view->_get_edit_mode();
3064 browser_view->_set_edit_mode(BR_URL_ENTRY_EDIT_MODE);
3066 if (mode == BR_NO_EDIT_MODE) {
3067 Evas_Object *entry = br_elm_editfield_entry_get(browser_view->m_option_header_url_edit_field);
3069 elm_object_focus_set(browser_view->m_option_header_url_edit_field, EINA_TRUE);
3070 elm_entry_cursor_end_set(entry);
3072 // ecore_idler_add(__url_entry_focus_idler_cb, browser_view->m_option_header_url_edit_field);
3076 Eina_Bool Browser_View::_is_option_header_expanded(void)
3078 return _navigationbar_visible_get();
3081 void Browser_View::__cancel_button_clicked_cb(void *data, Evas_Object *obj, void *event_info)
3083 BROWSER_LOGD("[%s]", __func__);
3087 Browser_View *browser_view = (Browser_View *)data;
3088 Evas_Object *ewk_view = browser_view->m_focused_window->m_ewk_view;
3092 browser_view->_set_edit_mode(BR_NO_EDIT_MODE);
3094 elm_object_signal_emit(browser_view->m_option_header_url_edit_field, "ellipsis_show,signal", "elm");
3095 elm_object_signal_emit(browser_view->m_url_edit_field, "ellipsis_show,signal", "elm");
3097 browser_view->_set_url_entry(browser_view->get_url().c_str());
3100 void Browser_View::__refresh_button_clicked_cb(void *data, Evas_Object *obj,
3101 const char *emission, const char *source)
3103 BROWSER_LOGD("[%s]", __func__);
3107 Browser_View *browser_view = (Browser_View *)data;
3108 if (browser_view->_get_edit_mode() == BR_URL_ENTRY_EDIT_MODE) {
3109 elm_entry_entry_set(br_elm_editfield_entry_get(browser_view->m_url_edit_field), "");
3110 elm_entry_entry_set(br_elm_editfield_entry_get(browser_view->m_option_header_url_edit_field), "");
3111 } else if(browser_view->_is_loading())
3112 browser_view->_stop_loading();
3114 browser_view->_reload();
3117 void Browser_View::__url_entry_enter_key_cb(void *data, Evas_Object *obj, void *event_info)
3119 BROWSER_LOGD("[%s]", __func__);
3123 Browser_View *browser_view = (Browser_View *)data;
3124 Evas_Object *ewk_view = browser_view->m_focused_window->m_ewk_view;
3125 Evas_Object *edit_field_entry;
3126 edit_field_entry = br_elm_editfield_entry_get(browser_view->_get_activated_url_entry());
3129 * Give focus to option header cancel button to hide imf. */
3130 elm_object_focus_set(browser_view->m_option_header_cancel_button, EINA_TRUE);
3132 char *url = elm_entry_markup_to_utf8(elm_entry_entry_get(edit_field_entry));
3133 BROWSER_LOGD("input url = [%s]", url);
3135 if (url && strlen(url)) {
3136 browser_view->load_url(url);
3142 void Browser_View::__url_entry_changed_cb(void *data, Evas_Object *obj, void *event_info)
3144 BROWSER_LOGD("[%s]", __func__);
3147 void Browser_View::__url_layout_mouse_down_cb(void *data, Evas* evas, Evas_Object *obj,
3150 BROWSER_LOGD("[%s]", __func__);
3154 Evas_Event_Mouse_Down event = *(Evas_Event_Mouse_Down *)event_info;
3156 Browser_View *browser_view = (Browser_View *)data;
3158 Evas_Object *entry = br_elm_editfield_entry_get(browser_view->m_url_edit_field);
3164 evas_object_geometry_get(browser_view->m_url_edit_field, &entry_x, &entry_y, &entry_w, &entry_h);
3166 if (event.output.x > entry_x && event.output.x < entry_x + entry_w &&
3167 event.output.y > entry_y && event.output.y < entry_y + entry_h) {
3168 elm_object_signal_emit(browser_view->m_option_header_url_edit_field, "ellipsis_hide,signal", "elm");
3169 elm_object_signal_emit(browser_view->m_url_edit_field, "ellipsis_hide,signal", "elm");
3172 edit_mode mode = browser_view->_get_edit_mode();
3173 if (mode == BR_URL_ENTRY_EDIT_MODE || mode == BR_FIND_WORD_MODE
3174 || mode == BR_URL_ENTRY_EDIT_MODE_WITH_NO_IMF) {
3175 #ifdef BROWSER_SCROLLER_BOUNCING
3176 BROWSER_LOGD("<< lock browser scroller >>");
3177 elm_object_scroll_freeze_pop(browser_view->m_scroller);
3178 elm_object_scroll_freeze_push(browser_view->m_scroller);
3183 void Browser_View::__option_header_url_layout_mouse_down_cb(void *data, Evas* evas, Evas_Object *obj,
3186 BROWSER_LOGD("[%s]", __func__);
3189 Evas_Event_Mouse_Down event = *(Evas_Event_Mouse_Down *)event_info;
3190 Browser_View *browser_view = (Browser_View *)data;
3192 Evas_Object *entry = br_elm_editfield_entry_get(browser_view->m_option_header_url_edit_field);
3198 evas_object_geometry_get(browser_view->m_option_header_url_edit_field, &entry_x, &entry_y, &entry_w, &entry_h);
3200 if (event.output.x > entry_x && event.output.x < entry_x + entry_w &&
3201 event.output.y > entry_y && event.output.y < entry_y + entry_h) {
3202 elm_object_signal_emit(browser_view->m_option_header_url_edit_field, "ellipsis_hide,signal", "elm");
3203 elm_object_signal_emit(browser_view->m_url_edit_field, "ellipsis_hide,signal", "elm");
3207 if (event.output.y < icon_y)
3208 browser_view->_jump_to_top();
3211 void Browser_View::_update_back_forward_buttons(void)
3213 BROWSER_LOGD("[%s]", __func__);
3214 if (ewk_view_back_possible(m_focused_window->m_ewk_view)) {
3215 elm_object_disabled_set(m_title_backward_button, EINA_FALSE);
3216 elm_object_disabled_set(m_option_header_title_backward_button, EINA_FALSE);
3218 elm_object_disabled_set(m_title_backward_button, EINA_TRUE);
3219 elm_object_disabled_set(m_option_header_title_backward_button, EINA_TRUE);
3222 if (ewk_view_forward_possible(m_focused_window->m_ewk_view)) {
3223 elm_object_disabled_set(m_title_forward_button, EINA_FALSE);
3224 elm_object_disabled_set(m_option_header_title_forward_button, EINA_FALSE);
3226 elm_object_disabled_set(m_title_forward_button, EINA_TRUE);
3227 elm_object_disabled_set(m_option_header_title_forward_button, EINA_TRUE);
3231 void Browser_View::__backward_button_clicked_cb(void *data, Evas_Object *obj, void *event_info)
3233 BROWSER_LOGD("[%s]", __func__);
3237 Browser_View *browser_view = (Browser_View *)data;
3238 ewk_view_back(browser_view->m_focused_window->m_ewk_view);
3241 void Browser_View::__forward_button_clicked_cb(void *data, Evas_Object *obj, void *event_info)
3243 BROWSER_LOGD("[%s]", __func__);
3247 Browser_View *browser_view = (Browser_View *)data;
3248 ewk_view_forward(browser_view->m_focused_window->m_ewk_view);
3251 Evas_Object *Browser_View::_create_url_layout(void)
3253 BROWSER_LOGD("[%s]", __func__);
3254 Evas_Object *url_layout;
3255 url_layout = elm_layout_add(m_navi_bar);
3257 if (!elm_layout_file_set(url_layout, BROWSER_EDJE_DIR"/browser-view-url-layout.edj",
3258 "browser/url_layout")) {
3259 BROWSER_LOGE("Can not set layout theme[browser/url_layout]\n");
3262 evas_object_size_hint_weight_set(url_layout, EVAS_HINT_EXPAND, 0.0);
3263 evas_object_size_hint_align_set(url_layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
3264 evas_object_show(url_layout);
3266 /* create url entry layout in url layout */
3267 m_url_entry_layout = elm_layout_add(m_navi_bar);
3268 if (!m_url_entry_layout) {
3269 BROWSER_LOGE("elm_layout_add failed");
3272 if (!elm_layout_file_set(m_url_entry_layout, BROWSER_EDJE_DIR"/browser-view-url-layout.edj",
3273 "elm/browser/urlentry/default")) {
3274 BROWSER_LOGE("Can not set layout theme[browser, urlentry, default]\n");
3277 elm_object_part_content_set(url_layout, "elm.swallow.url", m_url_entry_layout);
3278 evas_object_show(m_url_entry_layout);
3280 m_url_edit_field = br_elm_url_editfield_add(m_navi_bar);
3281 if (!m_url_edit_field) {
3282 BROWSER_LOGE("elm_editfield_add failed");
3285 elm_object_part_content_set(m_url_entry_layout, "elm.swallow.entry", m_url_edit_field);
3286 // br_elm_editfield_entry_single_line_set(m_url_edit_field, EINA_TRUE);
3287 br_elm_editfield_eraser_set(m_url_edit_field, EINA_FALSE);
3289 Evas_Object *edit_field_entry = br_elm_editfield_entry_get(m_url_edit_field);
3290 elm_entry_editable_set(edit_field_entry, EINA_FALSE);
3291 /* The edit field in browser scroller is only for display.
3292 * The edit url is only supported in option header url entry. */
3293 elm_object_focus_allow_set(m_url_edit_field, EINA_FALSE);
3294 elm_object_focus_allow_set(edit_field_entry, EINA_FALSE);
3295 elm_entry_input_panel_enabled_set(edit_field_entry, EINA_FALSE);
3297 elm_entry_text_style_user_push(edit_field_entry, "DEFAULT='font_size=35 color=#3C3632 ellipsis=1'");
3298 evas_object_show(m_url_edit_field);
3300 edje_object_signal_emit(elm_layout_edje_get(m_url_entry_layout), "disable_entry,signal", "");
3301 edje_object_signal_callback_add(elm_layout_edje_get(m_url_entry_layout), "mouse,clicked,1", "block_entry",
3302 __url_entry_clicked_cb, this);
3304 edje_object_signal_callback_add(elm_layout_edje_get(m_url_entry_layout), "refresh_stop", "*",
3305 __refresh_button_clicked_cb, this);
3307 m_url_progressbar = elm_progressbar_add(m_navi_bar);
3308 if (!m_url_progressbar) {
3309 BROWSER_LOGE("elm_progressbar_add failed");
3312 elm_object_style_set(m_url_progressbar, "browser/loading");
3313 elm_object_part_content_set(m_url_entry_layout, "elm.swallow.progressbar", m_url_progressbar);
3314 elm_progressbar_value_set(m_url_progressbar, 0);
3315 evas_object_show(m_url_progressbar);
3317 m_url_progresswheel = elm_progressbar_add(m_navi_bar);
3318 if (!m_url_progresswheel) {
3319 BROWSER_LOGE("elm_progressbar_add failed");
3323 elm_object_style_set(m_url_progresswheel, "UIActivityIndicatorStyleWhite");
3324 elm_progressbar_pulse(m_url_progresswheel, EINA_FALSE);
3325 elm_object_part_content_set(m_url_entry_layout, "elm.swallow.progress", m_url_progresswheel);
3326 evas_object_show(m_url_progresswheel);
3328 m_cancel_button = elm_button_add(m_navi_bar);
3329 if (!m_cancel_button) {
3330 BROWSER_LOGE("elm_button_add failed");
3333 evas_object_size_hint_weight_set(m_cancel_button, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
3334 evas_object_size_hint_align_set(m_cancel_button, EVAS_HINT_FILL, EVAS_HINT_FILL);
3335 elm_object_style_set(m_cancel_button, "browser/cancel_button");
3336 elm_object_text_set(m_cancel_button, BR_STRING_CANCEL);
3337 elm_object_part_content_set(url_layout, "elm.swallow.cancel", m_cancel_button);
3338 evas_object_smart_callback_add(m_cancel_button, "clicked", __cancel_button_clicked_cb, this);
3339 evas_object_show(m_cancel_button);
3341 m_title_backward_button = elm_button_add(m_navi_bar);
3342 if (!m_title_backward_button) {
3343 BROWSER_LOGE("elm_button_add failed");
3346 elm_object_style_set(m_title_backward_button, "browser/backward");
3347 elm_object_part_content_set(url_layout, "elm.swallow.backward_button", m_title_backward_button);
3348 evas_object_smart_callback_add(m_title_backward_button, "clicked", __backward_button_clicked_cb, this);
3349 elm_object_focus_allow_set(m_title_backward_button, EINA_FALSE);
3350 evas_object_show(m_title_backward_button);
3351 elm_object_disabled_set(m_title_backward_button, EINA_TRUE);
3353 m_title_forward_button = elm_button_add(m_navi_bar);
3354 if (!m_title_forward_button) {
3355 BROWSER_LOGE("elm_button_add failed");
3358 elm_object_style_set(m_title_forward_button, "browser/forward");
3359 elm_object_part_content_set(url_layout, "elm.swallow.forward_button", m_title_forward_button);
3360 evas_object_smart_callback_add(m_title_forward_button, "clicked", __forward_button_clicked_cb, this);
3361 elm_object_focus_allow_set(m_title_forward_button, EINA_FALSE);
3362 evas_object_show(m_title_forward_button);
3363 elm_object_disabled_set(m_title_forward_button, EINA_TRUE);
3366 * When edit mode, if scroll down on url layout in browser view,
3367 * the browser can be scrolled even though scroll locked.
3368 * So, lock the browser scroller whenever touch on it if edit mode.
3370 evas_object_event_callback_add(url_layout, EVAS_CALLBACK_MOUSE_DOWN, __url_layout_mouse_down_cb, this);
3376 Evas_Object *Browser_View::_create_find_word_layout(void)
3378 BROWSER_LOGD("[%s]", __func__);
3379 Evas_Object *url_layout = elm_layout_add(m_navi_bar);
3381 BROWSER_LOGE("elm_layout_add failed");
3384 if (!elm_layout_file_set(url_layout, BROWSER_EDJE_DIR"/browser-view-find-word-layout.edj",
3385 "browser-view/find_word_layout")) {
3386 BROWSER_LOGE("Can not set layout theme[browser-view/find_word_layout]\n");
3389 evas_object_size_hint_weight_set(url_layout, EVAS_HINT_EXPAND, 0.0);
3390 evas_object_size_hint_align_set(url_layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
3391 evas_object_show(url_layout);
3393 /* create url entry layout in url layout */
3394 m_find_word_entry_layout = elm_layout_add(m_navi_bar);
3395 if (!m_find_word_entry_layout) {
3396 BROWSER_LOGE("elm_layout_add failed");
3399 if (!elm_layout_file_set(m_find_word_entry_layout, BROWSER_EDJE_DIR"/browser-view-find-word-layout.edj",
3400 "browser-view/find_word_editfield_layout")) {
3401 BROWSER_LOGE("browser-view/find_word_editfield_layout failed");
3404 elm_object_part_content_set(url_layout, "elm.swallow.url", m_find_word_entry_layout);
3405 evas_object_show(m_find_word_entry_layout);
3407 edje_object_part_text_set(elm_layout_edje_get(url_layout), "title_text", BR_STRING_FIND_ON_PAGE);
3409 m_find_word_edit_field = br_elm_find_word_editfield_add(m_navi_bar);
3410 if (!m_find_word_edit_field) {
3411 BROWSER_LOGE("elm_editfield_add failed");
3414 elm_object_part_content_set(m_find_word_entry_layout, "elm.swallow.entry", m_find_word_edit_field);
3415 evas_object_show(m_find_word_edit_field);
3417 edje_object_signal_emit(elm_layout_edje_get(m_find_word_edit_field), "find_word,signal", "elm");
3419 // br_elm_editfield_entry_single_line_set(m_find_word_edit_field, EINA_TRUE);
3420 br_elm_editfield_eraser_set(m_find_word_edit_field, EINA_TRUE);
3422 elm_object_signal_callback_add(m_find_word_edit_field, "elm,eraser,clicked", "elm",
3423 __find_word_erase_button_clicked_cb, this);
3425 Evas_Object *find_word_edit_field_entry = br_elm_editfield_entry_get(m_find_word_edit_field);
3426 elm_entry_entry_set(find_word_edit_field_entry, "");
3427 evas_object_smart_callback_add(find_word_edit_field_entry, "activated", __find_word_entry_enter_key_cb, this);
3428 elm_entry_input_panel_layout_set(find_word_edit_field_entry, ELM_INPUT_PANEL_LAYOUT_NORMAL);
3429 elm_entry_prediction_allow_set(find_word_edit_field_entry, EINA_FALSE);
3430 ecore_imf_context_input_panel_event_callback_add((Ecore_IMF_Context *)elm_entry_imf_context_get(find_word_edit_field_entry),
3431 ECORE_IMF_INPUT_PANEL_STATE_EVENT, __find_word_entry_imf_event_cb, this);
3432 elm_entry_text_style_user_push(find_word_edit_field_entry, "DEFAULT='font_size=35 color=#3C363 2 ellipsis=1'");
3433 evas_object_show(m_find_word_edit_field);
3435 m_find_word_cancel_button = elm_button_add(m_navi_bar);
3436 if (!m_find_word_cancel_button) {
3437 BROWSER_LOGE("elm_button_add failed");
3440 elm_object_style_set(m_find_word_cancel_button, "browser/cancel_button");
3441 elm_object_text_set(m_find_word_cancel_button, BR_STRING_CANCEL);
3442 elm_object_part_content_set(url_layout, "elm.swallow.cancel", m_find_word_cancel_button);
3443 evas_object_show(m_find_word_cancel_button);
3445 evas_object_smart_callback_add(m_find_word_cancel_button, "clicked", __find_word_cancel_button_clicked_cb, this);
3447 m_find_word_prev_button = elm_button_add(m_navi_bar);
3448 if (!m_find_word_prev_button) {
3449 BROWSER_LOGE("elm_button_add failed");
3452 elm_object_style_set(m_find_word_prev_button, "browser/find_word_prev_but");
3453 elm_object_part_content_set(url_layout, "elm.swallow.find_word_prev", m_find_word_prev_button);
3454 evas_object_show(m_find_word_prev_button);
3455 evas_object_smart_callback_add(m_find_word_prev_button, "clicked", __find_word_prev_button_clicked_cb, this);
3457 m_find_word_next_button = elm_button_add(m_navi_bar);
3458 if (!m_find_word_next_button) {
3459 BROWSER_LOGE("elm_button_add failed");
3462 elm_object_style_set(m_find_word_next_button, "browser/find_word_next_but");
3463 elm_object_part_content_set(url_layout, "elm.swallow.find_word_next", m_find_word_next_button);
3464 evas_object_show(m_find_word_next_button);
3465 evas_object_smart_callback_add(m_find_word_next_button, "clicked", __find_word_next_button_clicked_cb, this);
3467 const char *current_theme = elm_theme_get(NULL);
3468 if (current_theme && strstr(current_theme, "white")) {
3470 // edje_object_signal_emit(elm_layout_edje_get(m_find_word_entry_layout),
3471 // "black_theme,signal", "");
3477 void Browser_View::__find_word_erase_button_clicked_cb(void *data, Evas_Object *obj,
3478 const char *emission, const char *source)
3480 BROWSER_LOGD("[%s]", __func__);
3481 Browser_View *browser_view = (Browser_View *)data;
3482 edje_object_part_text_set(elm_layout_edje_get(browser_view->m_option_header_find_word_layout), "elm.index_text", "0/0");
3485 void Browser_View::__find_word_cancel_button_clicked_cb(void *data, Evas_Object *obj, void *event_info)
3487 BROWSER_LOGD("[%s]", __func__);
3491 Browser_View *browser_view = (Browser_View *)data;
3492 browser_view->_set_edit_mode(BR_NO_EDIT_MODE);
3493 browser_view->m_find_word->find_word("", Browser_Find_Word::BROWSER_FIND_WORD_FORWARD);
3496 void Browser_View::__find_word_prev_button_clicked_cb(void *data, Evas_Object *obj, void *event_info)
3498 BROWSER_LOGD("[%s]", __func__);
3502 Browser_View *browser_view = (Browser_View *)data;
3503 edje_object_signal_emit(elm_layout_edje_get(browser_view->m_main_layout), "hide,control_bar,no_animation,signal", "");
3504 Evas_Object *edit_field_entry = br_elm_editfield_entry_get(browser_view->m_find_word_edit_field);
3505 const char *find_word = elm_entry_entry_get(edit_field_entry);
3506 if (!find_word || !strlen(find_word))
3509 int index = browser_view->m_find_word->find_word(find_word, Browser_Find_Word::BROWSER_FIND_WORD_BACKWARD);
3511 elm_object_focus_set(browser_view->m_find_word_cancel_button, EINA_TRUE);
3513 void Browser_View::__find_word_next_button_clicked_cb(void *data, Evas_Object *obj, void *event_info)
3515 BROWSER_LOGD("[%s]", __func__);
3519 Browser_View *browser_view = (Browser_View *)data;
3520 edje_object_signal_emit(elm_layout_edje_get(browser_view->m_main_layout), "hide,control_bar,no_animation,signal", "");
3521 Evas_Object *edit_field_entry = br_elm_editfield_entry_get(browser_view->m_find_word_edit_field);
3522 const char *find_word = elm_entry_entry_get(edit_field_entry);
3523 if (!find_word || !strlen(find_word))
3526 int index = browser_view->m_find_word->find_word(find_word, Browser_Find_Word::BROWSER_FIND_WORD_FORWARD);
3527 if (index == browser_view->m_find_word->get_match_max_value())
3528 elm_object_focus_set(browser_view->m_find_word_cancel_button, EINA_TRUE);
3531 void Browser_View::__find_word_entry_imf_event_cb(void *data, Ecore_IMF_Context *ctx, int value)
3533 BROWSER_LOGD("value=%d", value);
3537 Browser_View *browser_view = (Browser_View *)data;
3538 Evas_Object *find_word_editfield_entry = br_elm_editfield_entry_get(browser_view->m_find_word_edit_field);
3540 if (value == ECORE_IMF_INPUT_PANEL_STATE_HIDE)
3541 elm_object_focus_set(find_word_editfield_entry, EINA_FALSE);
3543 elm_object_focus_set(find_word_editfield_entry, EINA_TRUE);
3546 void Browser_View::_enable_browser_scroller_scroll(void)
3548 #ifdef BROWSER_SCROLLER_BOUNCING
3549 if (!ewk_view_vertical_panning_hold_get(m_focused_window->m_ewk_view)
3550 && !_is_loading() && !m_is_full_screen) {
3551 BROWSER_LOGD("<< unlock browser scroller, lock ewk view >>");
3552 elm_object_scroll_freeze_pop(m_scroller);
3553 ewk_view_vertical_panning_hold_set(m_focused_window->m_ewk_view, EINA_TRUE);
3558 void Browser_View::_enable_webview_scroll(void)
3560 #ifdef BROWSER_SCROLLER_BOUNCING
3561 if (ewk_view_vertical_panning_hold_get(m_focused_window->m_ewk_view)) {
3562 BROWSER_LOGD("<< lock browser scroller, unlock ewk view >>");
3563 elm_object_scroll_freeze_pop(m_scroller);
3564 elm_object_scroll_freeze_push(m_scroller);
3565 ewk_view_vertical_panning_hold_set(m_focused_window->m_ewk_view, EINA_FALSE);
3570 void Browser_View::__find_word_entry_enter_key_cb(void *data, Evas_Object *obj, void *event_info)
3572 BROWSER_LOGD("[%s]", __func__);
3576 Browser_View *browser_view = (Browser_View *)data;
3577 edje_object_signal_emit(elm_layout_edje_get(browser_view->m_main_layout), "hide,control_bar,no_animation,signal", "");
3578 Evas_Object *edit_field_entry = br_elm_editfield_entry_get(browser_view->m_find_word_edit_field);
3579 const char *find_word = elm_entry_entry_get(edit_field_entry);
3580 if (!find_word || !strlen(find_word))
3583 browser_view->m_find_word->init_index();
3584 browser_view->m_find_word->find_word(find_word, Browser_Find_Word::BROWSER_FIND_WORD_FORWARD);
3586 elm_object_focus_set(edit_field_entry, EINA_FALSE);
3587 BROWSER_LOGD("find_word=[%s]", find_word);
3590 void Browser_View::__find_word_entry_changed_cb(void *data, Evas_Object *obj, void *event_info)
3592 BROWSER_LOGD("[%s]", __func__);
3596 Browser_View *browser_view = (Browser_View *)data;
3597 Evas_Object *edit_field_entry = br_elm_editfield_entry_get(browser_view->m_find_word_edit_field);
3598 const char *find_word = elm_entry_entry_get(edit_field_entry);
3600 browser_view->m_find_word->init_index();
3601 browser_view->m_find_word->find_word(find_word, Browser_Find_Word::BROWSER_FIND_WORD_FORWARD);
3605 void Browser_View::_navigationbar_title_clicked(void)
3607 BROWSER_LOGD("[%s]", __func__);
3608 Elm_Object_Item *top_it = elm_naviframe_top_item_get(m_navi_bar);
3609 Evas_Object *content = elm_object_item_content_get(top_it);
3610 if (content != m_main_layout)
3613 if (m_data_manager->is_in_view_stack(BR_MULTI_WINDOW_VIEW)
3614 #if defined(FEATURE_MOST_VISITED_SITES)
3615 || is_most_visited_sites_running()
3617 || m_edit_mode != BR_NO_EDIT_MODE)
3624 elm_scroller_region_get(m_scroller, &scroller_x, &scroller_y, &scroller_w, &scroller_h);
3626 if (scroller_y == 0) {
3627 /* scroller is on top, the url bar in scroller is fully being displayed.
3628 * Then, just show/hide the tool bar. */
3629 const char* state = edje_object_part_state_get(elm_layout_edje_get(m_main_layout),
3630 "elm.swallow.control_bar", NULL);
3631 if(state && !strncmp(state, "default", strlen("default")))
3632 edje_object_signal_emit(elm_layout_edje_get(m_main_layout), "show,control_bar,signal", "");
3634 #ifdef BROWSER_SCROLLER_BOUNCING
3635 int url_layout_h = 0;
3636 evas_object_geometry_get(m_url_layout, NULL, NULL, NULL, &url_layout_h);
3637 elm_scroller_region_bring_in(m_scroller ,scroller_x, url_layout_h, scroller_w, scroller_h);
3641 if (_is_loading()) {
3643 Eina_Bool visible = _navigationbar_visible_get();
3644 #ifdef BROWSER_SCROLLER_BOUNCING
3645 _navigationbar_visible_set(!visible);
3652 void Browser_View::_jump_to_top(void)
3654 BROWSER_LOGD("[%s]", __func__);
3655 Elm_Object_Item *top_it = elm_naviframe_top_item_get(m_navi_bar);
3656 Evas_Object *content = elm_object_item_content_get(top_it);
3657 if (content != m_main_layout)
3660 if (m_data_manager->is_in_view_stack(BR_MULTI_WINDOW_VIEW)
3661 #if defined(FEATURE_MOST_VISITED_SITES)
3662 || is_most_visited_sites_running()
3664 || m_edit_mode != BR_NO_EDIT_MODE)
3667 int browser_scroller_x = 0;
3668 int browser_scroller_w = 0;
3669 int browser_scroller_h = 0;
3670 elm_scroller_region_get(m_scroller, &browser_scroller_x, NULL,
3671 &browser_scroller_w, &browser_scroller_h);
3672 elm_scroller_region_show(m_scroller, browser_scroller_x, 0, browser_scroller_w, browser_scroller_h);
3674 ewk_view_top_of_contents_go(m_focused_window->m_ewk_view);
3677 void Browser_View::delete_non_user_created_windows(void)
3679 BROWSER_LOGD("[%s]", __func__);
3680 /* Delete no-backward history window. */
3681 std::vector<Browser_Window *> window_list = m_browser->get_window_list();
3682 int window_count = window_list.size();
3684 if (window_count <= 1)
3688 for (i = 0 ; i < window_count ; i++) {
3689 BROWSER_LOGD("focusable_window = %d, window[%d]=%d", m_focused_window, i, window_list[i]);
3690 if (window_list[i]->m_ewk_view
3691 &&!ewk_view_back_possible(window_list[i]->m_ewk_view)
3692 && window_list[i] != m_focused_window
3693 && window_list[i]->m_created_by_user == EINA_FALSE) {
3694 BROWSER_LOGD("delete window index=[%d]", i);
3695 m_browser->delete_window(window_list[i]);
3697 /* Set title & url with the focused window. */
3698 _set_navigationbar_title(get_title().c_str());
3699 _set_url_entry(get_url().c_str());
3700 _set_controlbar_back_forward_status();
3701 if (!_set_favicon())
3702 BROWSER_LOGE("_set_favicon failed");
3707 void Browser_View::__title_back_button_clicked_cb(void *data , Evas_Object *obj, void *event_info)
3709 BROWSER_LOGD("[%s]", __func__);
3713 if (m_data_manager->is_in_view_stack(BR_MULTI_WINDOW_VIEW)) {
3714 BROWSER_LOGD("close multi window");
3715 m_data_manager->get_multi_window_view()->close_multi_window();
3719 Browser_View *browser_view = (Browser_View *)data;
3721 if (browser_view->m_focused_window->m_ewk_view
3722 && ewk_view_back_possible(browser_view->m_focused_window->m_ewk_view))
3723 ewk_view_back(browser_view->m_focused_window->m_ewk_view);
3725 if (browser_view->m_focused_window->m_parent) {
3726 /* Save current window pointer to delete later. */
3727 Browser_Window *delete_window = browser_view->m_focused_window;
3728 browser_view->m_browser->set_focused_window(browser_view->m_focused_window->m_parent);
3729 browser_view->m_browser->delete_window(delete_window);
3731 /* Set title & url with the focused window. */
3732 browser_view->_set_navigationbar_title(browser_view->get_title().c_str());
3733 browser_view->_set_url_entry(browser_view->get_url().c_str());
3734 browser_view->_set_controlbar_back_forward_status();
3735 if (!browser_view->_set_favicon())
3736 BROWSER_LOGE("_set_favicon failed");
3738 elm_win_lower(browser_view->m_win);
3740 browser_view->delete_non_user_created_windows();
3745 void Browser_View::__scroller_scroll_cb(void *data, Evas_Object *obj, void *event_info)
3747 #ifdef BROWSER_SCROLLER_BOUNCING
3751 Browser_View *browser_view = (Browser_View *)data;
3753 int browser_scroller_x = 0;
3754 int browser_scroller_y = 0;
3755 int browser_scroller_w = 0;
3756 int browser_scroller_h = 0;
3757 elm_scroller_region_get(browser_view->m_scroller, &browser_scroller_x, &browser_scroller_y,
3758 &browser_scroller_w, &browser_scroller_h);
3760 int url_layout_h = 0;
3761 evas_object_geometry_get(browser_view->m_url_layout, NULL, NULL, NULL, &url_layout_h);
3764 * If user scrolls up/down near the url bar edge, the movement of scroller is not smooth.
3765 * It's because the browser scroller region y is also bouncing.
3766 * So if the scroller region y is bigger than the height of url bar(65 pixel),
3767 * make the region y to url bar height by force. */
3768 if (browser_scroller_y > url_layout_h)
3769 elm_scroller_region_show(browser_view->m_scroller, browser_scroller_x, url_layout_h,
3770 browser_scroller_w, browser_scroller_h);
3774 Eina_Bool Browser_View::_is_loading(void)
3776 if (!m_focused_window || !m_focused_window->m_ewk_view)
3779 double progress = ewk_view_load_progress_get(m_focused_window->m_ewk_view);
3780 // BROWSER_LOGD("progress=%f", progress);
3781 if (progress == 1.0f || progress < 0.05f)
3787 #if defined(HORIZONTAL_UI)
3788 Eina_Bool Browser_View::is_available_to_rotate(void)
3791 if (m_data_manager->is_in_view_stack(BR_MULTI_WINDOW_VIEW)) {
3792 if (m_data_manager->get_multi_window_view()->is_reordering_mode())
3796 if (m_scissorbox_view)
3802 Eina_Bool Browser_View::__rotate_multi_window_cb(void *data)
3804 BROWSER_LOGD("[%s]", __func__);
3805 Browser_View *browser_view = (Browser_View *)data;
3806 browser_view->m_multi_window_rotate_timer = NULL;
3807 browser_view->_rotate_multi_window();
3809 return ECORE_CALLBACK_CANCEL;
3812 void Browser_View::rotate(int degree)
3815 /* In landscape mode, if the url bar is not displayed -> rotate to portrait mode.
3816 * Then the url bar is displayed. To avoid this issue, remember the scroller region y,
3817 * then restore it at portrait mode. */
3818 int scroller_region_y = 0;
3819 elm_scroller_region_get(m_scroller, NULL, &scroller_region_y, NULL, NULL);
3820 m_scroller_region_y = scroller_region_y;
3822 m_rotate_degree = degree;
3824 #if defined(FEATURE_MOST_VISITED_SITES)
3825 if (m_most_visited_sites)
3826 m_most_visited_sites->rotate();
3828 if (m_scissorbox_view)
3829 _destroy_scissorbox_view();
3832 void Browser_View::suspend_ewk_view(Evas_Object *ewk_view)
3834 BROWSER_LOGD("[%s]", __func__);
3836 std::vector<Browser_Window *> window_list = m_browser->get_window_list();
3837 for (int i = 0 ; i < window_list.size() ; i++) {
3838 if (window_list[i]->m_ewk_view_layout) {
3839 edje_object_signal_emit(elm_layout_edje_get(window_list[i]->m_ewk_view_layout),
3840 "unresizable,signal", "");
3845 ewk_view_suspend(ewk_view);
3846 ewk_view_visibility_set(ewk_view, EINA_FALSE);
3849 void Browser_View::resume_ewk_view(Evas_Object *ewk_view)
3851 BROWSER_LOGD("[%s]", __func__);
3853 if (m_data_manager->is_in_view_stack(BR_MULTI_WINDOW_VIEW))
3856 ewk_view_resume(ewk_view);
3857 ewk_view_visibility_set(ewk_view, EINA_TRUE);
3860 void Browser_View::pause(void)
3862 BROWSER_LOGD("[%s]", __func__);
3863 if (_is_loading()) {
3864 /* Because the progress wheel in url bar has about 15% cpu consumption.
3865 * So, pause the animation when browser goes to background. It's nonsense!*/
3866 if (m_option_header_url_progresswheel)
3867 elm_progressbar_pulse(m_option_header_url_progresswheel, EINA_FALSE);
3868 if (m_url_progresswheel)
3869 elm_progressbar_pulse(m_url_progresswheel, EINA_FALSE);
3872 set_full_sreen(EINA_FALSE);
3876 suspend_ewk_view(m_focused_window->m_ewk_view);
3878 /* stop vibration */
3879 _haptic_device_stop();
3882 void Browser_View::resume(void)
3884 BROWSER_LOGD("[%s]", __func__);
3885 if (_is_loading()) {
3886 /* Because the progress wheel in url bar has about 15% cpu consumption.
3887 * So, pause the animation when browser goes to background. It's nonsense! */
3888 if (m_option_header_url_progresswheel)
3889 elm_progressbar_pulse(m_option_header_url_progresswheel, EINA_TRUE);
3890 if (m_url_progresswheel)
3891 elm_progressbar_pulse(m_url_progresswheel, EINA_TRUE);
3896 resume_ewk_view(m_focused_window->m_ewk_view);
3899 void Browser_View::reset(void)
3901 BROWSER_LOGD("[%s]", __func__);
3902 if (m_focused_window && m_focused_window->m_ewk_view)
3906 Eina_Bool Browser_View::__webview_layout_resize_idler_cb(void *data)
3910 return ECORE_CALLBACK_CANCEL;
3912 Browser_View *browser_view = (Browser_View *)data;
3914 browser_view->m_resize_idler = NULL;
3916 edje_object_signal_emit(elm_layout_edje_get(browser_view->m_focused_window->m_ewk_view_layout),
3917 "resizable,signal", "");
3921 #ifdef BROWSER_SCROLLER_BOUNCING
3922 edje_object_part_geometry_get(elm_layout_edje_get(browser_view->m_main_layout),
3923 "elm.swallow.content", NULL, NULL, &content_w, &content_h);
3925 edje_object_part_geometry_get(elm_layout_edje_get(browser_view->m_focused_window->m_ewk_view_layout),
3926 "elm.swallow.webview", NULL, NULL, &content_w, &content_h);
3928 if (browser_view->m_is_full_screen) {
3929 int browser_scroller_y = 0;
3930 evas_object_geometry_get(browser_view->m_scroller, NULL, &browser_scroller_y, NULL, NULL);
3931 evas_object_resize(browser_view->m_focused_window->m_ewk_view,
3932 content_w, content_h + browser_scroller_y);
3934 evas_object_size_hint_min_set(browser_view->m_focused_window->m_ewk_view_layout,
3935 content_w, content_h);
3936 evas_object_resize(browser_view->m_focused_window->m_ewk_view_layout,
3937 content_w, content_h);
3940 return ECORE_CALLBACK_CANCEL;
3943 Eina_Bool Browser_View::__scroller_bring_in_idler_cb(void *data)
3945 BROWSER_LOGD("[%s]", __func__);
3947 return ECORE_CALLBACK_CANCEL;
3948 Browser_View *browser_view = (Browser_View *)data;
3950 int url_layout_h = 0;
3951 evas_object_geometry_get(browser_view->m_url_layout, NULL, NULL, NULL, &url_layout_h);
3953 BROWSER_LOGD("<< elm_scroller_region_bring_in , url_layout_h=%d >>", url_layout_h);
3954 int browser_scroller_x = 0;
3955 int browser_scroller_w = 0;
3956 int browser_scroller_h = 0;
3957 elm_scroller_region_get(browser_view->m_scroller, &browser_scroller_x, NULL,
3958 &browser_scroller_w, &browser_scroller_h);
3959 elm_scroller_region_show(browser_view->m_scroller, browser_scroller_x, url_layout_h,
3960 browser_scroller_w, browser_scroller_h);
3962 return ECORE_CALLBACK_CANCEL;
3966 * If user invokes the keypad via input field or url entry, resize the webview.
3967 * The only scroller resize is called when the keypad is launched.
3968 * Other elements like layout, conformant resize event doesn't come. */
3969 void Browser_View::__scroller_resize_cb(void* data, Evas* evas, Evas_Object* obj, void* ev)
3971 BROWSER_LOGD("[%s]", __func__);
3975 Browser_View *browser_view = (Browser_View *)data;
3977 if (browser_view->m_is_full_screen) {
3978 ecore_idler_add(__webview_layout_resize_idler_cb, browser_view);
3984 evas_object_geometry_get(browser_view->m_scroller, NULL, NULL, &scroller_w, &scroller_h);
3985 std::vector<Browser_Window *> window_list = m_browser->get_window_list();
3987 for (int i = 0 ; i < window_list.size() ; i++) {
3988 if (window_list[i]->m_ewk_view_layout) {
3989 edje_object_signal_emit(elm_layout_edje_get(window_list[i]->m_ewk_view_layout),
3990 "resizable,signal", "");
3992 evas_object_size_hint_min_set(window_list[i]->m_ewk_view_layout,
3993 scroller_w, scroller_h);
3994 evas_object_resize(window_list[i]->m_ewk_view_layout,
3995 scroller_w, scroller_h);
3999 #if defined(HORIZONTAL_UI)
4000 Evas_Object *edit_field_entry;
4001 edit_field_entry = br_elm_editfield_entry_get(browser_view->_get_activated_url_entry());
4002 Ecore_IMF_Context *ic = (Ecore_IMF_Context *)elm_entry_imf_context_get(edit_field_entry);
4003 /* If the keypad from webkit is invoked in landscape mode, the visible viewport is too narrow.
4004 * So, hide the url bar in browser scroller by bring in.
4005 * The direct bring in call doesn't work, so do it by idler. */
4006 if (ic && browser_view->is_landscape()) {
4007 Ecore_IMF_Input_Panel_State imf_state = ecore_imf_context_input_panel_state_get(ic);
4008 /* Strangley, The state of webkit's imf is show-state even if the ic is url entry.
4009 * However, this is good for browser without webkit's ic get API. */
4010 if (imf_state == ECORE_IMF_INPUT_PANEL_STATE_SHOW) {
4011 browser_view->_enable_browser_scroller_scroll();
4012 ecore_idler_add(__scroller_bring_in_idler_cb, browser_view);
4017 if (m_data_manager->is_in_view_stack(BR_MULTI_WINDOW_VIEW)) {
4018 BROWSER_LOGD("close multi window");
4019 browser_view->m_is_multi_window_grid_mode = m_data_manager->get_multi_window_view()->_is_grid_mode();
4020 m_data_manager->get_multi_window_view()->close_multi_window();
4022 #if defined(HORIZONTAL_UI)
4023 if (browser_view->m_multi_window_rotate_timer)
4024 ecore_timer_del(browser_view->m_multi_window_rotate_timer);
4025 browser_view->m_multi_window_rotate_timer = ecore_timer_add(0.2, __rotate_multi_window_cb, browser_view);
4032 Eina_Bool Browser_View::__zoom_button_timeout_cb(void *data)
4034 BROWSER_LOGD("[%s]", __func__);
4036 return ECORE_CALLBACK_CANCEL;
4038 Browser_View *browser_view = (Browser_View *)data;
4039 browser_view->m_zoom_button_timer = NULL;
4041 edje_object_signal_emit(elm_layout_edje_get(browser_view->m_main_layout), "hide,zoom_buttons,signal", "");
4043 return ECORE_CALLBACK_CANCEL;
4046 void Browser_View::__zoom_out_clicked_cb(void *data, Evas_Object *obj, void *event_info)
4048 BROWSER_LOGD("[%s]", __func__);
4052 Browser_View *browser_view = (Browser_View *)data;
4053 double scale_factor = ewk_view_scale_get(browser_view->m_focused_window->m_ewk_view);
4054 ewk_view_scale_set(browser_view->m_focused_window->m_ewk_view, scale_factor - 0.5f, 0, 0);
4056 if (browser_view->m_zoom_button_timer)
4057 ecore_timer_del(browser_view->m_zoom_button_timer);
4058 browser_view->m_zoom_button_timer = ecore_timer_add(3, __zoom_button_timeout_cb, browser_view);
4061 void Browser_View::__zoom_in_clicked_cb(void *data, Evas_Object *obj, void *event_info)
4063 BROWSER_LOGD("[%s]", __func__);
4067 Browser_View *browser_view = (Browser_View *)data;
4068 double scale_factor = ewk_view_scale_get(browser_view->m_focused_window->m_ewk_view);
4069 ewk_view_scale_set(browser_view->m_focused_window->m_ewk_view, scale_factor + 0.5f, 0, 0);
4071 if (browser_view->m_zoom_button_timer)
4072 ecore_timer_del(browser_view->m_zoom_button_timer);
4073 browser_view->m_zoom_button_timer = ecore_timer_add(3, __zoom_button_timeout_cb, browser_view);
4076 Eina_Bool Browser_View::_create_zoom_buttons(void)
4078 BROWSER_LOGD("[%s]", __func__);
4079 m_zoom_out_button = elm_button_add(m_navi_bar);
4080 if (!m_zoom_out_button) {
4081 BROWSER_LOGE("elm_button_add failed");
4084 elm_object_style_set(m_zoom_out_button, "browser/zoom_out");
4085 elm_object_part_content_set(m_main_layout, "elm.swallow.zoom_out_button", m_zoom_out_button);
4086 evas_object_smart_callback_add(m_zoom_out_button, "clicked", __zoom_out_clicked_cb, this);
4087 evas_object_show(m_zoom_out_button);
4089 m_zoom_in_button = elm_button_add(m_navi_bar);
4090 if (!m_zoom_in_button) {
4091 BROWSER_LOGE("elm_button_add failed");
4095 elm_object_style_set(m_zoom_in_button, "browser/zoom_in");
4096 elm_object_part_content_set(m_main_layout, "elm.swallow.zoom_in_button", m_zoom_in_button);
4097 evas_object_smart_callback_add(m_zoom_in_button, "clicked", __zoom_in_clicked_cb, this);
4098 evas_object_show(m_zoom_in_button);
4104 void Browser_View::__naviframe_pop_finished_cb(void *data , Evas_Object *obj, void *event_info)
4106 BROWSER_LOGD("[%s]", __func__);
4110 Browser_View *browser_view = (Browser_View *)data;
4111 Elm_Object_Item *it = (Elm_Object_Item *)event_info;
4113 if (browser_view->m_navi_it != elm_naviframe_top_item_get(m_navi_bar))
4116 m_data_manager->destroy_bookmark_view();
4117 m_data_manager->destroy_history_layout();
4118 /* Add to bookmark, then cancel. */
4119 m_data_manager->destroy_add_to_bookmark_view();
4120 #if defined(FEATURE_MOST_VISITED_SITES)
4121 m_data_manager->destroy_add_to_most_visited_sites_view();
4124 /* If return from browser settings. */
4125 if (browser_view->m_browser_settings) {
4126 delete browser_view->m_browser_settings;
4127 browser_view->m_browser_settings = NULL;
4131 void Browser_View::__dim_area_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
4133 BROWSER_LOGD("[%s]", __func__);
4137 Browser_View *browser_view = (Browser_View *)data;
4139 elm_object_focus_set(m_data_manager->get_browser_view()->m_option_header_cancel_button, EINA_TRUE);
4142 void Browser_View::__context_menu_bg_mouse_down_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
4144 BROWSER_LOGD("[%s]", __func__);
4148 Browser_View *browser_view = (Browser_View *)data;
4150 browser_view->_destroy_more_context_popup();
4153 Eina_Bool Browser_View::_create_main_layout(void)
4155 BROWSER_LOGD("[%s]", __func__);
4156 m_main_layout = elm_layout_add(m_navi_bar);
4157 if (!m_main_layout) {
4158 BROWSER_LOGE("elm_layout_add failed!");
4162 if (!elm_layout_file_set(m_main_layout, BROWSER_EDJE_DIR"/browser-view-main.edj",
4163 "browser/browser-view-main")) {
4164 BROWSER_LOGE("elm_layout_file_set failed", BROWSER_EDJE_DIR);
4168 evas_object_size_hint_weight_set(m_main_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
4169 evas_object_size_hint_align_set(m_main_layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
4170 evas_object_show(m_main_layout);
4172 m_title_back_button = elm_button_add(m_navi_bar);
4173 if (!m_title_back_button) {
4174 BROWSER_LOGE("elm_button_add failed!");
4177 evas_object_smart_callback_add(m_title_back_button, "clicked", __title_back_button_clicked_cb, this);
4179 m_navi_it = elm_naviframe_item_push(m_navi_bar, "", NULL, NULL, m_main_layout, NULL);
4181 evas_object_smart_callback_add(m_navi_bar, "transition,finished", __naviframe_pop_finished_cb, this);
4183 elm_object_style_set(m_title_back_button, "browser/title_back");
4184 elm_object_item_part_content_set(m_navi_it, ELM_NAVIFRAME_ITEM_TITLE_LEFT_BTN, m_title_back_button);
4186 evas_object_show(m_title_back_button);
4187 evas_object_show(m_navi_bar);
4189 m_scroller = elm_scroller_add(m_navi_bar);
4191 BROWSER_LOGE("elm_scroller_add failed!");
4194 /* Do not propagate event to scroller's ancestor */
4195 /* not to call unnecessary other callbacks. */
4196 evas_object_propagate_events_set(m_scroller, EINA_FALSE);
4198 /* Do not use scroller's scrollbar, use webview's scrollbar instead */
4199 elm_scroller_policy_set(m_scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
4200 evas_object_size_hint_align_set(m_scroller, EVAS_HINT_FILL, 0.0);
4201 evas_object_size_hint_weight_set(m_scroller, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
4202 #ifdef BROWSER_SCROLLER_BOUNCING
4203 // elm_scroller_bounce_set(m_scroller, EINA_FALSE, EINA_TRUE);
4204 elm_scroller_bounce_set(m_scroller, EINA_FALSE, EINA_FALSE);
4206 elm_scroller_bounce_set(m_scroller, EINA_FALSE, EINA_FALSE);
4207 elm_object_scroll_freeze_pop(m_scroller);
4208 elm_object_scroll_freeze_push(m_scroller);
4210 evas_object_show(m_scroller);
4212 evas_object_smart_callback_add(m_scroller, "scroll", __scroller_scroll_cb, this);
4213 evas_object_event_callback_add(m_scroller, EVAS_CALLBACK_RESIZE, __scroller_resize_cb, this);
4215 /* create content box which contains navigation layout & webview */
4216 m_content_box = elm_box_add(m_main_layout);
4217 if (!m_content_box) {
4218 BROWSER_LOGE("elm_box_add failed!");
4222 elm_box_horizontal_set(m_content_box, EINA_FALSE);
4223 evas_object_size_hint_weight_set(m_content_box, EVAS_HINT_EXPAND, 0.0);
4224 evas_object_size_hint_align_set(m_content_box, EVAS_HINT_FILL, EVAS_HINT_FILL);
4225 elm_object_content_set(m_scroller, m_content_box);
4226 evas_object_show(m_content_box);
4228 /* create dummy loading progress bar which is displayed at launching time shortly */
4229 m_dummy_loading_progressbar = elm_progressbar_add(m_navi_bar);
4230 if (!m_dummy_loading_progressbar) {
4231 BROWSER_LOGE("elm_progressbar_add failed!");
4235 elm_object_style_set(m_dummy_loading_progressbar, "browser/loading_wheel");
4236 elm_progressbar_pulse(m_dummy_loading_progressbar, EINA_TRUE);
4237 evas_object_size_hint_weight_set(m_dummy_loading_progressbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
4238 evas_object_size_hint_align_set(m_dummy_loading_progressbar, EVAS_HINT_FILL, EVAS_HINT_FILL);
4239 elm_object_part_content_set(m_main_layout, "elm.swallow.waiting_progress", m_dummy_loading_progressbar);
4240 evas_object_show(m_dummy_loading_progressbar);
4242 /* create conformant */
4243 elm_win_conformant_set(m_win, EINA_TRUE);
4244 m_conformant = elm_conformant_add(m_main_layout);
4245 if (!m_conformant) {
4246 BROWSER_LOGE("elm_conformant_add failed!");
4250 elm_object_style_set(m_conformant, "internal_layout");
4251 evas_object_size_hint_weight_set(m_conformant, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
4252 evas_object_size_hint_align_set(m_conformant, EVAS_HINT_FILL, EVAS_HINT_FILL);
4253 elm_object_content_set(m_conformant, m_scroller);
4254 elm_object_part_content_set(m_main_layout, "elm.swallow.content", m_conformant);
4255 evas_object_show(m_conformant);
4257 m_url_layout = _create_url_layout();
4258 if (!m_url_layout) {
4259 BROWSER_LOGE("_create_url_layout failed!");
4262 elm_box_pack_start(m_content_box, m_url_layout);
4264 m_control_bar = _create_control_bar();
4265 if (!m_control_bar) {
4266 BROWSER_LOGE("_create_control_bar failed!");
4269 elm_object_part_content_set(m_main_layout, "elm.swallow.control_bar", m_control_bar);
4271 m_option_header_url_layout = _create_option_header_url_layout();
4272 if (!m_option_header_url_layout) {
4273 BROWSER_LOGE("_create_option_header_url_layout failed!");
4277 m_option_header_layout = elm_layout_add(m_navi_bar);
4278 if (!m_option_header_layout) {
4279 BROWSER_LOGE("elm_layout_add failed!");
4282 if (!elm_layout_file_set(m_option_header_layout, BROWSER_EDJE_DIR"/browser-view-url-layout.edj",
4283 "browser-view/option_header")) {
4284 BROWSER_LOGE("Can not set layout theme[browser/url_layout]\n");
4287 evas_object_size_hint_weight_set(m_option_header_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
4288 evas_object_size_hint_align_set(m_option_header_layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
4290 elm_object_part_content_set(m_option_header_layout, "elm.swallow.url_layout", m_option_header_url_layout);
4291 evas_object_show(m_option_header_layout);
4293 m_option_header_find_word_layout = _create_find_word_layout();
4294 if (!m_option_header_find_word_layout) {
4295 BROWSER_LOGE("_create_find_word_layout failed");
4298 elm_object_part_content_set(m_option_header_layout, "elm.swallow.find_word_layout", m_option_header_find_word_layout);
4300 elm_object_item_part_content_set(m_navi_it, ELM_NAVIFRAME_ITEM_OPTIONHEADER, m_option_header_layout);
4301 _navigationbar_visible_set_signal(EINA_FALSE);
4304 if (!_create_zoom_buttons()) {
4305 BROWSER_LOGE("_create_zoom_buttons failed");
4310 edje_object_signal_callback_add(elm_layout_edje_get(m_main_layout),
4311 "mouse,clicked,1", "elm.rect.content_dim", __dim_area_clicked_cb, this);
4313 edje_object_signal_callback_add(elm_layout_edje_get(m_main_layout),
4314 "mouse,down,1", "elm.rect.more_context_bg", __context_menu_bg_mouse_down_cb, this);
4316 const char *current_theme = elm_theme_get(NULL);
4317 if (current_theme && strstr(current_theme, "white")) {
4319 // edje_object_signal_emit(elm_layout_edje_get(m_url_entry_layout), "black_theme,signal", "");
4320 // edje_object_signal_emit(elm_layout_edje_get(m_option_header_url_entry_layout),
4321 // "black_theme,signal", "");