2 Copyright (C) 2011 Samsung Electronics
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
21 #include "ewk_network.h"
23 #include "NetworkStateNotifier.h"
24 #include "ewk_logging.h"
26 #include <wtf/text/CString.h>
29 #include "ResourceHandle.h"
30 #include <libsoup/soup.h>
33 void ewk_network_proxy_uri_set(const char *proxy)
36 SoupSession *session = WebCore::ResourceHandle::defaultSession();
39 ERR("no proxy uri. remove proxy feature in soup.");
40 soup_session_remove_feature_by_type(session, SOUP_TYPE_PROXY_RESOLVER);
44 SoupURI *uri = soup_uri_new(proxy);
45 EINA_SAFETY_ON_NULL_RETURN(uri);
47 g_object_set(session, SOUP_SESSION_PROXY_URI, uri, NULL);
50 EINA_SAFETY_ON_TRUE_RETURN(1);
54 const char *ewk_network_proxy_uri_get(void)
58 SoupSession *session = WebCore::ResourceHandle::defaultSession();
59 g_object_get(session, SOUP_SESSION_PROXY_URI, &uri, NULL);
66 WTF::String proxy = soup_uri_to_string(uri, EINA_FALSE);
67 return eina_stringshare_add(proxy.utf8().data());
69 EINA_SAFETY_ON_TRUE_RETURN_VAL(1, 0);
73 void ewk_network_state_notifier_online_set(Eina_Bool online)
75 WebCore::networkStateNotifier().setOnLine(online);