#include "content/public/browser/render_view_host.h"
#include "content/public/browser/browser_thread.h"
#include "ui/gfx/geometry/rect.h"
-#include "tizen_webview/public/tw_web_context.h"
DEFINE_WEB_CONTENTS_USER_DATA_KEY(autofill::AutofillManagerDelegateEfl);
#include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
#include "components/user_prefs/user_prefs.h"
#include "content/public/common/content_client.h"
-#include "tizen_webview/public/tw_web_context.h"
// GetContentClient() is defined in content_client.cc, but in content_client.h
// it is hidden by CONTENT_IMPLEMENTATION ifdef. We don't want to define
#include "content/public/browser/browser_thread.h"
#include "eweb_context.h"
#include "ewk_global_data.h"
-#include "tizen_webview/public/tw_web_context.h"
-
-using tizen_webview::WebContext;
+#include "private/ewk_context_private.h"
namespace content {
void AccessTokenStoreEfl::GetRequestContextOnUIThread()
{
- WebContext* default_context = WebContext::DefaultContext();
+ Ewk_Context* default_context = Ewk_Context::DefaultContext();
net::URLRequestContextGetter* context_getter = default_context->browser_context()->GetRequestContext();
system_request_context_ = EwkGlobalData::GetInstance()->GetSystemRequestContextGetter();
}
using net::CookieMonster;
using base::AutoLock;
-using namespace tizen_webview;
-
namespace {
void TriggerHostPolicyGetCallbackAsyncOnUIThread(Ewk_Cookie_Accept_Policy policy,
'public/ewk_touch.h',
'public/text_encoding_map_efl.cc',
'public/text_encoding_map_efl.h',
+
'tizen_webview/public/tw_webview_delegate.cc',
'tizen_webview/public/tw_webview_delegate.h',
- 'tizen_webview/public/tw_hit_test.h',
- 'tizen_webview/public/tw_web_context.h',
'tizen_webview/public/tw_webview_evas_event_handler.h',
'tizen_webview/public/tw_webview_evas_event_handler.cc',
'tizen_webview/public/tw_webview.h',
'tizen_webview/public/tw_webview.cc',
- 'tizen_webview/public/tw_web_context.cc',
'renderer/content_renderer_client_efl.cc',
'renderer/content_renderer_client_efl.h',
#include "public/ewk_context.h"
#include "devtools_delegate_efl.h"
-namespace tizen_webview {
-class WebContext;
-}
-
class CookieManager;
class Ewk_Wrt_Message_Data;
#if defined(OS_TIZEN_TV)
private:
EWebContext(bool incognito);
~EWebContext();
- friend class tizen_webview::WebContext;
+ friend class Ewk_Context;
static EWebContext* default_context_;
scoped_ptr<WebCacheManagerEfl> web_cache_manager_;
#include "components/sessions/serialized_navigation_entry.h"
#include "components/sessions/content/content_serialized_navigation_builder.h"
#include "private/ewk_back_forward_list_private.h"
+#include "private/ewk_context_private.h"
#include "private/ewk_frame_private.h"
#include "private/ewk_policy_decision_private.h"
#include "private/ewk_settings_private.h"
#include "ui/gfx/screen.h"
#include "devtools_delegate_efl.h"
-#include "tizen_webview/public/tw_web_context.h"
#include "tizen_webview/public/tw_webview.h"
#include "tizen_webview/public/tw_webview_delegate.h"
#include "tizen_webview/public/tw_webview_evas_event_handler.h"
return static_cast<RenderWidgetHostViewEfl*>(web_contents_->GetRenderWidgetHostView());
}
-EWebView::EWebView(tizen_webview::WebView* owner, tizen_webview::WebContext* context, Evas_Object* object)
+EWebView::EWebView(tizen_webview::WebView* owner, Ewk_Context* context, Evas_Object* object)
: public_webview_(owner),
context_(context),
evas_object_(object),
old_context_ = NULL;
} else {
old_context_ = context_;
- context_ = tizen_webview::WebContext::Create(incognito);
+ context_ = Ewk_Context::Create(incognito);
}
InitializeContent();
}
namespace tizen_webview {
-class WebContext;
class WebView;
class WebViewEvasEventHandler;
}
class ErrorParams;
class _Ewk_Policy_Decision;
class _Ewk_Hit_Test;
+class Ewk_Context;
class WebAppScreenshotCapturedCallback : public base::RefCounted<WebAppScreenshotCapturedCallback> {
public:
static Evas_Object* GetHostWindowDelegate(const content::WebContents*);
tizen_webview::WebView* GetPublicWebView();
- tizen_webview::WebContext* context() const { return context_.get(); }
+ Ewk_Context* context() const { return context_.get(); }
Evas_Object* evas_object() const { return evas_object_; }
Evas* GetEvas() const { return evas_object_evas_get(evas_object_); }
tizen_webview::WebView* public_webview_;
scoped_refptr<tizen_webview::WebViewEvasEventHandler> evas_event_handler_;
- scoped_refptr<tizen_webview::WebContext> context_;
- scoped_refptr<tizen_webview::WebContext> old_context_;
+ scoped_refptr<Ewk_Context> context_;
+ scoped_refptr<Ewk_Context> old_context_;
scoped_ptr<content::WebContents> web_contents_;
scoped_ptr<content::WebContentsDelegateEfl> web_contents_delegate_;
std::string pending_url_request_;
std::map<int64_t, WebViewAsyncRequestHitTestDataCallback*> hit_test_callback_;
// only tizen_webview::WebView can create and delete this
- EWebView(tizen_webview::WebView* owner, tizen_webview::WebContext*, Evas_Object* smart_object);
+ EWebView(tizen_webview::WebView* owner, Ewk_Context*, Evas_Object* smart_object);
~EWebView();
friend class tizen_webview::WebView;
};
#include "content/browser/renderer_host/render_process_host_impl.h"
#include "efl/window_factory.h"
#include "eweb_view.h"
-#include "tizen_webview/public/tw_web_context.h"
#include "ui/base/resource/resource_bundle.h"
#include "command_line_efl.h"
#include "components/autofill/core/browser/personal_data_manager.h"
#include "eweb_view.h"
#include "ewk_autofill_profile_private.h"
-#include "tizen_webview/public/tw_web_context.h"
namespace autofill {
class PersonalDataManagerFactory;
Eina_List*
EwkContextFormAutofillProfileManager::priv_form_autofill_profile_get_all(
- tizen_webview::WebContext* context) {
+ Ewk_Context* context) {
EINA_SAFETY_ON_NULL_RETURN_VAL(context, nullptr);
autofill::PersonalDataManagerFactory* dataManagerFactory =
autofill::PersonalDataManagerFactory::GetInstance();
Ewk_Autofill_Profile*
EwkContextFormAutofillProfileManager::priv_form_autofill_profile_get(
- tizen_webview::WebContext* context, unsigned id) {
+ Ewk_Context* context, unsigned id) {
EINA_SAFETY_ON_NULL_RETURN_VAL(context, nullptr);
autofill::PersonalDataManagerFactory* dataManagerFactory =
autofill::PersonalDataManagerFactory::GetInstance();
}
Eina_Bool EwkContextFormAutofillProfileManager::priv_form_autofill_profile_set(
- tizen_webview::WebContext* context,
+ Ewk_Context* context,
unsigned id, Ewk_Autofill_Profile* profile) {
autofill::PersonalDataManagerFactory* personalDataManagerFactory =
autofill::PersonalDataManagerFactory::GetInstance();
}
Eina_Bool EwkContextFormAutofillProfileManager::priv_form_autofill_profile_add(
- tizen_webview::WebContext* context, Ewk_Autofill_Profile* profile) {
+ Ewk_Context* context, Ewk_Autofill_Profile* profile) {
autofill::PersonalDataManagerFactory* personalDataManagerFactory =
autofill::PersonalDataManagerFactory::GetInstance();
personalDataManagerFactory->AddProfile(
Eina_Bool
EwkContextFormAutofillProfileManager::priv_form_autofill_profile_remove(
- tizen_webview::WebContext* context, unsigned id) {
+ Ewk_Context* context, unsigned id) {
autofill::PersonalDataManagerFactory* personalDataManagerFactory =
autofill::PersonalDataManagerFactory::GetInstance();
personalDataManagerFactory->RemoveByGUID(context->browser_context(),
#include <Evas.h>
-namespace tizen_webview {
-class WebContext;
-}
+class Ewk_Context;
typedef struct _Ewk_Autofill_Profile Ewk_Autofill_Profile;
typedef void (*Ewk_Context_Form_Autofill_Profile_Changed_Callback)(void *data);
* @return @c Eina_List of Ewk_Autofill_Profile @c NULL otherwise
* @see ewk_autofill_profile_delete
*/
- static Eina_List* priv_form_autofill_profile_get_all(tizen_webview::WebContext* context);
+ static Eina_List* priv_form_autofill_profile_get_all(Ewk_Context* context);
/**
* Gets the existing profile for given index
* @return @c Ewk_Autofill_Profile if profile exists, @c NULL otherwise
* @see ewk_autofill_profile_delete
*/
- static Ewk_Autofill_Profile* priv_form_autofill_profile_get(tizen_webview::WebContext* context,
+ static Ewk_Autofill_Profile* priv_form_autofill_profile_get(Ewk_Context* context,
unsigned id);
/**
* @see ewk_autofill_profile_new
* @see ewk_context_form_autofill_profile_add
*/
- static Eina_Bool priv_form_autofill_profile_set(tizen_webview::WebContext* context,
+ static Eina_Bool priv_form_autofill_profile_set(Ewk_Context* context,
unsigned id, Ewk_Autofill_Profile* profile);
/**
* @return @c EINA_TRUE if the profile data is saved successfully, @c EINA_FALSE otherwise
* @see ewk_autofill_profile_new
*/
- static Eina_Bool priv_form_autofill_profile_add(tizen_webview::WebContext* context,
+ static Eina_Bool priv_form_autofill_profile_add(Ewk_Context* context,
Ewk_Autofill_Profile* profile);
/**
* @return @c EINA_TRUE if the profile data is removed successfully, @c EINA_FALSE otherwise
* @see ewk_context_form_autofill_profile_get_all
*/
- static EAPI Eina_Bool priv_form_autofill_profile_remove(tizen_webview::WebContext* context,
+ static EAPI Eina_Bool priv_form_autofill_profile_remove(Ewk_Context* context,
unsigned id);
/**
#include "ewk_context_private.h"
-// Use compiler generated constructor and destructor
-// No significant implementation is required.
+#include "browser_context_efl.h"
+#include "eweb_context.h"
+
+using content::BrowserContextEfl;
+
+namespace {
+BrowserContextEfl::ResourceContextEfl* GetResourceContextEfl(
+ EWebContext* ctx) {
+ BrowserContextEfl::ResourceContextEfl* retval = NULL;
+
+ if (ctx) {
+ BrowserContextEfl* browser_context = ctx->browser_context();
+
+ if (browser_context)
+ retval = browser_context->GetResourceContextEfl();
+ }
+ return retval;
+}
+}
+
+static Ewk_Context* default_context_ = NULL;
+
+// static
+Ewk_Context* Ewk_Context::DefaultContext() {
+ if (!default_context_) {
+ // default context is not incognito
+ default_context_ = Ewk_Context::Create(false);
+ }
+
+ return default_context_;
+}
+
+// static
+void Ewk_Context::DefaultContextRelease() {
+ if (default_context_) {
+ // this method should be called from ewk_shutdown and ewk_shutdown should
+ // be called only when all webviews are closed. This won't check if all
+ // webviews are destroyed but we will be sure that all webviews using
+ // default web context are destroyed.
+ CHECK(default_context_->HasOneRef());
+ default_context_->Release();
+ CHECK(default_context_ == NULL);
+ }
+}
+
+// static
+Ewk_Context* Ewk_Context::Create(bool incognito) {
+ Ewk_Context* context = new Ewk_Context(incognito);
+ context->AddRef();
+ return context;
+}
+
+// static
+void Ewk_Context::Delete(Ewk_Context* context) {
+ if (context) {
+ if (context == default_context_ && context->HasOneRef()) {
+ // With chromium engine there is only single context
+ // which is default context hence this delete
+ // function will not be implemented
+ NOTIMPLEMENTED();
+ return;
+ }
+ context->Release();
+ }
+}
+
+Ewk_Context::Ewk_Context(bool incognito) : impl(new EWebContext(incognito)) {
+}
+
+Ewk_Context::~Ewk_Context() {
+ if (this == default_context_)
+ default_context_= NULL;
+ delete impl;
+}
+
+content::BrowserContextEfl* Ewk_Context::browser_context() const {
+ return impl->browser_context();
+}
+
+Ewk_Cookie_Manager* Ewk_Context::ewkCookieManager() const {
+ return impl->ewkCookieManager();
+}
+
+scoped_refptr<CookieManager> Ewk_Context::cookieManager() const {
+ return impl->cookieManager();
+}
+
+void Ewk_Context::SetDidStartDownloadCallback(Ewk_Context_Did_Start_Download_Callback callback, void* user_data) {
+ impl->SetDidStartDownloadCallback(callback, user_data);
+}
+
+void Ewk_Context::SetCertificate(const char* certificate_file) {
+ impl->SetCertificate(certificate_file);
+}
+
+void Ewk_Context::SetProxyUri(const char* uri) {
+ impl->SetProxyUri(uri);
+}
+
+const char* Ewk_Context::GetProxyUri() const {
+ return impl->GetProxyUri();
+}
+
+void Ewk_Context::AddExtraPluginDir(const char *path) {
+ impl->AddExtraPluginDir(path);
+}
+
+void Ewk_Context::NotifyLowMemory() {
+ impl->NotifyLowMemory();
+}
+
+bool Ewk_Context::HTTPCustomHeaderAdd(const char* name, const char* value) {
+ BrowserContextEfl::ResourceContextEfl* rc = GetResourceContextEfl(impl);
+
+ if (rc)
+ return rc->HTTPCustomHeaderAdd(name, value);
+
+ return false;
+}
+
+bool Ewk_Context::HTTPCustomHeaderRemove(const char* name) {
+ BrowserContextEfl::ResourceContextEfl* rc = GetResourceContextEfl(impl);
+
+ if (rc)
+ return rc->HTTPCustomHeaderRemove(name);
+
+ return false;
+}
+
+void Ewk_Context::HTTPCustomHeaderClear() {
+ BrowserContextEfl::ResourceContextEfl* rc = GetResourceContextEfl(impl);
+
+ if (rc)
+ rc->HTTPCustomHeaderClear();
+}
+
+void Ewk_Context::SetCacheModel(Ewk_Cache_Model cm) {
+ impl->SetCacheModel(cm);
+}
+
+Ewk_Cache_Model Ewk_Context::GetCacheModel() const {
+ return impl->GetCacheModel();
+}
+
+void Ewk_Context::SetNetworkCacheEnable(bool enable) {
+ impl->SetNetworkCacheEnable(enable);
+}
+
+bool Ewk_Context::GetNetworkCacheEnable() const {
+ return impl->GetNetworkCacheEnable();
+}
+
+void Ewk_Context::ClearNetworkCache() {
+ impl->ClearNetworkCache();
+}
+
+void Ewk_Context::ClearWebkitCache() {
+ impl->ClearWebkitCache();
+}
+
+void Ewk_Context::GetAllOriginsWithApplicationCache(Ewk_Web_Application_Cache_Origins_Get_Callback callback, void* user_data) {
+ impl->GetAllOriginsWithApplicationCache(callback, user_data);
+}
+
+void Ewk_Context::GetApplicationCacheUsage(const GURL& url, Ewk_Web_Application_Cache_Usage_For_Origin_Get_Callback callback, void* user_data) {
+ impl->GetApplicationCacheUsage(url, callback, user_data);
+}
+
+void Ewk_Context::DeleteAllApplicationCache() {
+ impl->DeleteAllApplicationCache();
+}
+
+void Ewk_Context::DeleteApplicationCacheForSite(const GURL& url) {
+ impl->DeleteApplicationCacheForSite(url);
+}
+
+void Ewk_Context::GetAllOriginsWithWebDB(Ewk_Web_Database_Origins_Get_Callback callback, void* user_data) {
+ impl->GetAllOriginsWithWebDB(callback, user_data);
+}
+
+void Ewk_Context::WebDBDelete(const GURL& host) {
+ impl->WebDBDelete(host);
+}
+
+void Ewk_Context::IndexedDBDelete() {
+ impl->IndexedDBDelete();
+}
+
+void Ewk_Context::WebStorageOriginsAllGet(Ewk_Web_Storage_Origins_Get_Callback callback, void* user_data) {
+ impl->WebStorageOriginsAllGet(callback, user_data);
+}
+
+void Ewk_Context::WebStorageDelete() {
+ impl->WebStorageDelete();
+}
+
+void Ewk_Context::WebStorageDelete(const GURL& origin) {
+ impl->WebStorageDeleteForOrigin(origin);
+}
+
+void Ewk_Context::GetAllOriginsWithFileSystem(Ewk_Local_File_System_Origins_Get_Callback callback, void* user_data) const {
+ impl->GetAllOriginsWithFileSystem(callback, user_data);
+}
+
+void Ewk_Context::FileSystemDelete(const GURL& host) {
+ impl->FileSystemDelete(host);
+}
+
+bool Ewk_Context::SetFaviconDatabasePath(const char *path) {
+ return impl->SetFaviconDatabasePath(path);
+}
+
+#if defined(OS_TIZEN_TV)
+FaviconDatabase* Ewk_Context::GetFaviconDatabase() {
+ return impl->GetFaviconDatabase();
+}
+#endif
+
+Evas_Object * Ewk_Context::AddFaviconObject(const char *uri, Evas *canvas) const {
+ return impl->AddFaviconObject(uri, canvas);
+}
+
+void Ewk_Context::SendWidgetInfo(int widget_id, double scale, const std::string &theme, const std::string &encoded_bundle) {
+ impl->SendWidgetInfo(widget_id, scale, theme, encoded_bundle);
+}
+
+int Ewk_Context::Pixmap() const {
+ return impl->Pixmap();
+}
+
+void Ewk_Context::SetPixmap(int pixmap) {
+ impl->SetPixmap( pixmap);
+}
+
+void Ewk_Context::SetMimeOverrideCallback(Ewk_Context_Override_Mime_For_Url_Callback callback,
+ void* user_data) const {
+ impl->SetMimeOverrideCallback(callback, user_data);
+}
+
+void Ewk_Context::ClearCandidateData() {
+ impl->ClearCandidateData();
+}
+
+void Ewk_Context::ClearPasswordData() {
+ impl->ClearPasswordData();
+}
+
+unsigned int Ewk_Context::InspectorServerStart(unsigned int port) const {
+ return impl->InspectorServerStart(port);
+}
+
+bool Ewk_Context::InspectorServerStop() const {
+ return impl->InspectorServerStop();
+}
#ifndef ewk_context_private_h
#define ewk_context_private_h
-#include <tizen_webview/public/tw_web_context.h>
+#include <string>
+#include <Evas.h>
-struct Ewk_Context : public tizen_webview::WebContext {
+#include "base/memory/ref_counted.h"
+#include "ewk_enums.h"
+#include "public/ewk_context.h"
+
+class CookieManager;
+class Ewk_Cookie_Manager;
+class EWebContext;
+#if defined(OS_TIZEN_TV)
+class FaviconDatabase;
+#endif
+class GURL;
+
+namespace content {
+class BrowserContextEfl;
+};
+
+struct Ewk_Context : public base::RefCounted<Ewk_Context> {
+ public:
+ static Ewk_Context* DefaultContext();
+ static void DefaultContextRelease();
+ static Ewk_Context* Create(bool incognito = false);
+ static void Delete(Ewk_Context*);
+
+ // Get related class
+ content::BrowserContextEfl* browser_context() const;
+ Ewk_Cookie_Manager* ewkCookieManager() const;
+ scoped_refptr<CookieManager> cookieManager() const;
+
+ // Set Callbacks
+ void SetDidStartDownloadCallback(Ewk_Context_Did_Start_Download_Callback callback,
+ void* user_data);
+ //EwkDidStartDownloadCallback* DidStartDownloadCallback();
+
+ // Certificate
+ void SetCertificate(const char* certificate_file);
+
+ // Proxy URI
+ void SetProxyUri(const char* uri);
+ const char* GetProxyUri() const;
+
+ // System
+ void AddExtraPluginDir(const char *path);
+ void NotifyLowMemory();
+
+ // HTTP Custom Header
+ bool HTTPCustomHeaderAdd(const char* name, const char* value);
+ bool HTTPCustomHeaderRemove(const char* name);
+ void HTTPCustomHeaderClear();
+
+ // Cache Model
+ void SetCacheModel(Ewk_Cache_Model cm);
+ Ewk_Cache_Model GetCacheModel() const;
+
+ // Network Cache
+ void SetNetworkCacheEnable(bool enable);
+ bool GetNetworkCacheEnable() const;
+ void ClearNetworkCache();
+ void ClearWebkitCache();
+
+ // Application Cache
+ void GetAllOriginsWithApplicationCache(
+ Ewk_Web_Application_Cache_Origins_Get_Callback callback, void* user_data);
+ void GetApplicationCacheUsage(const GURL& url,
+ Ewk_Web_Application_Cache_Usage_For_Origin_Get_Callback callback,
+ void* user_data);
+ void DeleteAllApplicationCache();
+ void DeleteApplicationCacheForSite(const GURL& url);
+
+ // Web Database
+ void GetAllOriginsWithWebDB(Ewk_Web_Database_Origins_Get_Callback callback,
+ void* user_data);
+ void WebDBDelete(const GURL& host);
+
+ // Indexed DB
+ void IndexedDBDelete();
+
+ // Web Storage
+ void WebStorageOriginsAllGet(Ewk_Web_Storage_Origins_Get_Callback callback,
+ void* user_data);
+ void WebStorageDelete();
+ void WebStorageDelete(const GURL& origin);
+ void ClearCandidateData();
+
+ // File System
+ void GetAllOriginsWithFileSystem(
+ Ewk_Local_File_System_Origins_Get_Callback callback, void* user_data) const;
+ void FileSystemDelete(const GURL& host);
+
+ // Favicon
+ bool SetFaviconDatabasePath(const char *path);
+ Evas_Object *AddFaviconObject(const char *uri, Evas *canvas) const;
+
+ // Widget
+ void SendWidgetInfo(int widget_id, double scale, const std::string &theme,
+ const std::string &encoded_bundle);
+ //void SendWrtMessage(const Ewk_IPC_Wrt_Message_Data& message);
+
+ // Pixmap
+ int Pixmap() const;
+ void SetPixmap(int pixmap);
+
+ // Password
+ void ClearPasswordData();
+
+ // Set MIME override callback
+ void SetMimeOverrideCallback(Ewk_Context_Override_Mime_For_Url_Callback callback,
+ void* user_data) const;
+
+ // Note: Do not use outside chromium
+ EWebContext* GetImpl() { return impl; }
+#if defined(OS_TIZEN_TV)
+ FaviconDatabase* GetFaviconDatabase();
+#endif
+
+ unsigned int InspectorServerStart(unsigned int port) const;
+ bool InspectorServerStop() const;
+
+ private:
+ EWebContext* impl;
+
+ Ewk_Context(bool incognito);
+ ~Ewk_Context();
+ friend class base::RefCounted<Ewk_Context>;
+
+ DISALLOW_COPY_AND_ASSIGN(Ewk_Context);
};
+
#endif // ewk_context_private_h
#include <Evas.h>
#include "browser/favicon/favicon_database.h"
-#include <tizen_webview/public/tw_web_context.h>
#include "private/ewk_context_private.h"
struct EwkFaviconDatabase {
#include "ewk_wrt_private.h"
#include "common/render_messages_ewk.h"
-#include "tizen_webview/public/tw_web_context.h"
const char* Ewk_Wrt_Message_Data::GetType() const {
return type.c_str();
#include "ewk_context.h"
-#include <tizen_webview/public/tw_web_context.h>
-
#include "base/memory/ref_counted.h"
#include "browser/vibration/vibration_provider_client.h"
#include "browser_context_efl.h"
#include "private/ewk_cookie_manager_private.h"
#include "private/ewk_context_form_autofill_profile_private.h"
-using tizen_webview::WebContext;
-
Ewk_Context *ewk_context_ref(Ewk_Context *context)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(context, NULL);
Ewk_Context* ewk_context_default_get()
{
- return static_cast<Ewk_Context*>(WebContext::DefaultContext());
+ return Ewk_Context::DefaultContext();
}
Ewk_Context* ewk_context_new()
{
- return static_cast<Ewk_Context*>(WebContext::Create());
+ return Ewk_Context::Create();
}
Ewk_Context *ewk_context_new_with_injected_bundle_path(const char *path)
#include "public/ewk_log.h"
#include "public/ewk_view.h"
#include "private/webview_delegate_ewk.h"
+#include "private/ewk_context_private.h"
#include "private/ewk_private.h"
#include "private/ewk_main_private.h"
-#include "tizen_webview/public/tw_web_context.h"
#if defined(HAVE_ECORE_X)
#include <Ecore_X.h>
{
//TODO: any web engine destroy to be done here
CommandLineEfl::Shutdown();
- tizen_webview::WebContext::DefaultContextRelease();
+ Ewk_Context::DefaultContextRelease();
EwkGlobalData::Delete();
}
#include "web_contents_delegate_efl.h"
using tizen_webview::WebView;
-using tizen_webview::WebContext;
Eina_Bool ewk_view_smart_class_set(Ewk_View_Smart_Class* api)
{
Evas_Object* ewk_view_add_in_incognito_mode(Evas* e)
{
- Ewk_Context* context = static_cast<Ewk_Context*>(WebContext::Create(true));
+ Ewk_Context* context = Ewk_Context::Create(true);
EINA_SAFETY_ON_NULL_RETURN_VAL(context, NULL);
return ewk_view_add_with_context(e, context);
}
+++ /dev/null
-// Copyright (c) 2014 The Chromium Authors. All rights reserved.
-// Copyright 2014-2015 Samsung Electronics. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "browser_context_efl.h"
-#include "eweb_context.h"
-#include "tw_web_context.h"
-
-using content::BrowserContextEfl;
-
-namespace tizen_webview {
-
-namespace {
-BrowserContextEfl::ResourceContextEfl* GetResourceContextEfl(
- EWebContext* ctx) {
- BrowserContextEfl::ResourceContextEfl* retval = NULL;
-
- if (ctx) {
- BrowserContextEfl* browser_context = ctx->browser_context();
-
- if (browser_context)
- retval = browser_context->GetResourceContextEfl();
- }
- return retval;
-}
-}
-
-static WebContext* default_context_ = NULL;
-
-// static
-WebContext* WebContext::DefaultContext() {
- if (!default_context_) {
- // default context is not incognito
- default_context_ = WebContext::Create(false);
- }
-
- return default_context_;
-}
-
-// static
-void WebContext::DefaultContextRelease() {
- if (default_context_) {
- // this method should be called from ewk_shutdown and ewk_shutdown should
- // be called only when all webviews are closed. This won't check if all
- // webviews are destroyed but we will be sure that all webviews using
- // default web context are destroyed.
- CHECK(default_context_->HasOneRef());
- default_context_->Release();
- CHECK(default_context_ == NULL);
- }
-}
-
-// static
-WebContext* WebContext::Create(bool incognito) {
- WebContext* context = new WebContext(incognito);
- context->AddRef();
- return context;
-}
-
-// static
-void WebContext::Delete(WebContext* context) {
- if (context) {
- if (context == default_context_ && context->HasOneRef()) {
- // With chromium engine there is only single context
- // which is default context hence this delete
- // function will not be implemented
- NOTIMPLEMENTED();
- return;
- }
- context->Release();
- }
-}
-
-WebContext::WebContext(bool incognito) : impl(new EWebContext(incognito)) {
-}
-
-WebContext::~WebContext() {
- if (this == default_context_)
- default_context_= NULL;
- delete impl;
-}
-
-content::BrowserContextEfl* WebContext::browser_context() const {
- return impl->browser_context();
-}
-
-Ewk_Cookie_Manager* WebContext::ewkCookieManager() const {
- return impl->ewkCookieManager();
-}
-
-scoped_refptr<CookieManager> WebContext::cookieManager() const {
- return impl->cookieManager();
-}
-
-void WebContext::SetDidStartDownloadCallback(Ewk_Context_Did_Start_Download_Callback callback, void* user_data) {
- impl->SetDidStartDownloadCallback(callback, user_data);
-}
-
-void WebContext::SetCertificate(const char* certificate_file) {
- impl->SetCertificate(certificate_file);
-}
-
-void WebContext::SetProxyUri(const char* uri) {
- impl->SetProxyUri(uri);
-}
-
-const char* WebContext::GetProxyUri() const {
- return impl->GetProxyUri();
-}
-
-void WebContext::AddExtraPluginDir(const char *path) {
- impl->AddExtraPluginDir(path);
-}
-
-void WebContext::NotifyLowMemory() {
- impl->NotifyLowMemory();
-}
-
-bool WebContext::HTTPCustomHeaderAdd(const char* name, const char* value) {
- BrowserContextEfl::ResourceContextEfl* rc = GetResourceContextEfl(impl);
-
- if (rc)
- return rc->HTTPCustomHeaderAdd(name, value);
-
- return false;
-}
-
-bool WebContext::HTTPCustomHeaderRemove(const char* name) {
- BrowserContextEfl::ResourceContextEfl* rc = GetResourceContextEfl(impl);
-
- if (rc)
- return rc->HTTPCustomHeaderRemove(name);
-
- return false;
-}
-
-void WebContext::HTTPCustomHeaderClear() {
- BrowserContextEfl::ResourceContextEfl* rc = GetResourceContextEfl(impl);
-
- if (rc)
- rc->HTTPCustomHeaderClear();
-}
-
-void WebContext::SetCacheModel(Ewk_Cache_Model cm) {
- impl->SetCacheModel(cm);
-}
-
-Ewk_Cache_Model WebContext::GetCacheModel() const {
- return impl->GetCacheModel();
-}
-
-void WebContext::SetNetworkCacheEnable(bool enable) {
- impl->SetNetworkCacheEnable(enable);
-}
-
-bool WebContext::GetNetworkCacheEnable() const {
- return impl->GetNetworkCacheEnable();
-}
-
-void WebContext::ClearNetworkCache() {
- impl->ClearNetworkCache();
-}
-
-void WebContext::ClearWebkitCache() {
- impl->ClearWebkitCache();
-}
-
-void WebContext::GetAllOriginsWithApplicationCache(Ewk_Web_Application_Cache_Origins_Get_Callback callback, void* user_data) {
- impl->GetAllOriginsWithApplicationCache(callback, user_data);
-}
-
-void WebContext::GetApplicationCacheUsage(const GURL& url, Ewk_Web_Application_Cache_Usage_For_Origin_Get_Callback callback, void* user_data) {
- impl->GetApplicationCacheUsage(url, callback, user_data);
-}
-
-void WebContext::DeleteAllApplicationCache() {
- impl->DeleteAllApplicationCache();
-}
-
-void WebContext::DeleteApplicationCacheForSite(const GURL& url) {
- impl->DeleteApplicationCacheForSite(url);
-}
-
-void WebContext::GetAllOriginsWithWebDB(Ewk_Web_Database_Origins_Get_Callback callback, void* user_data) {
- impl->GetAllOriginsWithWebDB(callback, user_data);
-}
-
-void WebContext::WebDBDelete(const GURL& host) {
- impl->WebDBDelete(host);
-}
-
-void WebContext::IndexedDBDelete() {
- impl->IndexedDBDelete();
-}
-
-void WebContext::WebStorageOriginsAllGet(Ewk_Web_Storage_Origins_Get_Callback callback, void* user_data) {
- impl->WebStorageOriginsAllGet(callback, user_data);
-}
-
-void WebContext::WebStorageDelete() {
- impl->WebStorageDelete();
-}
-
-void WebContext::WebStorageDelete(const GURL& origin) {
- impl->WebStorageDeleteForOrigin(origin);
-}
-
-void WebContext::GetAllOriginsWithFileSystem(Ewk_Local_File_System_Origins_Get_Callback callback, void* user_data) const {
- impl->GetAllOriginsWithFileSystem(callback, user_data);
-}
-
-void WebContext::FileSystemDelete(const GURL& host) {
- impl->FileSystemDelete(host);
-}
-
-bool WebContext::SetFaviconDatabasePath(const char *path) {
- return impl->SetFaviconDatabasePath(path);
-}
-
-#if defined(OS_TIZEN_TV)
-FaviconDatabase* WebContext::GetFaviconDatabase() {
- return impl->GetFaviconDatabase();
-}
-#endif
-
-Evas_Object * WebContext::AddFaviconObject(const char *uri, Evas *canvas) const {
- return impl->AddFaviconObject(uri, canvas);
-}
-
-void WebContext::SendWidgetInfo(int widget_id, double scale, const std::string &theme, const std::string &encoded_bundle) {
- impl->SendWidgetInfo(widget_id, scale, theme, encoded_bundle);
-}
-
-int WebContext::Pixmap() const {
- return impl->Pixmap();
-}
-
-void WebContext::SetPixmap(int pixmap) {
- impl->SetPixmap( pixmap);
-}
-
-void WebContext::SetMimeOverrideCallback(Ewk_Context_Override_Mime_For_Url_Callback callback,
- void* user_data) const {
- impl->SetMimeOverrideCallback(callback, user_data);
-}
-
-void WebContext::ClearCandidateData() {
- impl->ClearCandidateData();
-}
-
-void WebContext::ClearPasswordData() {
- impl->ClearPasswordData();
-}
-
-unsigned int WebContext::InspectorServerStart(unsigned int port) const {
- return impl->InspectorServerStart(port);
-}
-
-bool WebContext::InspectorServerStop() const {
- return impl->InspectorServerStop();
-}
-
-} // namespace tizen_webview
+++ /dev/null
-// Copyright (c) 2014 The Chromium Authors. All rights reserved.
-// Copyright 2014-2015 Samsung Electronics. 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_WEB_CONTEXT_H_
-#define TIZEN_WEBVIEW_PUBLIC_TW_WEB_CONTEXT_H_
-
-#include <string>
-#include <Evas.h>
-
-#include "base/memory/ref_counted.h"
-#include "ewk_enums.h"
-#include "public/ewk_context.h"
-
-class CookieManager;
-class Ewk_Cookie_Manager;
-class EWebContext;
-#if defined(OS_TIZEN_TV)
-class FaviconDatabase;
-#endif
-class GURL;
-//struct Ewk_IPC_Wrt_Message_Data;
-
-namespace content {
-class BrowserContextEfl;
-}
-
-namespace tizen_webview {
-
-struct WebContext : public base::RefCounted<WebContext> {
- public:
- static WebContext* DefaultContext();
- static void DefaultContextRelease();
- static WebContext* Create(bool incognito = false);
- static void Delete(WebContext*);
-
- // Get related class
- content::BrowserContextEfl* browser_context() const;
- Ewk_Cookie_Manager* ewkCookieManager() const;
- scoped_refptr<CookieManager> cookieManager() const;
-
- // Set Callbacks
- void SetDidStartDownloadCallback(Ewk_Context_Did_Start_Download_Callback callback,
- void* user_data);
- //EwkDidStartDownloadCallback* DidStartDownloadCallback();
-
- // Certificate
- void SetCertificate(const char* certificate_file);
-
- // Proxy URI
- void SetProxyUri(const char* uri);
- const char* GetProxyUri() const;
-
- // System
- void AddExtraPluginDir(const char *path);
- void NotifyLowMemory();
-
- // HTTP Custom Header
- bool HTTPCustomHeaderAdd(const char* name, const char* value);
- bool HTTPCustomHeaderRemove(const char* name);
- void HTTPCustomHeaderClear();
-
- // Cache Model
- void SetCacheModel(Ewk_Cache_Model cm);
- Ewk_Cache_Model GetCacheModel() const;
-
- // Network Cache
- void SetNetworkCacheEnable(bool enable);
- bool GetNetworkCacheEnable() const;
- void ClearNetworkCache();
- void ClearWebkitCache();
-
- // Application Cache
- void GetAllOriginsWithApplicationCache(
- Ewk_Web_Application_Cache_Origins_Get_Callback callback, void* user_data);
- void GetApplicationCacheUsage(const GURL& url,
- Ewk_Web_Application_Cache_Usage_For_Origin_Get_Callback callback,
- void* user_data);
- void DeleteAllApplicationCache();
- void DeleteApplicationCacheForSite(const GURL& url);
-
- // Web Database
- void GetAllOriginsWithWebDB(Ewk_Web_Database_Origins_Get_Callback callback,
- void* user_data);
- void WebDBDelete(const GURL& host);
-
- // Indexed DB
- void IndexedDBDelete();
-
- // Web Storage
- void WebStorageOriginsAllGet(Ewk_Web_Storage_Origins_Get_Callback callback,
- void* user_data);
- void WebStorageDelete();
- void WebStorageDelete(const GURL& origin);
- void ClearCandidateData();
-
- // File System
- void GetAllOriginsWithFileSystem(
- Ewk_Local_File_System_Origins_Get_Callback callback, void* user_data) const;
- void FileSystemDelete(const GURL& host);
-
- // Favicon
- bool SetFaviconDatabasePath(const char *path);
- Evas_Object *AddFaviconObject(const char *uri, Evas *canvas) const;
-
- // Widget
- void SendWidgetInfo(int widget_id, double scale, const std::string &theme,
- const std::string &encoded_bundle);
- //void SendWrtMessage(const Ewk_IPC_Wrt_Message_Data& message);
-
- // Pixmap
- int Pixmap() const;
- void SetPixmap(int pixmap);
-
- // Password
- void ClearPasswordData();
-
- // Set MIME override callback
- void SetMimeOverrideCallback(Ewk_Context_Override_Mime_For_Url_Callback callback,
- void* user_data) const;
-
- // Note: Do not use outside chromium
- EWebContext* GetImpl() { return impl; }
-#if defined(OS_TIZEN_TV)
- FaviconDatabase* GetFaviconDatabase();
-#endif
-
- unsigned int InspectorServerStart(unsigned int port) const;
- bool InspectorServerStop() const;
-
- private:
- EWebContext* impl;
-
- WebContext(bool incognito);
- ~WebContext();
- friend class base::RefCounted<WebContext>;
-
- DISALLOW_COPY_AND_ASSIGN(WebContext);
-};
-} // namespace tizen_webview
-
-#endif // TIZEN_WEBVIEW_PUBLIC_TW_WEB_CONTEXT_H_
namespace tizen_webview {
-WebView* WebView::Create(WebContext* wc, Evas_Object* eo) {
+WebView* WebView::Create(Ewk_Context* wc, Evas_Object* eo) {
WebView* wv = new WebView();
DCHECK(wv);
return WebViewDelegate::GetInstance()->GetWebViewFromEvasObject(eo);
}
-WebContext* WebView::GetWebContext() {
+Ewk_Context* WebView::GetWebContext() {
return impl_->context();
}
struct SelectionStylePrams;
// TODO END
+class Ewk_Context;
class EWebView;
class _Ewk_Frame;
namespace tizen_webview {
-class WebContext;
class WebViewDelegate;
class WebViewEvasEventHandler;
class WebView {
public:
// ---- create/delete
- static WebView* Create(WebContext* wc, Evas_Object* eo) WARN_UNUSED_RESULT;
+ static WebView* Create(Ewk_Context* wc, Evas_Object* eo) WARN_UNUSED_RESULT;
static void Delete(WebView* wv);
// initialize data members and activate event handlers.
// ---- Get various objects related with this webview
Evas_Object* AsEvasObject();
static WebView* FromEvasObject(Evas_Object* eo);
- WebContext* GetWebContext();
+ Ewk_Context* GetWebContext();
bool SetPrivateBrowsing(bool incognito);
bool GetPrivateBrowsing() const;
Ewk_Settings* GetSettings();
#include "url/gurl.h"
#include "browser/favicon/favicon_service.h"
-#include "tizen_webview/public/tw_web_context.h"
-
#if defined(OS_TIZEN)
#include "content/public/browser/media_capture_devices.h"
#include "media/video/capture/tizen/video_capture_device_tizen.h"