Docomo Felica WebPlugin issue fixed
[apps/osp/Internet.git] / src / IntSettingPresentationModel.cpp
1 //
2
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://floralicense.org/license/
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 //!Internet
19 /*@file:        IntSettingsPresentationModel.cpp
20  *@brief:       Used to define SettingsManager
21  */
22
23 #include <cstdlib>
24 #include "IntCommonLib.h"
25 #include "IntSettingPresentationModel.h"
26
27 using namespace Tizen::App;
28 using namespace Tizen::Base;
29 using namespace Tizen::Base::Collection;
30 using namespace Tizen::Io;
31 using namespace Tizen::Ui::Controls;
32 using namespace Tizen::Web::Controls;
33
34 SettingPresentationModel* SettingPresentationModel::__pSettingsPresentationModel = null;
35
36 SettingPresentationModel::SettingPresentationModel(void)
37 {
38         __listenerList.Construct();
39         SetDefaultValues();
40         __isPrivateOn = false;
41 }
42
43 SettingPresentationModel::SettingPresentationModel(const SettingPresentationModel& settingModelObj)
44 {
45
46 }
47
48 SettingPresentationModel& SettingPresentationModel::operator=(const SettingPresentationModel& settingModelObj)
49 {
50         return *this;
51 }
52
53 SettingPresentationModel::~SettingPresentationModel(void)
54 {
55
56 }
57
58 void
59 SettingPresentationModel::SetDefaultValues(void)
60 {
61         //__homePage = CommonUtil::GetString(L"IDS_EMPTY_PAGE");
62         __homePage = (L"IDS_BR_BODY_MOST_VISITED_SITES");
63         __defaultViewLevel = L"IDS_BR_BODY_FIT_TO_WIDTH"; // IDS_FIT_TO_WIDTH
64         __runJsEnabled = true;
65         __displayImages = true;
66         __html5Videos = true;
67         __wordWrap = true;
68         __blockPopUp = true;
69         __rememberFormData = false;
70         __rememberPassword = false;
71         __cookies = true;
72         __savePassword = CommonUtil::GetString(L"IDS_BR_BODY_ALWAYS_ASK");              // IDS_ALWAYS_ASK
73         __securityWarnings = true;
74         __searchEngine = CommonUtil::GetString(L"IDS_BR_BODY_YAHOO"); //        L"Yahoo";
75         __caseSensitive = false;
76         __runReader = true;
77         __fontSize = 24;
78
79         __setting.SetInputStyle(INPUT_STYLE_OVERLAY);
80         __setting.SetAutoImageLoadEnabled(__displayImages);
81         __setting.SetJavascriptEnabled(__runJsEnabled);
82         __setting.SetJavaScriptPopupEnabled(__blockPopUp);
83
84         if (__securityWarnings == true)
85         {
86                 __setting.SetCertificateErrorHandlingMode(WEB_CERTIFICATE_ERROR_HANDLING_MODE_USER_CONFIRM);
87         }
88         else
89         {
90                 __setting.SetCertificateErrorHandlingMode(WEB_CERTIFICATE_ERROR_HANDLING_MODE_CONTINUE);
91         }
92 }
93
94 void
95 SettingPresentationModel::CreateInstance(void)
96 {
97         if (__pSettingsPresentationModel == null)
98                 __pSettingsPresentationModel = new(std::nothrow) SettingPresentationModel();
99         result r = __pSettingsPresentationModel->Construct();
100         if (IsFailed(r))
101         {
102                 delete __pSettingsPresentationModel;
103                 __pSettingsPresentationModel = null;
104                 return;
105         }
106         std::atexit(DestroyInstance);
107 }
108
109 SettingPresentationModel*
110 SettingPresentationModel::GetInstance(void)
111 {
112         if (__pSettingsPresentationModel == null)
113         {
114                 CreateInstance();
115         }
116         return __pSettingsPresentationModel;
117 }
118
119 void
120 SettingPresentationModel::DestroyInstance(void)
121 {
122         if (__pSettingsPresentationModel)
123         {
124                 delete __pSettingsPresentationModel;
125                 __pSettingsPresentationModel = null;
126         }
127 }
128
129 result
130 SettingPresentationModel::LoadRegistry(void)
131 {
132         AppLog("SettingPresentationModel::LoadRegistry entered");
133         result r = E_FAILURE;
134
135         SetDefaultValues();
136         for (int settingValueName = REGISTRY_SETTING_HOMEPAGE; settingValueName < MAX_REGISTRY_SETTING; settingValueName++)
137         {
138                 r = AppRegistry::GetInstance()->Get(__entry[settingValueName], __values[settingValueName]);
139                 if (r != E_SUCCESS && r != E_KEY_NOT_FOUND)
140                 {
141                         AppLog("Registry Load failed with result %s settingValueName %d", GetErrorMessage(r),settingValueName);
142                         return r;
143                 }
144         }
145         if (__values[REGISTRY_SETTING_HOMEPAGE].CompareTo(L"") != 0)
146         {
147                 __homePage = __values[REGISTRY_SETTING_HOMEPAGE];
148                 AppLog("homepage Loading from registry %ls",__homePage.GetPointer());
149         }
150         if (__values[REGISTRY_SETTING_DEFAULT_VIEW].CompareTo(L"") != 0)
151         {
152                 __defaultViewLevel = __values[REGISTRY_SETTING_DEFAULT_VIEW];
153         }
154         if (__values[REGISTRY_SETTING_RUN_JAVASCRIPT].CompareTo(L"") != 0)
155         {
156                 __runJsEnabled = Boolean::Parse(__values[REGISTRY_SETTING_RUN_JAVASCRIPT], false);
157                 AppLogDebug("LoadRegistry __runJsEnabled %d",__runJsEnabled);
158         }
159         if (__values[REGISTRY_SETTING_DISPLAY_IMAGES].CompareTo(L"") != 0)
160         {
161                 __displayImages = Boolean::Parse(__values[REGISTRY_SETTING_DISPLAY_IMAGES], false);
162                 AppLogDebug("LoadRegistry __displayImages %d",__displayImages);
163         }
164         if (__values[REGISTRY_SETTING_HTML5_VIDEOS].CompareTo(L"") != 0)
165         {
166                 __html5Videos = Boolean::Parse(__values[REGISTRY_SETTING_HTML5_VIDEOS], false);
167                 AppLogDebug("LoadRegistry __html5Videos %d",__html5Videos);
168         }
169         if (__values[REGISTRY_SETTING_WORD_WRAPPING].CompareTo(L"") != 0)
170         {
171                 __wordWrap = Boolean::Parse(__values[REGISTRY_SETTING_WORD_WRAPPING], false);
172                 AppLogDebug("LoadRegistry __wordWrap %d",__wordWrap);
173         }
174         if (__values[REGISTRY_SETTING_BLOCK_POPUP].CompareTo(L"") != 0)
175         {
176                 __blockPopUp = Boolean::Parse(__values[REGISTRY_SETTING_BLOCK_POPUP], false);
177                 AppLogDebug("LoadRegistry __blockPopUp %d",__blockPopUp);
178         }
179         if (__values[REGISTRY_SETTING_ACCEPT_COOKIES].CompareTo(L"") != 0)
180         {
181                 __cookies = Boolean::Parse(__values[REGISTRY_SETTING_ACCEPT_COOKIES], false);
182                 AppLogDebug("LoadRegistry __cookies %d",__cookies);
183         }
184         if (__values[REGISTRY_SETTING_AUTOSAVE_ID_PASSWORD].CompareTo(L"") != 0)
185         {
186                 __savePassword = __values[REGISTRY_SETTING_AUTOSAVE_ID_PASSWORD];
187         }
188         if (__values[REGISTRY_SETTING_SHOW_SECURITY_WARNINGS].CompareTo(L"") != 0)
189         {
190                 __securityWarnings = Boolean::Parse(__values[REGISTRY_SETTING_SHOW_SECURITY_WARNINGS], false);
191                 AppLogDebug("LoadRegistry __securityWarnings %d",__securityWarnings);
192         }
193         if (__values[REGISTRY_SETTING_SEARCH_ENGINE].CompareTo(L"") != 0)
194         {
195                 __searchEngine = __values[REGISTRY_SETTING_SEARCH_ENGINE];
196         }
197         if (__values[REGISTRY_SETTING_CASE_SENSITIVE].CompareTo(L"") != 0)
198         {
199                 __caseSensitive = Boolean::Parse(__values[REGISTRY_SETTING_CASE_SENSITIVE], false);
200                 AppLogDebug("LoadRegistry __caseSensitive %d",__caseSensitive);
201         }
202         if (__values[REGISTRY_SETTING_RUN_READER].CompareTo(L"") != 0)
203         {
204                 __runReader = Boolean::Parse(__values[REGISTRY_SETTING_RUN_READER], false);
205                 AppLogDebug("LoadRegistry __runReader %d",__runReader);
206         }
207         if (__values[REGISTRY_SETTING_READER_FONT_SIZE].CompareTo(L"") != 0)
208         {
209                 Integer::Parse(__values[REGISTRY_SETTING_READER_FONT_SIZE], (int&)__fontSize);
210         }
211         if (__values[REGISTRY_SETTING_REMEMBER_FORM_DATA].CompareTo(L"") != 0)
212         {
213                 __rememberFormData = Boolean::Parse(__values[REGISTRY_SETTING_REMEMBER_FORM_DATA], false);
214                 AppLogDebug("LoadRegistry form data %d",__rememberFormData);
215         }
216         if (__values[REGISTRY_SETTING_REMEMBER_PASSWORD].CompareTo(L"") != 0)
217         {
218                 __rememberPassword = Boolean::Parse(__values[REGISTRY_SETTING_REMEMBER_PASSWORD], false);
219                 AppLogDebug("LoadRegistry form password %d",__rememberPassword);
220         }
221         //
222         for (int index = REGISTRY_SETTING_HOMEPAGE; index < MAX_REGISTRY_SETTING; index++)
223         {
224                 AppLogDebug("registry loaded value :%ls at index %d", __values[index].GetPointer(), index);
225         }
226         __setting.SetInputStyle(INPUT_STYLE_OVERLAY);
227         __setting.SetAutoImageLoadEnabled(__displayImages);
228         __setting.SetJavascriptEnabled(__runJsEnabled);
229         __setting.SetJavaScriptPopupEnabled(__blockPopUp);
230
231         if (__securityWarnings == true)
232         {
233                 __setting.SetCertificateErrorHandlingMode(WEB_CERTIFICATE_ERROR_HANDLING_MODE_USER_CONFIRM);
234         }
235         else
236         {
237                 __setting.SetCertificateErrorHandlingMode(WEB_CERTIFICATE_ERROR_HANDLING_MODE_CONTINUE);
238         }
239         __favouriteURL.Clear();
240         __favouriteURL = L"";
241         r = AppRegistry::GetInstance()->Get(__entry[REGISTRY_SETTING_FAVORITE_URL_VALUE], __favouriteURL);
242         AppLog("__favouriteURL taken from registry is %ls",__favouriteURL.GetPointer());
243
244         if (r != E_SUCCESS && r != E_KEY_NOT_FOUND)
245         {
246                 AppLogDebug("Registry Load failed with result %s", GetErrorMessage(r));
247                 return r;
248         }
249
250         return E_SUCCESS;
251 }
252
253 result
254 SettingPresentationModel::ResetRegistry(void)
255 {
256         result r = E_FAILURE;
257
258         AppLogDebug("SettingsManager::ResetRegistry");
259         for (int index = REGISTRY_SETTING_INVALID+1; index < MAX_REGISTRY_SETTING; index++)
260         {
261                 r = AppRegistry::GetInstance()->Remove(__entry[index]);
262                 AppLogDebug("Registry Remove result %s",GetErrorMessage(r));
263         }
264
265         AppRegistry::GetInstance()->Save();
266
267         for (int index = REGISTRY_SETTING_HOMEPAGE; index < MAX_REGISTRY_SETTING; index++)
268         {
269                 __values[index] = L"";
270         }
271
272         SetDefaultValues();
273         for (int index = 0; index < __listenerList.GetCount(); index++)
274         {
275                 ISettingChangeEventListener* pSettingsListener = static_cast< ISettingChangeEventListener* >(__listenerList.GetAt(index));
276                 if (pSettingsListener)
277                         pSettingsListener->OnSettingsReset();
278         }
279
280         return E_SUCCESS;
281 }
282
283 void
284 SettingPresentationModel::ClearCache(void)
285 {
286         for (int index = 0; index < __listenerList.GetCount(); index++)
287         {
288                 ISettingChangeEventListener* pSettingsListener = static_cast< ISettingChangeEventListener* >(__listenerList.GetAt(index));
289                 if (pSettingsListener)
290                         pSettingsListener->OnClearCache();
291         }
292 }
293
294 void
295 SettingPresentationModel::ClearCookie(void)
296 {
297         for (int index = 0; index < __listenerList.GetCount(); index++)
298         {
299                 ISettingChangeEventListener* pSettingsListener = static_cast< ISettingChangeEventListener* >(__listenerList.GetAt(index));
300                 if (pSettingsListener)
301                         pSettingsListener->OnClearCookie();
302         }
303 }
304
305 void
306 SettingPresentationModel::ClearFormData(void)
307 {
308         for (int index = 0; index < __listenerList.GetCount(); index++)
309         {
310                 ISettingChangeEventListener* pSettingsListener = static_cast< ISettingChangeEventListener* >(__listenerList.GetAt(index));
311                 if (pSettingsListener)
312                         pSettingsListener->OnClearFormData();
313         }
314 }
315
316 void
317 SettingPresentationModel::ClearPasswords(void)
318 {
319         for (int index = 0; index < __listenerList.GetCount(); index++)
320         {
321                 ISettingChangeEventListener* pSettingsListener = static_cast< ISettingChangeEventListener* >(__listenerList.GetAt(index));
322                 if (pSettingsListener)
323                         pSettingsListener->OnClearPasswords();
324         }
325 }
326
327 result
328 SettingPresentationModel::Construct(void)
329 {
330         result r = E_FAILURE;
331
332         for (int index = REGISTRY_SETTING_HOMEPAGE; index < MAX_REGISTRY_SETTING; index++)
333         {
334                 __values[index] = L"";
335         }
336
337         __entry[REGISTRY_SETTING_HOMEPAGE] = L"homePage";
338         __entry[REGISTRY_SETTING_DEFAULT_VIEW] = L"defaultViewLevel";
339         __entry[REGISTRY_SETTING_RUN_JAVASCRIPT] = L"runJs";
340         __entry[REGISTRY_SETTING_DISPLAY_IMAGES] = L"displayImages";
341         __entry[REGISTRY_SETTING_HTML5_VIDEOS] = L"html5Videos";
342         __entry[REGISTRY_SETTING_WORD_WRAPPING] = L"wordWrap";
343         __entry[REGISTRY_SETTING_BLOCK_POPUP] = L"blockPopUp";
344         __entry[REGISTRY_SETTING_ACCEPT_COOKIES] = L"cookies";
345         __entry[REGISTRY_SETTING_AUTOSAVE_ID_PASSWORD] = L"savePassword";
346         __entry[REGISTRY_SETTING_SHOW_SECURITY_WARNINGS] = L"securityWarnings";
347         __entry[REGISTRY_SETTING_SEARCH_ENGINE] = L"searchEngine";
348         __entry[REGISTRY_SETTING_CASE_SENSITIVE] = L"caseSensitive";
349         __entry[REGISTRY_SETTING_RUN_READER] = L"runReader";
350         __entry[REGISTRY_SETTING_READER_FONT_SIZE] = L"fontSize";
351         __entry[REGISTRY_SETTING_FAVORITE_URL_VALUE] = L"Favourite";
352         __entry[REGISTRY_SETTING_REMEMBER_FORM_DATA] = L"formData";
353         __entry[REGISTRY_SETTING_REMEMBER_PASSWORD] = L"rememberPassword";
354
355         r = LoadRegistry();
356         return E_SUCCESS;
357 }
358
359 result
360 SettingPresentationModel::SetValue(const int settingValueName, const String& val)
361 {
362         result r = E_FAILURE;
363
364         AppLogDebug("SettingsManager::SetValue settingValueName:%d val %ls", settingValueName, val.GetPointer());
365         if (__values[settingValueName] == L"")
366         {
367                 AppLogDebug("adding the new (std::nothrow) entry into registry");
368                 r = AppRegistry::GetInstance()->Add(__entry[settingValueName], val);
369         }
370         else
371         {
372                 AppLogDebug("modifying entry into registry");
373                 r = AppRegistry::GetInstance()->Set(__entry[settingValueName], val);
374         }
375         TryCatch(!IsFailed(r),,"Adding into registry failed %s",GetErrorMessage(r));
376
377         r = AppRegistry::GetInstance()->Save();
378         TryCatch(!IsFailed(r),,"Save Failed with error %s",GetErrorMessage(r));
379
380         for (int index = 0; index < __listenerList.GetCount(); index++)
381         {
382                 ISettingChangeEventListener* pSettingsListener = static_cast< ISettingChangeEventListener* >(__listenerList.GetAt(index));
383                 if (pSettingsListener)
384                         pSettingsListener->OnSettingsChange(settingValueName);
385         }
386
387         __values[settingValueName] = val;
388
389         CATCH:
390         return r;
391
392 }
393
394 result
395 SettingPresentationModel::SetFavoriteValue(const Tizen::Base::String& val)
396 {
397         result r = E_FAILURE;
398
399         if (__favouriteURL == L"")
400                 r = AppRegistry::GetInstance()->Add(__entry[REGISTRY_SETTING_FAVORITE_URL_VALUE], val);
401         else
402                 r = AppRegistry::GetInstance()->Set(__entry[REGISTRY_SETTING_FAVORITE_URL_VALUE], val);
403         TryCatch(!IsFailed(r),,"registry set failed with error %s",GetErrorMessage(r));
404         r = AppRegistry::GetInstance()->Save();
405         TryCatch(!IsFailed(r),,"registry set failed with error %s",GetErrorMessage(r));
406         __favouriteURL.Clear();
407         __favouriteURL.Append(val);
408
409         CATCH:
410         return r;
411 }
412
413 String
414 SettingPresentationModel::GetFavoriteUrl(void)
415 {
416         __favouriteURL.Clear();
417         __favouriteURL =  L"";
418         AppRegistry::GetInstance()->Get(__entry[REGISTRY_SETTING_FAVORITE_URL_VALUE], __favouriteURL);
419
420         return __favouriteURL;
421 }
422
423 void
424 SettingPresentationModel::AddSettingsEventListener(const ISettingChangeEventListener& listener)
425 {
426         __listenerList.Add(listener);
427 }
428
429 void
430 SettingPresentationModel::RemoveSettingsEventListener(ISettingChangeEventListener& listener)
431 {
432         __listenerList.Remove(listener, false);
433 }
434
435 void
436 SettingPresentationModel::SetHomepage(const String& homePage)
437 {
438         __homePage.Clear();
439         __homePage.Append(homePage);
440         AppLog("SettingPresentationModel::SetHomepage %ls",__homePage.GetPointer());
441         SetValue((int) REGISTRY_SETTING_HOMEPAGE, __homePage);
442 }
443
444 String
445 SettingPresentationModel::GetHomepage(void)
446 {
447         return __homePage;
448 }
449
450 void
451 SettingPresentationModel::SetDefaultView(const String& viewLevel)
452 {
453         __defaultViewLevel = viewLevel;
454         //CommonUtil::GetString(L"IDS_FIT_TO_WIDTH")
455         if (__defaultViewLevel.CompareTo(CommonUtil::GetString(L"IDS_BR_BODY_FIT_TO_WIDTH")) == 0)
456         {
457                 __setting.SetAutoFittingEnabled(true);
458         }
459         else if (__defaultViewLevel.CompareTo(CommonUtil::GetString(L"IDS_BR_BODY_READABLE")) == 0)
460         {
461                 __setting.SetAutoFittingEnabled(false);
462         }
463
464         SetValue((int) REGISTRY_SETTING_DEFAULT_VIEW, viewLevel);
465 }
466
467 String
468 SettingPresentationModel::GetDefaultView(void)
469 {
470         return __defaultViewLevel;
471 }
472
473 void
474 SettingPresentationModel::SetRunJavascriptEnabled(bool runJsEnabled)
475 {
476         __runJsEnabled = runJsEnabled;
477         SetValue((int) REGISTRY_SETTING_RUN_JAVASCRIPT, Boolean::ToString(runJsEnabled));
478         __setting.SetJavascriptEnabled(runJsEnabled);
479 }
480
481 bool
482 SettingPresentationModel::IsRunJavascriptEnabled(void)
483 {
484         return __runJsEnabled;
485 }
486
487 void
488 SettingPresentationModel::SetDisplayImagesEnabled(bool displayImages)
489 {
490         __displayImages = displayImages;
491         SetValue((int) REGISTRY_SETTING_DISPLAY_IMAGES, Boolean::ToString(displayImages));
492         __setting.SetAutoImageLoadEnabled(__displayImages);
493 }
494
495 bool
496 SettingPresentationModel::IsDisplayImagesEnabled(void)
497 {
498         return __displayImages;
499 }
500
501 void
502 SettingPresentationModel::SetHtml5VideosEnabled(bool html5Videos)
503 {
504         __html5Videos = html5Videos;
505         SetValue((int) REGISTRY_SETTING_HTML5_VIDEOS, Boolean::ToString(html5Videos));
506 }
507
508 bool
509 SettingPresentationModel::IsHtml5VideosEnabled(void)
510 {
511         return __html5Videos;
512 }
513
514 void
515 SettingPresentationModel::SetWordWrapEnabled(bool wordWrap)
516 {
517         __wordWrap = wordWrap;
518         SetValue((int) REGISTRY_SETTING_WORD_WRAPPING, Boolean::ToString(wordWrap));
519 }
520
521 bool
522 SettingPresentationModel::IsWordWrapEnabled(void)
523 {
524         return __wordWrap;
525 }
526
527 void
528 SettingPresentationModel::SetBlockPopUp(bool blockPopUp)
529 {
530         __blockPopUp = blockPopUp;
531         SetValue((int) REGISTRY_SETTING_BLOCK_POPUP, Boolean::ToString(blockPopUp));
532         __setting.SetJavaScriptPopupEnabled(__blockPopUp);
533 }
534
535 bool
536 SettingPresentationModel::IsBlockPopUp(void)
537 {
538         return __blockPopUp;
539 }
540
541 void
542 SettingPresentationModel::SetCookiesEnabled(bool cookiesEnabled)
543 {
544         __cookies = cookiesEnabled;
545         SetValue((int) REGISTRY_SETTING_ACCEPT_COOKIES, Boolean::ToString(cookiesEnabled));
546 }
547
548 bool
549 SettingPresentationModel::IsCookiesEnabled(void)
550 {
551         return __cookies;
552 }
553
554 void
555 SettingPresentationModel::SetRememberFormData(bool formData)
556 {
557         __rememberFormData = formData;
558         SetValue((int) REGISTRY_SETTING_REMEMBER_FORM_DATA, Boolean::ToString(__rememberFormData));
559 }
560
561 bool
562 SettingPresentationModel::IsRememberFormData(void)
563 {
564         return __rememberFormData;
565 }
566
567 void SettingPresentationModel::SetRememberPassword(bool rememberPassword)
568 {
569         __rememberPassword = rememberPassword;
570         SetValue((int) REGISTRY_SETTING_REMEMBER_PASSWORD, Boolean::ToString(__rememberPassword));
571 }
572
573 bool SettingPresentationModel::IsRememberPassword(void)
574 {
575         return __rememberPassword;
576 }
577
578 void
579 SettingPresentationModel::SetSavePassword(const String& savePassword)
580 {
581         __savePassword = savePassword;
582         SetValue((int) REGISTRY_SETTING_AUTOSAVE_ID_PASSWORD, savePassword);
583 }
584
585 String
586 SettingPresentationModel::GetSavePassword(void)
587 {
588         return __savePassword;
589 }
590
591 void
592 SettingPresentationModel::SetSecurityWarningsEnabled(bool securityWarnings)
593 {
594         __securityWarnings = securityWarnings;
595         SetValue((int) REGISTRY_SETTING_SHOW_SECURITY_WARNINGS, Boolean::ToString(securityWarnings));
596         if (__securityWarnings == true)
597         {
598                 __setting.SetCertificateErrorHandlingMode(WEB_CERTIFICATE_ERROR_HANDLING_MODE_USER_CONFIRM);
599         }
600         else
601         {
602                 __setting.SetCertificateErrorHandlingMode(WEB_CERTIFICATE_ERROR_HANDLING_MODE_CONTINUE);
603         }
604 }
605
606 bool
607 SettingPresentationModel::IsSecurityWarningsEnabled(void)
608 {
609         return __securityWarnings;
610 }
611
612 void
613 SettingPresentationModel::SetSearchEngine(const String& searchEngine)
614 {
615         __searchEngine = searchEngine;
616         SetValue((int) REGISTRY_SETTING_SEARCH_ENGINE, searchEngine);
617 }
618
619 String
620 SettingPresentationModel::GetSearchEngine(void)
621 {
622         return __searchEngine;
623 }
624
625 void
626 SettingPresentationModel::SetCaseSensitiveEnabled(bool caseSensitive)
627 {
628         __caseSensitive = caseSensitive;
629         SetValue((int) REGISTRY_SETTING_CASE_SENSITIVE, Boolean::ToString(caseSensitive));
630 }
631
632 bool
633 SettingPresentationModel::IsCaseSensitiveEnabled(void)
634 {
635         return __caseSensitive;
636 }
637
638 void
639 SettingPresentationModel::SetRunReaderEnabled(bool runReader)
640 {
641         __runReader = runReader;
642         SetValue((int) REGISTRY_SETTING_RUN_READER, Boolean::ToString(runReader));
643 }
644
645 bool
646 SettingPresentationModel::IsRunReaderEnabled(void)
647 {
648         return __runReader;
649 }
650
651 void
652 SettingPresentationModel::SetReaderFontSize(int fontSize)
653 {
654         __fontSize = fontSize;
655         SetValue((int) REGISTRY_SETTING_READER_FONT_SIZE, Integer::ToString(__fontSize));
656 }
657
658 int
659 SettingPresentationModel::GetReaderFontSize(void)
660 {
661         return __fontSize;
662 }
663
664 String
665 SettingPresentationModel::GetSearchUrl(const String& searchText)
666 {
667         String searchStr = L"";
668         if (GetSearchEngine().CompareTo(CommonUtil::GetString(L"IDS_BR_BODY_YAHOO")) == 0)
669         {
670                 searchStr.Append(L"http://search.yahoo.com/search?p=");
671                 searchStr.Append(searchText);
672         }
673         else if (GetSearchEngine().CompareTo(CommonUtil::GetString(L"IDS_BR_BODY_NAVER")) == 0)
674         {
675                 searchStr.Append(L"http://search.naver.com/search.naver?query=");
676                 searchStr.Append(searchText);
677         }
678         else if (GetSearchEngine().CompareTo(CommonUtil::GetString(L"IDS_COM_BODY_GOOGLE")) == 0)
679         {
680                 searchStr.Append(L"http://www.google.com/search?q=");
681                 searchStr.Append(searchText);
682         }
683         return searchStr;
684 }
685
686 Tizen::Web::Controls::WebSetting&
687 SettingPresentationModel::GetWebSettings(void)
688 {
689         return __setting;
690 }
691
692 void
693 SettingPresentationModel::SetPrivateOn(bool isPrivateOn)
694 {
695         __isPrivateOn = isPrivateOn;
696         return;
697 }
698
699 bool
700 SettingPresentationModel::GetPrivateOn(void)
701 {
702         return __isPrivateOn;
703 }