diff options
author | Kamil Nowac <k.nowac@samsung.com> | 2016-01-05 09:16:28 +0100 |
---|---|---|
committer | Dariusz Frankiewicz <d.frankiewic@samsung.com> | 2016-01-07 03:31:04 -0800 |
commit | 6b247c2e7cea581b04c0522a87944a5572ef8b5d (patch) | |
tree | 69db2eadc211b10bc09d573ac963c27bc5ce8630 /services/SettingsUI | |
parent | 00a7f6e4108078f948d46afe3577a8c149b7d877 (diff) | |
download | browser-6b247c2e7cea581b04c0522a87944a5572ef8b5d.tar.gz browser-6b247c2e7cea581b04c0522a87944a5572ef8b5d.tar.bz2 browser-6b247c2e7cea581b04c0522a87944a5572ef8b5d.zip |
Little refactoring connected with Ewk_Context
[Issue] N/A
[Problem] Too many usages of ewk_context_default_get
[Solution] Used m_ewkContext variable
[Verify] Build browser and run
Change-Id: Ia2b2b0dda0a34d86f38d1c6e446c79e01040faa0
Diffstat (limited to 'services/SettingsUI')
4 files changed, 11 insertions, 12 deletions
diff --git a/services/SettingsUI/AutoFillForm/AutoFillFormItem.cpp b/services/SettingsUI/AutoFillForm/AutoFillFormItem.cpp index 6e812f6d..cd0753f8 100644 --- a/services/SettingsUI/AutoFillForm/AutoFillFormItem.cpp +++ b/services/SettingsUI/AutoFillForm/AutoFillFormItem.cpp @@ -22,6 +22,7 @@ namespace tizen_browser{ namespace base_ui{ AutoFillFormItem::AutoFillFormItem(AutoFillFormItemData *item_data) + : m_ewkContext(ewk_context_default_get()) { BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); @@ -90,8 +91,7 @@ profileSaveErrorcode AutoFillFormItem::saveItem(void) if (m_itemData.email_address) ewk_autofill_profile_data_set(profile, EWK_PROFILE_EMAIL, m_itemData.email_address); - Ewk_Context *ewk_context = ewk_context_default_get(); - if (ewk_context_form_autofill_profile_add(ewk_context, profile) == EINA_FALSE) { + if (ewk_context_form_autofill_profile_add(m_ewkContext, profile) == EINA_FALSE) { BROWSER_LOGE("Failed to ewk_context_form_autofill_profile_add"); ewk_autofill_profile_delete(profile); return duplicate_profile; @@ -107,8 +107,7 @@ profileEditErrorcode AutoFillFormItem::updateItem(void) BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); /* Find profile with id */ - Ewk_Context *ewk_context = ewk_context_default_get(); - Ewk_Autofill_Profile *profile = ewk_context_form_autofill_profile_get(ewk_context, m_itemData.profile_id); + Ewk_Autofill_Profile *profile = ewk_context_form_autofill_profile_get(m_ewkContext, m_itemData.profile_id); if (!profile) { BROWSER_LOGE("Failed to ewk_context_form_autofill_profile_get with ID [%d]", m_itemData.profile_id); return profile_edit_failed; @@ -135,7 +134,7 @@ profileEditErrorcode AutoFillFormItem::updateItem(void) if (m_itemData.email_address) ewk_autofill_profile_data_set(profile, EWK_PROFILE_EMAIL, m_itemData.email_address); - if (ewk_context_form_autofill_profile_set(ewk_context, m_itemData.profile_id, profile) == EINA_FALSE) { + if (ewk_context_form_autofill_profile_set(m_ewkContext, m_itemData.profile_id, profile) == EINA_FALSE) { BROWSER_LOGE("Failed to ewk_context_form_autofill_profile_set with ID [%d]", m_itemData.profile_id); return profile_already_exist; } diff --git a/services/SettingsUI/AutoFillForm/AutoFillFormItem.h b/services/SettingsUI/AutoFillForm/AutoFillFormItem.h index 7b2c6848..d9ce0594 100644 --- a/services/SettingsUI/AutoFillForm/AutoFillFormItem.h +++ b/services/SettingsUI/AutoFillForm/AutoFillFormItem.h @@ -96,6 +96,7 @@ public: private: AutoFillFormItemData m_itemData; + Ewk_Context* m_ewkContext; }; } diff --git a/services/SettingsUI/AutoFillForm/AutoFillFormManager.cpp b/services/SettingsUI/AutoFillForm/AutoFillFormManager.cpp index 6f576ead..bf8544aa 100644 --- a/services/SettingsUI/AutoFillForm/AutoFillFormManager.cpp +++ b/services/SettingsUI/AutoFillForm/AutoFillFormManager.cpp @@ -28,6 +28,7 @@ AutoFillFormManager::AutoFillFormManager(void) : m_listView(NULL) , m_composer(NULL) , m_deleteView(NULL) + , m_ewkContext(ewk_context_default_get()) { BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); @@ -75,8 +76,7 @@ std::vector<AutoFillFormItem *> AutoFillFormManager::loadEntireItemList(void) m_AutoFillFormItemList.clear(); - Ewk_Context *ewk_context = ewk_context_default_get(); - Eina_List *entire_item_list = ewk_context_form_autofill_profile_get_all(ewk_context); + Eina_List *entire_item_list = ewk_context_form_autofill_profile_get_all(m_ewkContext); Eina_List *list = NULL; void *item_data = NULL; @@ -106,8 +106,7 @@ Eina_Bool AutoFillFormManager::deleteAutoFillFormItem(AutoFillFormItem *item) BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); for (unsigned int i = 0; i < m_AutoFillFormItemList.size(); i++) { if (m_AutoFillFormItemList[i]->getProfileId() == item->getProfileId()) { - Ewk_Context *ewk_context = ewk_context_default_get(); - if (ewk_context_form_autofill_profile_remove(ewk_context, item->getProfileId()) == EINA_FALSE) + if (ewk_context_form_autofill_profile_remove(m_ewkContext, item->getProfileId()) == EINA_FALSE) return EINA_FALSE; m_AutoFillFormItemList.erase(m_AutoFillFormItemList.begin() + i); @@ -122,8 +121,7 @@ Eina_Bool AutoFillFormManager::deleteAllAutoFillFormItems(void) BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); m_AutoFillFormItemList.clear(); - Ewk_Context *ewk_context = ewk_context_default_get(); - Eina_List *entire_item_list = ewk_context_form_autofill_profile_get_all(ewk_context); + Eina_List *entire_item_list = ewk_context_form_autofill_profile_get_all(m_ewkContext); Eina_List *list = NULL; void *item_data = NULL; @@ -131,7 +129,7 @@ Eina_Bool AutoFillFormManager::deleteAllAutoFillFormItems(void) EINA_LIST_FOREACH(entire_item_list, list, item_data) { if (item_data) { Ewk_Autofill_Profile *profile = static_cast<Ewk_Autofill_Profile*>(item_data); - ewk_context_form_autofill_profile_remove(ewk_context, ewk_autofill_profile_id_get(profile)); + ewk_context_form_autofill_profile_remove(m_ewkContext, ewk_autofill_profile_id_get(profile)); } } diff --git a/services/SettingsUI/AutoFillForm/AutoFillFormManager.h b/services/SettingsUI/AutoFillForm/AutoFillFormManager.h index 8eab08d6..92dbdd51 100644 --- a/services/SettingsUI/AutoFillForm/AutoFillFormManager.h +++ b/services/SettingsUI/AutoFillForm/AutoFillFormManager.h @@ -76,6 +76,7 @@ private: AutoFillFormListView *m_listView; AutoFillFormComposeView *m_composer; AutoProfileDeleteView *m_deleteView; + Ewk_Context* m_ewkContext; }; } |