+++ /dev/null
-/*
- Copyright (C) 2013 Samsung Electronics
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef ewk_security_origin_h
-#define ewk_security_origin_h
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct _Ewk_Security_Origin Ewk_Security_Origin;
-
-
-#ifdef __cplusplus
-}
-#endif
-#endif // ewk_security_origin_h
#define ewk_view_h
#include <Evas.h>
-#include "ewk_security_origin.h"
//#include "ewk_intercept_request.h"
+namespace tizen_webview {
+class Security_Origin;
+}
+typedef class tizen_webview::Security_Origin Ewk_Security_Origin;
+
#ifdef __cplusplus
extern "C" {
#endif
--- /dev/null
+#include "ewk_geolocation_private.h"
+#include "tizen_webview/public/tw_security_origin.h"
+
+
+_Ewk_Geolocation_Permission_Request::_Ewk_Geolocation_Permission_Request(
+ Evas_Object* ewkView, const char* host, const char* protocol, uint16_t port,
+ base::Callback<void(bool)> inCallback)
+ : ewkView(ewkView)
+ , origin(new tizen_webview::Security_Origin(host, protocol, port))
+ , isDecided(false)
+ , isSuspended(false)
+ , callback(inCallback) {
+}
+
+_Ewk_Geolocation_Permission_Request::~_Ewk_Geolocation_Permission_Request() {
+ delete origin;
+}
#include <Evas.h>
#include <base/callback.h>
-
-#include "API/ewk_security_origin_private.h"
+#include "tizen_webview/public/tw_security_origin.h"
// This holds the geolocation permission request data.
// The callback present is the direct engine callback which need
// to be called once the permission is determined by app.
struct _Ewk_Geolocation_Permission_Request {
Evas_Object* ewkView;
- _Ewk_Security_Origin* origin;
+ tizen_webview::Security_Origin* origin;
bool isDecided;
bool isSuspended;
base::Callback<void(bool)> callback;
- _Ewk_Geolocation_Permission_Request(Evas_Object* ewkView, const char* host, const char* protocol, uint16_t port, base::Callback<void(bool)> inCallback)
- : ewkView(ewkView)
- , origin(new _Ewk_Security_Origin (host, protocol, port))
- , isDecided(false)
- , isSuspended(false)
- , callback(inCallback) {
- }
-
- ~_Ewk_Geolocation_Permission_Request() {
- delete origin;
- }
+ _Ewk_Geolocation_Permission_Request(Evas_Object* ewkView, const char* host, const char* protocol, uint16_t port, base::Callback<void(bool)> inCallback);
+ ~_Ewk_Geolocation_Permission_Request();
};
#endif // ewk_geolocation_private_h
--- /dev/null
+#include "ewk_notification_private.h"
+#include "tizen_webview/public/tw_security_origin.h"
+
+_Ewk_Notification::_Ewk_Notification(
+ const content::ShowDesktopNotificationHostMsgParams& params)
+ : body(eina_stringshare_add((base::UTF16ToUTF8(params.body)).c_str()))
+ , iconURL(eina_stringshare_add((params.icon_url).spec().c_str()))
+ , replaceID(eina_stringshare_add((base::UTF16ToUTF8(params.replace_id)).c_str()))
+ , title(eina_stringshare_add((base::UTF16ToUTF8(params.title)).c_str()))
+#if 0
+ , notificationID(params.notification_id)
+#else
+#warning "[M37] params.notification_id does not exist"
+ , notificationID(0)
+#endif
+ , securityOrigin(new tizen_webview::Security_Origin(
+ params.origin.host().c_str(), params.origin.scheme().c_str(),
+ atoi(params.origin.port().c_str()))) {
+}
+
+_Ewk_Notification::~_Ewk_Notification() {
+ eina_stringshare_del(body);
+ eina_stringshare_del(iconURL);
+ eina_stringshare_del(replaceID);
+ eina_stringshare_del(title);
+ delete securityOrigin;
+}
+
+_Ewk_Notification_Permission_Request::_Ewk_Notification_Permission_Request(
+ Evas_Object* ewkView, int callback, const GURL& source_origin)
+ : ewkView(ewkView)
+ , origin(new tizen_webview::Security_Origin(source_origin.host().c_str(),
+ source_origin.scheme().c_str(), atoi(source_origin.port().c_str())))
+ , isDecided(false)
+ , isSuspended(false)
+ , callback_context(callback) {
+}
+
+_Ewk_Notification_Permission_Request::~_Ewk_Notification_Permission_Request() {
+ delete origin;
+}
#include "eweb_view.h"
#include "eweb_context.h"
-#include "API/ewk_security_origin_private.h"
+
+
+namespace tizen_webview {
+ class Security_Origin;
+}
struct _Ewk_Notification {
Eina_Stringshare* body;
Eina_Stringshare* replaceID;
Eina_Stringshare* title;
uint64_t notificationID;
- _Ewk_Security_Origin* securityOrigin;
+ tizen_webview::Security_Origin* securityOrigin;
- explicit _Ewk_Notification(const content::ShowDesktopNotificationHostMsgParams& params)
- : body(eina_stringshare_add((base::UTF16ToUTF8(params.body)).c_str())),
- iconURL(eina_stringshare_add((params.icon_url).spec().c_str())),
- replaceID(eina_stringshare_add((base::UTF16ToUTF8(params.replace_id)).c_str())),
- title(eina_stringshare_add((base::UTF16ToUTF8(params.title)).c_str())),
-#if 0
- notificationID(params.notification_id),
-##else
-#warning "[M37] params no longer has notification_id in it. Is it actually needed?"
- notificationID(0),
-#endif
- securityOrigin(new _Ewk_Security_Origin(params.origin.host().c_str(), params.origin.scheme().c_str(), atoi(params.origin.port().c_str()))) {
- }
+ explicit _Ewk_Notification(const content::ShowDesktopNotificationHostMsgParams& params);
- ~_Ewk_Notification() {
- eina_stringshare_del(body);
- eina_stringshare_del(iconURL);
- eina_stringshare_del(replaceID);
- eina_stringshare_del(title);
- delete securityOrigin;
- }
+ ~_Ewk_Notification();
};
struct _Ewk_Notification_Permission_Request {
Evas_Object* ewkView;
- _Ewk_Security_Origin* origin;
+ tizen_webview::Security_Origin* origin;
bool isDecided;
bool isSuspended;
int callback_context; // required by content API
- _Ewk_Notification_Permission_Request(Evas_Object* ewkView, int callback, const GURL& source_origin)
- : ewkView(ewkView),
- origin(new _Ewk_Security_Origin(source_origin.host().c_str(), source_origin.scheme().c_str(), atoi(source_origin.port().c_str()))),
- isDecided(false),
- isSuspended(false),
- callback_context(callback) {
- }
+ _Ewk_Notification_Permission_Request(Evas_Object* ewkView, int callback, const GURL& source_origin);
- ~_Ewk_Notification_Permission_Request() {
- delete origin;
- }
+ ~_Ewk_Notification_Permission_Request();
};
#endif // ewk_notification_private_h
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/public/browser/web_contents.h"
-#include "API/ewk_security_origin_private.h"
#include "API/ewk_notification_private.h"
#include "eweb_view.h"
+#include "tizen_webview/public/tw_security_origin.h"
+#include "tizen_webview/tw_misc_utility.h"
+
+using tizen_webview::Security_Origin;
+using tizen_webview::GetGURL;
+using tizen_webview::GetURL;
+
namespace content {
NotificationControllerEfl::NotificationControllerEfl()
Eina_List* origin_iterator = NULL;
void* origin_data = NULL;
EINA_LIST_FOREACH(origins, origin_iterator, origin_data) {
- _Ewk_Security_Origin* origin = static_cast<_Ewk_Security_Origin*>(origin_data);
+ Security_Origin* origin = static_cast<Security_Origin*>(origin_data);
Eina_List* permission_list_iterator = NULL;
Eina_List* permission_list_iterator_next = NULL;
void* permission_data = NULL;
EINA_LIST_FOREACH_SAFE(ewk_notification_permissions_, permission_list_iterator, permission_list_iterator_next, permission_data) {
Ewk_Notification_Permission* notification_permission = static_cast<Ewk_Notification_Permission*>(permission_data);
- if (!strcmp(notification_permission->origin, origin->host)) {
+ if (!strcmp(notification_permission->origin, origin->GetHost())) {
delete notification_permission;
ewk_notification_permissions_ = eina_list_remove_list(ewk_notification_permissions_, permission_list_iterator);
}
'API/ewk_error_private.h',
'API/ewk_frame_private.h',
'API/ewk_frame_private.cc',
+ 'API/ewk_geolocation_private.cc',
'API/ewk_geolocation_private.h',
'API/ewk_hit_test_private.cc',
'API/ewk_hit_test_private.h',
'API/ewk_ipc_message_private.cc',
'API/ewk_ipc_message_private.h',
+ 'API/ewk_notification_private.cc',
'API/ewk_notification_private.h',
'API/ewk_policy_decision_private.cc',
'API/ewk_policy_decision_private.h',
# tizen_webview
'<(chrome_src_dir)/tizen_webview/public/tw_custom_handlers.h',
'<(chrome_src_dir)/tizen_webview/public/tw_custom_handlers.cc',
+ '<(chrome_src_dir)/tizen_webview/public/tw_security_origin.cc',
+ '<(chrome_src_dir)/tizen_webview/public/tw_security_origin.h',
'<(chrome_src_dir)/tizen_webview/public/tw_touch_point.h',
'<(chrome_src_dir)/tizen_webview/public/tw_touch_point.cc',
+ '<(chrome_src_dir)/tizen_webview/public/tw_url.cc',
+ '<(chrome_src_dir)/tizen_webview/public/tw_url.h',
+ '<(chrome_src_dir)/tizen_webview/tw_misc_utility.h',
+ '<(chrome_src_dir)/tizen_webview/tw_misc_utility.cc',
'url_request_context_getter_efl.cc',
'url_request_context_getter_efl.h',
'web_contents_delegate_efl.cc',
#include "browser/geolocation/location_provider_efl.h"
#endif
+#include "tizen_webview/public/tw_security_origin.h"
+
using web_contents_utils::WebContentsFromFrameID;
namespace content {
delegate->web_view()->evas_object(), callback_context, source_origin);
if (browser_context->GetNotificationController()->
- IsDefaultAllowed(notification_permission->origin->host)) {
+ IsDefaultAllowed(notification_permission->origin->GetHost())) {
browser_context->GetNotificationController()->
SetPermissionForNotification(notification_permission, true);
delete notification_permission;
#include "browser_context_efl.h"
#include "ewk_global_data.h"
#include "memory_purger.h"
-#include "API/ewk_security_origin_private.h"
#include "browser/renderer_host/browsing_data_remover_efl.h"
#include "browser/vibration/vibration_provider_client.h"
#include "common/render_messages_efl.h"
+#include "tizen_webview/public/tw_security_origin.h"
+#include "tizen_webview/tw_misc_utility.h"
+
using content::BrowserThread;
using content::BrowserContext;
using content::BrowserContextEfl;
using std::map;
using tizen_webview::Cache_Model;
+using tizen_webview::Security_Origin;
+using tizen_webview::GetGURL;
+using tizen_webview::GetURL;
namespace {
std::vector<content::LocalStorageUsageInfo>::const_iterator it;
for (it = local_storage.begin(); it != local_storage.end(); it++) {
- _Ewk_Security_Origin* origin = new _Ewk_Security_Origin(it->origin);
+ Security_Origin* origin = new Security_Origin(GetURL(it->origin));
lorigins = eina_list_append(lorigins, origin);
}
for (map<GURL, appcache::AppCacheInfoVector>::iterator iter = collection->infos_by_origin.begin();
iter != collection->infos_by_origin.end();
++iter) {
- _Ewk_Security_Origin* origin = new _Ewk_Security_Origin(iter->first);
+ Security_Origin* origin = new Security_Origin(GetURL(iter->first));
origins = eina_list_append(origins, origin);
}
callback(origins, user_data);
for (std::set<GURL>::iterator iter =
origins_ref.begin();
iter != origins_ref.end(); ++iter) {
- _Ewk_Security_Origin* sec_origin = new _Ewk_Security_Origin(*iter);
+ Security_Origin* sec_origin = new Security_Origin(GetURL(*iter));
origins = eina_list_append(origins, sec_origin);
}
BrowserThread::PostTask(BrowserThread::UI,
for (std::set<GURL>::iterator iter =
origins_ref.begin();
iter != origins_ref.end(); ++iter) {
- _Ewk_Security_Origin* sec_origin = new _Ewk_Security_Origin(*iter);
+ Security_Origin* sec_origin = new Security_Origin(GetURL(*iter));
origins = eina_list_append(origins, sec_origin);
}
BrowserThread::PostTask(BrowserThread::UI,
BrowserContext::ForEachStoragePartition(browser_context_.get(), base::Bind(&DeleteApplicationCache));
}
-void EWebContext::DeleteApplicationCacheForSite(const GURL& site) {
+void EWebContext::DeleteApplicationCacheForSite(const tizen_webview::URL& site) {
content::StoragePartition* partition = BrowserContext::GetStoragePartitionForSite(browser_context_.get(),
- site);
+ GetGURL(site));
partition->ClearDataForOrigin(content::StoragePartition::REMOVE_DATA_MASK_APPCACHE,
content::StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL,
- site,
+ GetGURL(site),
partition->GetURLRequestContext());
}
}
void EWebContext::GetApplicationCacheUsage(
- const GURL& url,
+ const tizen_webview::URL& url,
tizen_webview::Web_Application_Cache_Usage_For_Origin_Get_Callback callback,
void* user_data) {
content::StoragePartition* partition =
FROM_HERE,
base::Bind("a::QuotaManager::GetUsageAndQuota,
partition->GetQuotaManager(),
- url,
+ GetGURL(url),
quota::kStorageTypeTemporary,
base::Bind(&OnTemporaryUsageAndQuotaObtained, callback, user_data)));
}
remover->RemoveImpl(BrowsingDataRemoverEfl::REMOVE_LOCAL_STORAGE, GURL());
}
-void EWebContext::WebStorageDelete(const GURL& origin) {
+void EWebContext::WebStorageDelete(const tizen_webview::URL& origin) {
content::StoragePartition* partition =
BrowserContext::GetStoragePartition(browser_context_.get(), NULL);
- partition->GetDOMStorageContext()->DeleteLocalStorage(origin);
+ partition->GetDOMStorageContext()->DeleteLocalStorage(GetGURL(origin));
}
void EWebContext::WebStorageOriginsAllGet(tizen_webview::Web_Storage_Origins_Get_Callback callback,
remover->RemoveImpl(BrowsingDataRemoverEfl::REMOVE_INDEXEDDB, GURL());
}
-void EWebContext::WebDBDelete(const GURL& host) {
+void EWebContext::WebDBDelete(const tizen_webview::URL& host) {
BrowsingDataRemoverEfl* remover = BrowsingDataRemoverEfl::CreateForUnboundedRange(browser_context_.get());
- remover->RemoveImpl(BrowsingDataRemoverEfl::REMOVE_WEBSQL, host);
+ remover->RemoveImpl(BrowsingDataRemoverEfl::REMOVE_WEBSQL, GetGURL(host));
}
void EWebContext::GetAllOriginsWithWebDB(tizen_webview::Web_Database_Origins_Get_Callback callback, void* user_data) {
callback, user_data, partition));
}
-void EWebContext::FileSystemDelete(const GURL& host) {
+void EWebContext::FileSystemDelete(const tizen_webview::URL& host) {
BrowsingDataRemoverEfl* remover = BrowsingDataRemoverEfl::CreateForUnboundedRange(browser_context_.get());
- remover->RemoveImpl(BrowsingDataRemoverEfl::REMOVE_FILE_SYSTEMS, host);
+ remover->RemoveImpl(BrowsingDataRemoverEfl::REMOVE_FILE_SYSTEMS, GetGURL(host));
}
void EWebContext::GetAllOriginsWithFileSystem(tizen_webview::Local_File_System_Origins_Get_Callback callback, void* user_data) const {
return favicon;
}
+
#include "tizen_webview/public/tw_cache_model.h"
#include "tizen_webview/public/tw_callbacks.h"
+namespace tizen_webview {
+class URL;
+}
+
typedef std::map<std::string, std::string> HTTPCustomHeadersEflMap;
class CookieManager;
void* user_data);
EwkDidStartDownloadCallback* DidStartDownloadCallback();
void DeleteAllApplicationCache();
- void DeleteApplicationCacheForSite(const GURL&);
+ void DeleteApplicationCacheForSite(const tizen_webview::URL&);
void GetAllOriginsWithApplicationCache(tizen_webview::Web_Application_Cache_Origins_Get_Callback callback,
void* user_data);
void GetApplicationCacheUsage(
- const GURL& url,
+ const tizen_webview::URL& url,
tizen_webview::Web_Application_Cache_Usage_For_Origin_Get_Callback callback,
void* user_data);
void GetAllOriginsWithWebDB(tizen_webview::Web_Database_Origins_Get_Callback callback, void* user_data);
- void WebDBDelete(const GURL& host);
+ void WebDBDelete(const tizen_webview::URL& host);
void IndexedDBDelete();
void WebStorageDelete();
- void WebStorageDelete(const GURL& origin);
+ void WebStorageDelete(const tizen_webview::URL& origin);
void WebStorageOriginsAllGet(tizen_webview::Web_Storage_Origins_Get_Callback callback, void* user_data);
- void FileSystemDelete(const GURL& host);
+ void FileSystemDelete(const tizen_webview::URL& host);
void GetAllOriginsWithFileSystem(tizen_webview::Local_File_System_Origins_Get_Callback callback, void* user_data) const;
bool SetFaviconDatabasePath(const char* path);
Evas_Object *AddFaviconObject(const char* uri, Evas* canvas) const;
--- /dev/null
+// Copyright (c) 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "tw_security_origin.h"
+#include "tizen_webview/public/tw_url.h"
+
+namespace tizen_webview {
+
+Security_Origin::Security_Origin(const tizen_webview::URL& url)
+ : host(eina_stringshare_add(url.getHost()))
+ , protocol(eina_stringshare_add(url.getProtocol()))
+ , port(url.getPort()) {
+}
+
+Security_Origin::Security_Origin(const char* host_in, const char* protocol_in, int port_in)
+ : host(eina_stringshare_add(host_in))
+ , protocol(eina_stringshare_add(protocol_in))
+ , port(port_in) {
+}
+
+Security_Origin::~Security_Origin() {
+ eina_stringshare_del(host);
+ eina_stringshare_del(protocol);
+}
+
+tizen_webview::URL Security_Origin::GetURL() const {
+ return tizen_webview::URL(protocol, host, port);
+}
+
+Eina_Stringshare* Security_Origin::GetHost() const {
+ return host;
+}
+
+Eina_Stringshare* Security_Origin::GetProtocol() const {
+ return protocol;
+}
+
+int Security_Origin::GetPort() const {
+ return port;
+}
+
+} // namespace tizen_webview
--- /dev/null
+// Copyright (c) 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef TIZEN_WEBVIEW_PUBLIC_TW_SECURITY_ORIGIN_H_
+#define TIZEN_WEBVIEW_PUBLIC_TW_SECURITY_ORIGIN_H_
+
+#include <Eina.h>
+
+namespace tizen_webview {
+
+class URL;
+
+class Security_Origin {
+ public:
+ Security_Origin(const tizen_webview::URL& url);
+ Security_Origin(const char* host_in, const char* protocol_in, int port_in);
+ ~Security_Origin();
+
+ tizen_webview::URL GetURL() const;
+ Eina_Stringshare* GetHost() const;
+ Eina_Stringshare* GetProtocol() const;
+ int GetPort() const;
+
+ private:
+ Eina_Stringshare* host;
+ Eina_Stringshare* protocol;
+ int port;
+
+ // Just for safety in using Eina_Stringshare, disallow copy constructor and
+ // assignment for now.
+ // TODO: Need to revisit and add proper implementation.
+ Security_Origin(const Security_Origin&);
+ Security_Origin& operator=(const Security_Origin&);
+};
+
+} // namespace tizen_webview
+
+#endif // TIZEN_WEBVIEW_PUBLIC_TW_SECURITY_ORIGIN_H_
--- /dev/null
+// Copyright (c) 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "tw_url.h"
+
+namespace tizen_webview {
+
+URL::URL()
+ : protocol()
+ , host()
+ , port(PORT_UNSPECIFIED) { // url_parse::PORT_INVALID
+}
+
+URL::URL(const std::string& host_)
+ : protocol()
+ , host(host_)
+ , port(PORT_UNSPECIFIED) { // url_parse::PORT_INVALID
+}
+
+URL::URL(const std::string& protocol_, const std::string& host_, int port_)
+ : protocol(protocol_)
+ , host(host_)
+ , port(port_) {
+}
+
+} // namespace tizen_webview
--- /dev/null
+// Copyright (c) 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef TIZEN_WEBVIEW_PUBLIC_TW_URL_H_
+#define TIZEN_WEBVIEW_PUBLIC_TW_URL_H_
+
+#include <string>
+
+namespace tizen_webview {
+
+class URL {
+ public:
+ enum {
+ PORT_UNSPECIFIED = -1,
+ PORT_INVALID = -2
+ };
+
+ URL();
+ explicit URL(const std::string& host_);
+ URL(const std::string& protocol_, const std::string& host_, int port_);
+
+ const char* getProtocol() const { return protocol.c_str(); }
+ const char* getHost() const { return host.c_str(); }
+ int getPort() const { return port; }
+
+ bool isPortInvalid() const { return port == PORT_INVALID; }
+ bool isPortUnspecified() const { return port == PORT_UNSPECIFIED; }
+
+ private:
+ std::string protocol;
+ std::string host;
+ int port;
+};
+
+} // namespace tizen_webview
+
+#endif // TIZEN_WEBVIEW_PUBLIC_TW_URL_H_
--- /dev/null
+// Copyright (c) 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "tw_misc_utility.h"
+
+#include <sstream>
+
+namespace tizen_webview {
+
+GURL GetGURL(const URL& url) {
+ std::ostringstream ss;
+ ss << url.getProtocol() << "://" << url.getHost();
+ if (!url.isPortUnspecified())
+ ss << ":" << url.getPort();
+ GURL result(ss.str());
+ assert(result.is_valid());
+ return result;
+}
+
+URL GetURL(const GURL& url) {
+ return URL(url.scheme(), url.host(), url.IntPort());
+}
+
+} // namespace tizen_webview
--- /dev/null
+// Copyright (c) 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef TIZEN_WEBVIEW_PUBLIC_TW_MISC_UTILITY_H_
+#define TIZEN_WEBVIEW_PUBLIC_TW_MISC_UTILITY_H_
+
+#include "url/gurl.h"
+#include "tizen_webview/public/tw_url.h"
+
+namespace tizen_webview {
+
+GURL GetGURL(const tizen_webview::URL& url);
+tizen_webview::URL GetURL(const GURL& url);
+
+} // namespace tizen_webview
+
+#endif // TIZEN_WEBVIEW_PUBLIC_TW_MISC_UTILITY_H_