1 // Copyright 2014 Samsung Electronics. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
8 #include <Elementary.h>
9 #include <ewk_context.h>
10 #include <ewk_settings.h>
11 #if defined(OS_TIZEN_MOBILE)
12 #include <efl_extension.h>
20 static std::string kDefaultNewWindowURL = "http://www.google.com";
21 static double kMinViewScale = 1.0;
22 static double kMaxViewScale = 4.0;
23 static int kNotificationTimeoutSec = 3;
26 WindowUI::WindowUI(Window& window, Browser& browser)
31 , is_loading_(false) {
32 navbar_ = elm_box_add(window_.GetEvasObject());
33 elm_box_horizontal_set(navbar_, EINA_TRUE);
34 elm_box_homogeneous_set(navbar_, EINA_TRUE);
35 evas_object_size_hint_weight_set(navbar_, EVAS_HINT_EXPAND, 0.0f);
36 evas_object_size_hint_align_set(navbar_, EVAS_HINT_FILL, EVAS_HINT_FILL);
38 AddButton(navbar_, "file", "New Window", &WindowUI::OnCreateWindow);
39 if (browser_.IsDesktop())
40 AddButton(navbar_, "file", "New Incognito Window",
41 &WindowUI::OnCreateIncognitoWindow);
42 back_button_ = AddButton(navbar_, "arrow_left", "Back", &WindowUI::OnBack);
43 forward_button_ = AddButton(navbar_, "arrow_right", "Forward",
44 &WindowUI::OnForward);
45 stop_reload_button_ = AddButton(navbar_, "refresh", "Reload",
46 &WindowUI::OnStopOrReload);
47 AddButton(navbar_, "arrow_up", "More Actions",
48 &WindowUI::OnShowExtraActionsMenu);
50 urlbar_ = elm_box_add(window_.GetEvasObject());
51 elm_box_horizontal_set(urlbar_, EINA_TRUE);
52 evas_object_size_hint_weight_set(urlbar_, EVAS_HINT_EXPAND, 0.0f);
53 evas_object_size_hint_align_set(urlbar_, EVAS_HINT_FILL, EVAS_HINT_FILL);
55 progress_bar_ = elm_progressbar_add(window_.GetEvasObject());
56 elm_object_style_set(progress_bar_, "wheel");
57 elm_progressbar_pulse_set(progress_bar_, EINA_TRUE);
58 elm_progressbar_pulse(progress_bar_, EINA_FALSE);
59 elm_box_pack_end(urlbar_, progress_bar_);
60 evas_object_show(progress_bar_);
62 url_entry_ = elm_entry_add(urlbar_);
63 elm_entry_single_line_set(url_entry_, EINA_TRUE);
64 elm_entry_scrollable_set(url_entry_, EINA_TRUE);
65 elm_entry_input_panel_layout_set(url_entry_, ELM_INPUT_PANEL_LAYOUT_URL);
66 evas_object_size_hint_weight_set(url_entry_, EVAS_HINT_EXPAND, 1.0f);
67 evas_object_size_hint_align_set(url_entry_, EVAS_HINT_FILL, EVAS_HINT_FILL);
68 evas_object_smart_callback_add(url_entry_, "activated", OnURLEntered, this);
69 elm_box_pack_end(urlbar_, url_entry_);
70 evas_object_show(url_entry_);
72 Evas_Object* separator = elm_separator_add(urlbar_);
73 elm_separator_horizontal_set(separator, EINA_TRUE);
74 elm_box_pack_end(urlbar_, separator);
75 evas_object_show(separator);
77 #if defined(OS_TIZEN_MOBILE)
78 eext_object_event_callback_add(window_.GetEvasObject(), EEXT_CALLBACK_BACK, WindowUI::OnBack, this);
81 EnableBackButton(false);
82 EnableForwardButton(false);
85 WindowUI::~WindowUI() {
87 evas_object_del(active_popup_);
90 void WindowUI::OnURLChanged(const char* url) {
91 log_trace("%s: %s", __PRETTY_FUNCTION__, url);
92 elm_object_text_set(url_entry_, url);
95 void WindowUI::OnLoadingStarted() {
96 log_trace("%s", __PRETTY_FUNCTION__);
97 elm_progressbar_pulse(progress_bar_, EINA_TRUE);
98 Evas_Object* icon = elm_object_part_content_get(stop_reload_button_, "icon");
99 elm_icon_standard_set(icon, "close");
100 if (browser_.IsDesktop())
101 elm_object_text_set(stop_reload_button_, "Stop");
105 void WindowUI::OnLoadingFinished() {
106 log_trace("%s", __PRETTY_FUNCTION__);
107 elm_progressbar_pulse(progress_bar_, EINA_FALSE);
108 Evas_Object* icon = elm_object_part_content_get(stop_reload_button_, "icon");
109 elm_icon_standard_set(icon, "refresh");
110 if (browser_.IsDesktop())
111 elm_object_text_set(stop_reload_button_, "Reload");
115 void WindowUI::EnableBackButton(bool enable) {
116 elm_object_disabled_set(back_button_, !enable);
119 void WindowUI::EnableForwardButton(bool enable) {
120 elm_object_disabled_set(forward_button_, !enable);
123 void WindowUI::ShowNotification(const char* text) {
124 log_trace("%s : %s", __PRETTY_FUNCTION__, text);
125 Evas_Object* notification = elm_notify_add(window_.GetEvasObject());
126 elm_notify_timeout_set(notification, kNotificationTimeoutSec);
127 Evas_Object* content = elm_label_add(notification);
128 elm_object_text_set(content, text);
129 elm_object_content_set(notification, content);
130 elm_notify_align_set(notification, 0.5, 0.5);
131 evas_object_show(notification);
134 Evas_Object* WindowUI::AddButton(Evas_Object* parent,
135 const char* icon, const char* label, Evas_Smart_Cb cb) {
136 Evas_Object* bt = elm_button_add(parent);
137 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
138 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0.5);
139 if (label && browser_.IsDesktop())
140 elm_object_text_set(bt, label);
142 Evas_Object* icon_elm = elm_icon_add(bt);
143 elm_icon_standard_set(icon_elm, icon);
144 elm_object_part_content_set(bt, "icon", icon_elm);
146 evas_object_smart_callback_add(bt, "clicked", cb, this);
147 elm_box_pack_end(parent, bt);
148 evas_object_show(bt);
155 void _HideCtxPopup(void* data, Evas_Object* obj, void*) {
156 evas_object_hide(obj);
161 void WindowUI::CloseMenu() {
162 evas_object_hide(menu_);
163 evas_object_del(menu_);
167 Evas_Object* WindowUI::CreateExtraActionsMenu(Evas_Object* parent) {
172 menu_ = elm_ctxpopup_add(parent);
174 #if defined(OS_TIZEN_MOBILE)
176 evas_object_geometry_get(parent, 0, 0, &width, 0);
177 evas_object_size_hint_min_set(menu_, width, 0);
179 evas_object_smart_callback_add(menu_, "dismissed", _HideCtxPopup, NULL);
181 if (window_.IsFormProfileEnabled()) {
182 elm_ctxpopup_item_append(menu_, "Disable Form Profile", NULL,
183 &WindowUI::OnFormProfileChange, this);
185 elm_ctxpopup_item_append(menu_, "Enable Form Profile", NULL,
186 &WindowUI::OnFormProfileChange, this);
189 if (window_.IsRememberFormDataEnabled()) {
190 elm_ctxpopup_item_append(menu_, "Disable Remember Form Data", NULL,
191 &WindowUI::OnRememberFormDataChange, this);
193 elm_ctxpopup_item_append(menu_, "Enable Remember Form Data", NULL,
194 &WindowUI::OnRememberFormDataChange, this);
197 if (window_.IsRememberPasswordEnabled()) {
198 elm_ctxpopup_item_append(menu_, "Disable Remember Password", NULL,
199 &WindowUI::OnRememberPasswordChange, this);
201 elm_ctxpopup_item_append(menu_, "Enable Remember Password", NULL,
202 &WindowUI::OnRememberPasswordChange, this);
205 elm_ctxpopup_item_append(menu_, "Override User Agent String", NULL,
206 &WindowUI::OnUAOverride, this);
208 if (browser_.IsDesktop()) {
209 elm_ctxpopup_item_append(menu_, "Show Web Inspector", NULL,
210 &WindowUI::OnInspectorShow, this);
212 elm_ctxpopup_item_append(menu_, "Start Web Inspector server", NULL,
213 &WindowUI::OnInspectorServerStart, this);
215 #if !defined(OS_TIZEN)
216 elm_ctxpopup_item_append(menu_, "Simulate screen rotation", NULL,
217 &WindowUI::OnRotate, this);
220 if (window_.AreTouchEventsEnabled()) {
221 elm_ctxpopup_item_append(menu_, "Enable mouse events", NULL,
222 &WindowUI::OnSelectMouseInput, this);
224 elm_ctxpopup_item_append(menu_, "Enable touch events", NULL,
225 &WindowUI::OnSelectTouchInput, this);
228 if (!browser_.IsTracingEnabled()) {
229 elm_ctxpopup_item_append(menu_, "Start tracing", NULL,
230 &WindowUI::OnStartTracing, this);
232 elm_ctxpopup_item_append(menu_, "Stop tracing", NULL,
233 &WindowUI::OnStopTracing, this);
236 Ewk_Settings* settings = window_.GetEwkSettings();
237 if (!ewk_settings_auto_fitting_get(settings)) {
238 elm_ctxpopup_item_append(menu_, "Enable auto fitting", NULL,
239 &WindowUI::OnAutoFittingEnabled, this);
241 elm_ctxpopup_item_append(menu_, "Disable auto fitting", NULL,
242 &WindowUI::OnAutoFittingDisabled, this);
245 if (!ewk_settings_form_profile_data_enabled_get(settings) ||
246 !ewk_settings_form_candidate_data_enabled_get(settings)) {
247 elm_ctxpopup_item_append(menu_, "Enable autofill", NULL,
248 &WindowUI::OnAutoFillEnabled, this);
250 elm_ctxpopup_item_append(menu_, "Disable autofill", NULL,
251 &WindowUI::OnAutoFillDisabled, this);
254 if (window_.IsPrivateBrowsingEnabled()) {
255 elm_ctxpopup_item_append(menu_, "Disable Private Browsing", NULL,
256 &WindowUI::OnPrivateBrowsingChange, this);
258 elm_ctxpopup_item_append(menu_, "Enable PrivateBrowsing", NULL,
259 &WindowUI::OnPrivateBrowsingChange, this);
262 elm_ctxpopup_item_append(menu_, "Change page zoom level", NULL,
263 &WindowUI::OnShowZoomPopup, this);
265 elm_ctxpopup_item_append(menu_, "Quit", NULL, &WindowUI::Exit, this);
270 void WindowUI::ShowPermissionPopup(const char* title,
271 const char* description, PermissionCallback cb, void* data) {
272 log_trace("%s: (%s, %s)", __PRETTY_FUNCTION__, title, description);
274 Evas_Object* popup = elm_popup_add(window_.GetEvasObject());
275 elm_object_part_text_set(popup, "title,text", title);
276 elm_object_part_text_set(popup, NULL, description);
277 elm_popup_orient_set(popup, ELM_POPUP_ORIENT_CENTER);
278 active_popup_ = popup;
280 Evas_Object* btn = elm_button_add(popup);
281 elm_object_text_set(btn, "Yes");
282 PermissionPopupButtonData* buttonData = new PermissionPopupButtonData;
283 buttonData->callbackData=data;
284 buttonData->callback=cb;
285 buttonData->popupData=this;
287 evas_object_smart_callback_add(btn, "clicked", PermissionGranted,
289 elm_object_part_content_set(popup, "button1", btn);
291 btn = elm_button_add(popup);
292 elm_object_text_set(btn, "No");
293 evas_object_smart_callback_add(btn, "clicked", PermissionDeclined,
295 elm_object_part_content_set(popup, "button2", btn);
297 evas_object_show(popup);
300 void WindowUI::PermissionGranted(void* data, Evas_Object* button, void*) {
301 log_trace("%s", __PRETTY_FUNCTION__);
303 PermissionPopupButtonData* buttonData =(PermissionPopupButtonData*) data;
304 ClosePopup(buttonData->popupData, NULL, NULL);
305 buttonData->callback(true, buttonData->callbackData);
309 void WindowUI::PermissionDeclined(void* data, Evas_Object* button, void*) {
310 log_trace("%s", __PRETTY_FUNCTION__);
312 PermissionPopupButtonData* buttonData =(PermissionPopupButtonData*) data;
313 ClosePopup(buttonData->popupData, NULL, NULL);
314 buttonData->callback(false, buttonData->callbackData);
318 void WindowUI::ShowTextEntryPopup(const char* title,
319 const char* initial_content,
321 log_trace("%s: (%s, %s)", __PRETTY_FUNCTION__, title, initial_content);
323 Evas_Object* popup = elm_popup_add(window_.GetEvasObject());
324 elm_object_part_text_set(popup, "title,text", title);
325 elm_popup_orient_set(popup, ELM_POPUP_ORIENT_CENTER);
326 active_popup_ = popup;
328 Evas_Object* entry = elm_entry_add(popup);
329 elm_entry_single_line_set(entry, EINA_TRUE);
330 elm_entry_scrollable_set(entry, EINA_TRUE);
331 elm_entry_input_panel_layout_set(entry, ELM_INPUT_PANEL_LAYOUT_URL);
332 evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, 0.0f);
333 evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
334 evas_object_smart_callback_add(
335 entry, "activated", cb,
336 new std::pair<Evas_Object*, WindowUI*>(entry, this));
338 elm_object_part_content_set(popup, "default", entry);
339 if (initial_content) {
340 elm_object_text_set(entry, initial_content);
341 elm_entry_cursor_end_set(entry);
344 Evas_Object* btn = elm_button_add(popup);
345 elm_object_text_set(btn, "OK");
346 evas_object_smart_callback_add(
347 btn, "clicked", cb, new std::pair<Evas_Object*, WindowUI*>(entry, this));
348 elm_object_part_content_set(popup, "button1", btn);
350 btn = elm_button_add(popup);
351 elm_object_text_set(btn, "Cancel");
352 evas_object_smart_callback_add(btn, "clicked", ClosePopup, this);
353 elm_object_part_content_set(popup, "button2", btn);
355 evas_object_show(popup);
358 void WindowUI::OnCreateWindow(void* data, Evas_Object*, void*) {
359 log_trace("%s", __PRETTY_FUNCTION__);
360 WindowUI* thiz = static_cast<WindowUI*>(data);
361 if (thiz->browser_.IsDesktop()) {
362 thiz->browser_.CreateWindow().LoadURL(kDefaultNewWindowURL);
364 thiz->browser_.ActivateToolboxWindow();
368 void WindowUI::OnCreateIncognitoWindow(void* data, Evas_Object*, void*) {
369 log_trace("%s", __PRETTY_FUNCTION__);
370 WindowUI* thiz = static_cast<WindowUI*>(data);
371 thiz->browser_.CreateWindow(true).LoadURL(kDefaultNewWindowURL);
374 void WindowUI::OnBack(void* data, Evas_Object*, void*) {
375 log_trace("%s", __PRETTY_FUNCTION__);
376 static_cast<WindowUI*>(data)->window_.Back();
379 void WindowUI::OnForward(void* data, Evas_Object*, void*) {
380 log_trace("%s", __PRETTY_FUNCTION__);
381 static_cast<WindowUI*>(data)->window_.Forward();
384 void WindowUI::OnStopOrReload(void* data, Evas_Object*, void*) {
385 log_trace("%s", __PRETTY_FUNCTION__);
386 WindowUI* thiz = static_cast<WindowUI*>(data);
387 if (thiz->is_loading_)
388 thiz->window_.Stop();
390 thiz->window_.Reload();
393 void WindowUI::OnShowExtraActionsMenu(void* data, Evas_Object* obj, void*) {
394 log_trace("%s", __PRETTY_FUNCTION__);
395 WindowUI* thiz = static_cast<WindowUI*>(data);
396 Evas_Object* popup = thiz->CreateExtraActionsMenu(
397 thiz->window_.GetEvasObject());
403 evas_object_geometry_get(obj, &x, &y, 0, 0);
404 evas_object_move(popup, x, y);
405 evas_object_show(popup);
408 void WindowUI::OnURLEntered(void* data, Evas_Object*, void*) {
409 log_trace("%s", __PRETTY_FUNCTION__);
410 WindowUI* thiz = static_cast<WindowUI*>(data);
411 thiz->window_.LoadURL(elm_object_text_get(thiz->url_entry_));
412 elm_object_focus_set(thiz->url_entry_, EINA_FALSE);
415 void WindowUI::OnUAOverride(void* data, Evas_Object* obj, void*) {
416 log_trace("%s", __PRETTY_FUNCTION__);
417 WindowUI* thiz = static_cast<WindowUI*>(data);
418 const char* ua = thiz->window_.GetUserAgent();
419 thiz->ShowTextEntryPopup("User Agent Override", ua,
420 &WindowUI::OnUAOverrideEntered);
424 void WindowUI::OnUAOverrideEntered(void* data, Evas_Object*, void*) {
425 std::pair<Evas_Object*, WindowUI*>* p =
426 static_cast<std::pair<Evas_Object*, WindowUI*>*>(data);
427 p->second->window_.SetUserAgent(elm_object_text_get(p->first));
428 evas_object_del(p->second->active_popup_);
429 p->second->active_popup_ = NULL;
433 void WindowUI::OnInspectorShow(void* data, Evas_Object* obj, void*) {
434 log_trace("%s", __PRETTY_FUNCTION__);
435 WindowUI* thiz = static_cast<WindowUI*>(data);
436 thiz->browser_.ShowInspectorWindow();
440 void WindowUI::OnInspectorServerStart(void* data, Evas_Object* obj, void*) {
441 log_trace("%s", __PRETTY_FUNCTION__);
442 WindowUI* thiz = static_cast<WindowUI*>(data);
443 thiz->browser_.StartInspectorServer();
447 void WindowUI::OnRotate(void* data, Evas_Object* obj, void*) {
448 log_trace("%s", __PRETTY_FUNCTION__);
449 WindowUI* thiz = static_cast<WindowUI*>(data);
450 thiz->window_.FakeRotate();
454 void WindowUI::OnSelectMouseInput(void* data, Evas_Object* obj, void*) {
455 log_trace("%s", __PRETTY_FUNCTION__);
456 WindowUI* thiz = static_cast<WindowUI*>(data);
457 thiz->window_.EnableTouchEvents(false);
458 thiz->window_.EnableMouseEvents(true);
459 thiz->ShowNotification("Mouse events enabled");
463 void WindowUI::OnSelectTouchInput(void* data, Evas_Object* obj, void*) {
464 log_trace("%s", __PRETTY_FUNCTION__);
465 WindowUI* thiz = static_cast<WindowUI*>(data);
466 thiz->window_.EnableTouchEvents(true);
467 thiz->window_.EnableMouseEvents(false);
468 thiz->ShowNotification("Touch events enabled");
472 void WindowUI::OnStartTracing(void* data, Evas_Object* obj, void*) {
473 log_trace("%s", __PRETTY_FUNCTION__);
474 WindowUI* thiz = static_cast<WindowUI*>(data);
475 thiz->browser_.StartTracing();
477 thiz->ShowNotification("Tracing started");
480 void WindowUI::OnStopTracing(void* data, Evas_Object* obj, void*) {
481 log_trace("%s", __PRETTY_FUNCTION__);
482 WindowUI* thiz = static_cast<WindowUI*>(data);
483 thiz->browser_.StopTracing();
485 thiz->ShowNotification("Tracing finished");
488 void WindowUI::OnAutoFittingEnabled(void* data, Evas_Object* obj, void*) {
489 log_trace("%s", __PRETTY_FUNCTION__);
490 WindowUI* thiz = static_cast<WindowUI*>(data);
491 Ewk_Settings* settings = thiz->window_.GetEwkSettings();
492 ewk_settings_auto_fitting_set(settings, true);
494 thiz->ShowNotification("Auto fitting enabled");
497 void WindowUI::OnAutoFittingDisabled(void* data, Evas_Object* obj, void*) {
498 log_trace("%s", __PRETTY_FUNCTION__);
499 WindowUI* thiz = static_cast<WindowUI*>(data);
500 Ewk_Settings* settings = thiz->window_.GetEwkSettings();
501 ewk_settings_auto_fitting_set(settings, false);
503 thiz->ShowNotification("Auto fitting disabled");
506 void WindowUI::OnAutoFillEnabled(void* data, Evas_Object* obj, void*) {
507 log_trace("%s", __PRETTY_FUNCTION__);
508 WindowUI* thiz = static_cast<WindowUI*>(data);
509 Ewk_Settings* settings = thiz->window_.GetEwkSettings();
510 ewk_settings_form_profile_data_enabled_set(settings, true);
511 ewk_settings_form_candidate_data_enabled_set(settings, true);
513 thiz->ShowNotification("Autofill enabled");
516 void WindowUI::OnAutoFillDisabled(void* data, Evas_Object* obj, void*) {
517 log_trace("%s", __PRETTY_FUNCTION__);
518 WindowUI* thiz = static_cast<WindowUI*>(data);
519 Ewk_Settings* settings = thiz->window_.GetEwkSettings();
520 ewk_settings_form_profile_data_enabled_set(settings, false);
521 ewk_settings_form_candidate_data_enabled_set(settings, false);
523 thiz->ShowNotification("Autofill disabled");
526 void WindowUI::ClosePopup(void* data, Evas_Object*, void*) {
527 WindowUI* thiz = static_cast<WindowUI*>(data);
528 evas_object_del(thiz->active_popup_);
529 thiz->active_popup_ = NULL;
532 void WindowUI::OnShowZoomPopup(void* data, Evas_Object* obj, void*) {
533 log_trace("%s", __PRETTY_FUNCTION__);
534 WindowUI* thiz = static_cast<WindowUI*>(data);
536 Evas_Object* popup = elm_popup_add(thiz->window_.GetEvasObject());
537 elm_object_part_text_set(popup, "title,text", "Change page zoom level");
538 elm_popup_orient_set(popup, ELM_POPUP_ORIENT_CENTER);
539 thiz->active_popup_ = popup;
540 Evas_Object* btn = elm_button_add(popup);
542 Evas_Object* slider = elm_slider_add(popup);
543 elm_slider_min_max_set(slider, kMinViewScale, kMaxViewScale);
544 elm_slider_value_set(slider, thiz->window_.GetScale());
545 elm_slider_indicator_format_set(slider, "%1.2f");
546 elm_slider_indicator_show_set(slider, EINA_TRUE);
547 evas_object_smart_callback_add(slider, "changed", &OnZoomChanged, thiz);
548 elm_object_part_content_set(popup, "default", slider);
550 elm_object_text_set(btn, "Close");
551 evas_object_smart_callback_add(btn, "clicked", ClosePopup, thiz);
552 elm_object_part_content_set(popup, "button1", btn);
554 evas_object_show(popup);
558 void WindowUI::OnZoomChanged(void* data, Evas_Object* obj, void*) {
559 log_trace("%s", __PRETTY_FUNCTION__);
560 WindowUI* thiz = static_cast<WindowUI*>(data);
561 thiz->window_.SetScale(elm_slider_value_get(obj));
564 void WindowUI::OnRememberFormDataChange(void* data, Evas_Object* obj, void*) {
565 log_trace("%s", __PRETTY_FUNCTION__);
566 WindowUI* thiz = static_cast<WindowUI*>(data);
567 Ewk_Settings* settings = thiz->window_.GetEwkSettings();
568 if (thiz->window_.IsRememberFormDataEnabled()) {
569 ewk_settings_form_candidate_data_enabled_set(settings, false);
570 thiz->ShowNotification("Remember Form Data disabled");
572 ewk_settings_form_candidate_data_enabled_set(settings, true);
573 thiz->ShowNotification("Remember Form Data enabled");
578 void WindowUI::OnRememberPasswordChange(void* data, Evas_Object* obj, void*) {
579 log_trace("%s", __PRETTY_FUNCTION__);
580 WindowUI* thiz = static_cast<WindowUI*>(data);
581 Ewk_Settings* settings = thiz->window_.GetEwkSettings();
582 if (thiz->window_.IsRememberPasswordEnabled()) {
583 ewk_settings_autofill_password_form_enabled_set(settings, false);
584 thiz->ShowNotification("Remember Password disabled");
586 ewk_settings_autofill_password_form_enabled_set(settings, true);
587 thiz->ShowNotification("Remember Password enabled");
592 void WindowUI::OnFormProfileChange(void* data, Evas_Object* obj, void*) {
593 log_trace("%s", __PRETTY_FUNCTION__);
594 WindowUI* thiz = static_cast<WindowUI*>(data);
595 Ewk_Settings* settings = thiz->window_.GetEwkSettings();
596 if (thiz->window_.IsFormProfileEnabled()) {
597 ewk_settings_form_profile_data_enabled_set(settings, false);
598 thiz->ShowNotification("Form Profile disabled");
600 ewk_settings_form_profile_data_enabled_set(settings, true);
601 thiz->ShowNotification("Form Profile enabled");
606 void WindowUI::OnPrivateBrowsingChange(void* data, Evas_Object* obj, void*) {
607 log_trace("%s", __PRETTY_FUNCTION__);
608 WindowUI* thiz = static_cast<WindowUI*>(data);
609 Ewk_Settings* settings = thiz->window_.GetEwkSettings();
610 if (thiz->window_.IsPrivateBrowsingEnabled()) {
611 ewk_settings_private_browsing_enabled_set(settings, false);
612 thiz->ShowNotification("Private browsing disabled");
614 ewk_settings_private_browsing_enabled_set(settings, true);
615 thiz->ShowNotification("Private browsing enabled");
620 void WindowUI::Exit(void* data, Evas_Object*, void*) {
621 WindowUI* thiz = static_cast<WindowUI*>(data);
622 thiz->window_.Exit();