Eina_Bool Browser_Common_View::_post_to_sns(std::string sns_name, std::string url)
{
	BROWSER_LOGD("sns_name=[%s],  url=[%s]", sns_name.c_str(), url.c_str());
	if (url.empty() || sns_name.empty()) {
		show_msg_popup(BR_STRING_EMPTY);
		return EINA_FALSE;
	}

	int index = 0;
	for (index = 0 ; index < m_sns_name_list.size() ; index++) {
		if (m_sns_name_list[index].find(sns_name) != string::npos)
			break;
	}

	if (m_sns_path_list[index].find("twitter") != string::npos
	    || m_sns_path_list[index].find("facebook") != string::npos) {

		int ret = 0;
		service_h service_handle = NULL;
		if (service_create(&service_handle) < 0) {
			BROWSER_LOGE("Fail to create service handle");
			return EINA_FALSE;
		}
		if (!service_handle) {
			BROWSER_LOGE("service handle is NULL");
			return EINA_FALSE;
		}
		if (service_set_operation(service_handle, SERVICE_OPERATION_SEND_TEXT) < 0) {
			BROWSER_LOGE("Fail to set service operation");
			service_destroy(service_handle);
			return EINA_FALSE;
		}
		if (service_add_extra_data(service_handle, SERVICE_DATA_TEXT, (char *)url.c_str()) < 0) {
			BROWSER_LOGE("Fail to set post data");
			service_destroy(service_handle);
			return EINA_FALSE;
		}
		if (service_set_package(service_handle, m_sns_path_list[index].c_str()) < 0) {
			BROWSER_LOGE("Fail to set SNS");
			service_destroy(service_handle);
			return EINA_FALSE;
		}
		if (service_send_launch_request(service_handle, NULL, NULL) < 0) {
			BROWSER_LOGE("Fail to launch service operation");
			service_destroy(service_handle);
			return EINA_FALSE;
		}
		service_destroy(service_handle);
	}

	return EINA_TRUE;
}
static void playMusic()
{
	service_h service;
	service_create(&service);
	service_set_operation(service, SERVICE_OPERATION_VIEW);
	service_set_package(service, SOUND_PLAYER_PKG_NAME);
	service_set_uri(service, "file:///opt/usr/media/Downloads/2.mp3");
	if (service_send_launch_request(service, NULL, NULL) == SERVICE_ERROR_NONE) {
		printf("Success\n");
	} else {
		printf("Fail\n");
	}
	service_destroy(service);
}
Eina_Bool Browser_Common_View::_send_via_email(std::string url, Eina_Bool attach_file)
{
	BROWSER_LOGD("[%s], url[%s]", __func__, url.c_str());
	if (url.empty()) {
		show_msg_popup(BR_STRING_EMPTY);
		return EINA_FALSE;
	}

	service_h service_handle = NULL;
	if (service_create(&service_handle) < 0) {
		BROWSER_LOGE("Fail to create service handle");
		return EINA_FALSE;
	}

	if (!service_handle) {
		BROWSER_LOGE("Fail to create service handle");
		return EINA_FALSE;
	}

	if (attach_file) {
		if (service_set_operation(service_handle, SERVICE_OPERATION_SEND) < 0) {
			BROWSER_LOGE("Fail to set service operation");
			service_destroy(service_handle);
		return EINA_FALSE;
	}

		if (service_set_uri(service_handle, url.c_str()) < 0) {
			BROWSER_LOGE("Fail to set uri");
			service_destroy(service_handle);
			return EINA_FALSE;
		}
	} else {
		if (service_set_operation(service_handle, SERVICE_OPERATION_SEND_TEXT) < 0) {
			BROWSER_LOGE("Fail to set service operation");
			service_destroy(service_handle);
			return EINA_FALSE;
		}

		if (strstr(url.c_str(), BROWSER_MAIL_TO_SCHEME)) {
			if (service_add_extra_data(service_handle, SERVICE_DATA_TO, url.c_str() + strlen(BROWSER_MAIL_TO_SCHEME)) < 0) {
				BROWSER_LOGE("Fail to set mailto data");
				service_destroy(service_handle);
				return EINA_FALSE;
			}
		} else {
			if (service_add_extra_data(service_handle, SERVICE_DATA_TEXT, url.c_str()) < 0) {
				BROWSER_LOGE("Fail to set extra data");
				service_destroy(service_handle);
				return EINA_FALSE;
			}
		}
	}

	if (service_set_package(service_handle, SEC_EMAIL) < 0) {
		BROWSER_LOGE("Fail to launch service operation");
		service_destroy(service_handle);
		return EINA_FALSE;
	}

	if (service_send_launch_request(service_handle, NULL, NULL) < 0) {
		BROWSER_LOGE("Fail to launch service operation");
		service_destroy(service_handle);
		return EINA_FALSE;
	}
	service_destroy(service_handle);

	return EINA_TRUE;
}
Eina_Bool Browser_Common_View::_send_via_message(std::string url, std::string to, Eina_Bool attach_file)
{
	BROWSER_LOGD("[%s], url[%s], to[%s]", __func__, url.c_str(), to.c_str());
	if (url.empty() && to.empty()) {
		show_msg_popup(BR_STRING_EMPTY);
		return EINA_FALSE;
	}

	service_h service_handle = NULL;
	if (service_create(&service_handle) < 0) {
		BROWSER_LOGE("Fail to create service handle");
		return EINA_FALSE;
	}

	if (!service_handle) {
		BROWSER_LOGE("Fail to create service handle");
		return EINA_FALSE;
	}

	if (!url.empty()) {
		if (attach_file) {
			if (service_set_operation(service_handle, SERVICE_OPERATION_SEND) < 0) {
				BROWSER_LOGE("Fail to set service operation");
				service_destroy(service_handle);
				return EINA_FALSE;
			}

			if (service_add_extra_data(service_handle, "ATTACHFILE", url.c_str())) {
				BROWSER_LOGE("Fail to set extra data");
				service_destroy(service_handle);
				return EINA_FALSE;
			}
		} else {
			if (service_set_operation(service_handle, SERVICE_OPERATION_SEND_TEXT) < 0) {
				BROWSER_LOGE("Fail to set service operation");
				service_destroy(service_handle);
				return EINA_FALSE;
			}

			if (service_add_extra_data(service_handle, SERVICE_DATA_TEXT, url.c_str()) < 0) {
				BROWSER_LOGE("Fail to set extra data");
				service_destroy(service_handle);
				return EINA_FALSE;
			}
		}
	}

	if (!to.empty()) {
		if (url.empty()) {
			if (service_set_operation(service_handle, SERVICE_OPERATION_SEND_TEXT) < 0) {
				BROWSER_LOGE("Fail to set service operation");
				service_destroy(service_handle);
				return EINA_FALSE;
			}
		}

		if (service_add_extra_data(service_handle, SERVICE_DATA_TO , to.c_str()) < 0) {
			BROWSER_LOGE("Fail to set extra data");
			service_destroy(service_handle);
			return EINA_FALSE;
		}
	}

	if (service_set_package(service_handle, SEC_MESSAGE) < 0) {//SEC_EMAIL
		BROWSER_LOGE("Fail to launch service operation");
		service_destroy(service_handle);
		return EINA_FALSE;
	}

	if (service_send_launch_request(service_handle, NULL, NULL) < 0) {
		BROWSER_LOGE("Fail to launch service operation");
		service_destroy(service_handle);
		return EINA_FALSE;
	}
	service_destroy(service_handle);

	return EINA_TRUE;
}