From 5540c3a0610eb3e75e2444fb26806b9f466e7897 Mon Sep 17 00:00:00 2001 From: Balazs Kelemen Date: Fri, 25 Jul 2014 20:18:13 -0400 Subject: [PATCH] ewk_bringup Stub out all the API's that have engine change dependency so that we can bring up a minimal working browser without the engine changes. Adding ewk_bringup=1 to GYP_DEFINES (or ~/.gyp/include.gypi) switches the api's from stub to non-stub. Note that some of the api's were already stubbed out in our baseline m37 rebase because of rebase issues (look for the #warnings). This still builds and works with the m37 rebased src/. Next step is to make it build with (close to) vanilla s-chromium and s-blink. --- tizen_src/impl/chromium-efl.gyp | 6 ++++ tizen_src/impl/eweb_context.cc | 8 +++++ tizen_src/impl/eweb_view.cc | 49 +++++++++++++++++++++++++++++ tizen_src/impl/memory_purger.cc | 2 ++ tizen_src/impl/web_contents_delegate_efl.cc | 4 +++ 5 files changed, 69 insertions(+) diff --git a/tizen_src/impl/chromium-efl.gyp b/tizen_src/impl/chromium-efl.gyp index 174f129..621dafb 100644 --- a/tizen_src/impl/chromium-efl.gyp +++ b/tizen_src/impl/chromium-efl.gyp @@ -5,6 +5,7 @@ 'edje_dir%': '/usr/share/chromium-efl/themes/', 'webdb_dir%': '/usr/share/chromium-efl/db/', 'edje_compiler%': 'edje_cc', + 'ewk_bringup%': 0, }, 'targets': [{ @@ -342,6 +343,11 @@ '<(PRODUCT_DIR)/resources/<(RULE_INPUT_ROOT).edj', ], }], #rules + 'conditions': [ + ['ewk_bringup==1', { + 'defines': [ 'EWK_BRINGUP=1' ], + }], + ], }, { 'target_name': 'efl_webprocess', diff --git a/tizen_src/impl/eweb_context.cc b/tizen_src/impl/eweb_context.cc index 4ab8929..c4e6554 100644 --- a/tizen_src/impl/eweb_context.cc +++ b/tizen_src/impl/eweb_context.cc @@ -196,18 +196,22 @@ void EwkDidStartDownloadCallback::TriggerCallback(const string& url) { } void EWebContext::SendWidgetInfo(int widget_id, double scale, const string &theme, const string &encoded_bundle) { +#if !defined(EWK_BRINGUP) content::RenderProcessHost::iterator i(content::RenderProcessHost::AllHostsIterator()); for (; !i.IsAtEnd(); i.Advance()) { i.GetCurrentValue()->Send( new EwkViewMsg_SetWidgetInfo(widget_id, scale, theme, encoded_bundle)); } +#endif } void EWebContext::SendWrtMessage(const tizen_webview::WrtIpcMessageData& data) { +#if !defined(EWK_BRINGUP) content::RenderProcessHost::iterator i(content::RenderProcessHost::AllHostsIterator()); for (; !i.IsAtEnd(); i.Advance()) { i.GetCurrentValue()->Send(new EwkViewMsg_SendWrtMessage(data)); } +#endif } void EWebContext::SetMimeOverrideCallback( @@ -253,11 +257,15 @@ void EWebContext::ClearNetworkCache() { } void EWebContext::ClearWebkitCache() { +#if !defined(EWK_BRINGUP) web_cache_manager_->ClearCache(); +#endif } void EWebContext::SetCacheModel(Cache_Model model) { +#if !defined(EWK_BRINGUP) web_cache_manager_->SetCacheModel(model); +#endif } Cache_Model EWebContext::GetCacheModel() const { diff --git a/tizen_src/impl/eweb_view.cc b/tizen_src/impl/eweb_view.cc index 534d0e8..247b903 100755 --- a/tizen_src/impl/eweb_view.cc +++ b/tizen_src/impl/eweb_view.cc @@ -1484,8 +1484,10 @@ void EWebView::Find(const char* text, tizen_webview::Find_Options find_options) } void EWebView::SetScale(double scale_factor, int x, int y) { +#if !defined(EWK_BRINGUP) RenderViewHost* render_view_host = web_contents_delegate_->web_contents()->GetRenderViewHost(); render_view_host->Send(new EwkViewMsg_Scale(render_view_host->GetRoutingID(), scale_factor, x, y)); +#endif } void EWebView::GetScrollPosition(int* x, int* y) const { @@ -1497,17 +1499,24 @@ void EWebView::GetScrollPosition(int* x, int* y) const { } void EWebView::SetScroll(int x, int y) { + // This adds extra api's to blink and extra craft to chromium. Chrome doesn't have it yet you can scroll. Let's rethink it. + // Probably scroll offset does can do the same. +#if !defined(EWK_BRINGUP) RenderViewHost* render_view_host = web_contents_delegate()->web_contents()->GetRenderViewHost(); if (!render_view_host) return; render_view_host->Send(new EwkViewMsg_SetScroll(render_view_host->GetRoutingID(), x, y)); +#endif } void EWebView::UseSettingsFont() { + // Intrusive API forcing blink to do a layout. Maybe we should just do a reload? +#if !defined(EWK_BRINGUP) RenderViewHost* render_view_host = web_contents_delegate()->web_contents()->GetRenderViewHost(); if (render_view_host) render_view_host->Send(new EwkViewMsg_UseSettingsFont(render_view_host->GetRoutingID())); +#endif } void EWebView::DidChangeContentsArea(int width, int height) { @@ -1554,11 +1563,13 @@ void EWebView::MoveCaret(const gfx::Point& point) { } void EWebView::QuerySelectionStyle() { +#if !defined(EWK_BRINGUP) Ewk_Settings* settings = GetSettings(); if (settings->textStyleStateState()) { RenderViewHost* render_view_host = web_contents_delegate_->web_contents()->GetRenderViewHost(); render_view_host->Send(new EwkViewMsg_GetSelectionStyle(render_view_host->GetRoutingID())); } +#endif } void EWebView::OnQuerySelectionStyleReply(const SelectionStylePrams& params) { @@ -1569,15 +1580,19 @@ void EWebView::OnQuerySelectionStyleReply(const SelectionStylePrams& params) { } void EWebView::SelectClosestWord(const gfx::Point& touch_point) { +#if !defined(EWK_BRINGUP) float device_scale_factor = rwhv()->device_scale_factor(); RenderViewHost* render_view_host = web_contents_delegate_->web_contents()->GetRenderViewHost(); render_view_host->Send(new EwkViewMsg_SelectClosestWord(render_view_host->GetRoutingID(), touch_point.x() / device_scale_factor, touch_point.y() / device_scale_factor)); +#endif } void EWebView::SelectLinkText(const gfx::Point& touch_point) { +#if !defined(EWK_BRINGUP) float device_scale_factor = rwhv()->device_scale_factor(); RenderViewHost* render_view_host = web_contents_delegate_->web_contents()->GetRenderViewHost(); render_view_host->Send(new ViewMsg_SelectLinkText(render_view_host->GetRoutingID(), gfx::Point(touch_point.x() / device_scale_factor, touch_point.y() / device_scale_factor))); +#endif } bool EWebView::GetSelectionRange(Eina_Rectangle* left_rect, Eina_Rectangle* right_rect) { @@ -1619,6 +1634,9 @@ tizen_webview::Hit_Test* EWebView::RequestHitTestDataAt(int x, int y, tizen_webv } tizen_webview::Hit_Test* EWebView::RequestHitTestDataAtBlinkCoords(int x, int y, tizen_webview::Hit_Test_Mode mode) { +#if defined(EWK_BRINGUP) + return new tizen_webview::Hit_Test; +#else DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // WebViewBrowserMessageFilter requires RenderProcessHost to be already created. @@ -1643,6 +1661,7 @@ tizen_webview::Hit_Test* EWebView::RequestHitTestDataAtBlinkCoords(int x, int y, } return NULL; +#endif } void EWebView::UpdateHitTestData(const _Ewk_Hit_Test& hit_test_data, const NodeAttributesMap& node_attributes) { @@ -1746,6 +1765,9 @@ void EWebView::InvokeBackForwardListChangedCallback() { } bool EWebView::WebAppCapableGet(tizen_webview::Web_App_Capable_Get_Callback callback, void *userData) { +#if defined(EWK_BRINGUP) + return false; +#else RenderViewHost *renderViewHost = web_contents_delegate()->web_contents()->GetRenderViewHost(); if (!renderViewHost) { return false; @@ -1753,9 +1775,13 @@ bool EWebView::WebAppCapableGet(tizen_webview::Web_App_Capable_Get_Callback call WebApplicationCapableGetCallback *cb = new WebApplicationCapableGetCallback(callback, userData); int callbackId = web_app_capable_get_callback_map_.Add(cb); return renderViewHost->Send(new EwkViewMsg_WebAppCapableGet(renderViewHost->GetRoutingID(), callbackId)); +#endif } bool EWebView::WebAppIconUrlGet(tizen_webview::Web_App_Icon_URL_Get_Callback callback, void *userData) { +#if defined(EWK_BRINGUP) + return false; +#else RenderViewHost* renderViewHost = web_contents_delegate()->web_contents()->GetRenderViewHost(); if (!renderViewHost) { return false; @@ -1763,9 +1789,13 @@ bool EWebView::WebAppIconUrlGet(tizen_webview::Web_App_Icon_URL_Get_Callback cal WebApplicationIconUrlGetCallback *cb = new WebApplicationIconUrlGetCallback(callback, userData); int callbackId = web_app_icon_url_get_callback_map_.Add(cb); return renderViewHost->Send(new EwkViewMsg_WebAppIconUrlGet(renderViewHost->GetRoutingID(), callbackId)); +#endif } bool EWebView::WebAppIconUrlsGet(tizen_webview::Web_App_Icon_URLs_Get_Callback callback, void *userData) { +#if defined(EWK_BRINGUP) + return false; +#else RenderViewHost* renderViewHost = web_contents_delegate()->web_contents()->GetRenderViewHost(); if (!renderViewHost) { return false; @@ -1773,13 +1803,16 @@ bool EWebView::WebAppIconUrlsGet(tizen_webview::Web_App_Icon_URLs_Get_Callback c WebApplicationIconUrlsGetCallback *cb = new WebApplicationIconUrlsGetCallback(callback, userData); int callbackId = web_app_icon_urls_get_callback_map_.Add(cb); return renderViewHost->Send(new EwkViewMsg_WebAppIconUrlsGet(renderViewHost->GetRoutingID(), callbackId)); +#endif } void EWebView::InvokeWebAppCapableGetCallback(bool capable, int callbackId) { +#if !defined(EWK_BRINGUP) WebApplicationCapableGetCallback *callback = web_app_capable_get_callback_map_.Lookup(callbackId); if (!callback) return; callback->Run(capable); +#endif } void EWebView::InvokeWebAppIconUrlGetCallback(const std::string& iconUrl, int callbackId) { @@ -1843,11 +1876,15 @@ int EWebView::SetEwkViewPlainTextGetCallback(tizen_webview::View_Plain_Text_Get_ } bool EWebView::PlainTextGet(tizen_webview::View_Plain_Text_Get_Callback callback, void* user_data) { +#if defined(EWK_BRINGUP) + return false; +#else RenderViewHost* render_view_host = web_contents_delegate()->web_contents()->GetRenderViewHost(); if (!render_view_host) return false; int plain_text_get_callback_id = SetEwkViewPlainTextGetCallback(callback, user_data); return render_view_host->Send(new EwkViewMsg_PlainTextGet(render_view_host->GetRoutingID(), plain_text_get_callback_id)); +#endif } void EWebView::InvokePlainTextGetCallback(const std::string& content_text, int plain_text_get_callback_id) { @@ -1874,15 +1911,22 @@ const char* EWebView::GetTitle() { } bool EWebView::SaveAsPdf(int width, int height, const std::string& filename) { +#if defined(EWK_BRINGUP) + return false; +#else RenderViewHost* render_view_host = web_contents_delegate()->web_contents()->GetRenderViewHost(); if (!render_view_host) return false; return render_view_host->Send(new EwkViewMsg_PrintToPdf(render_view_host->GetRoutingID(), width, height, base::FilePath(filename))); +#endif } bool EWebView::GetMHTMLData(tizen_webview::View_MHTML_Data_Get_Callback callback, void* user_data) { +#if defined(EWK_BRINGUP) + return false; +#else RenderViewHost* render_view_host = web_contents_delegate()->web_contents()->GetRenderViewHost(); if (!render_view_host) return false; @@ -1890,6 +1934,7 @@ bool EWebView::GetMHTMLData(tizen_webview::View_MHTML_Data_Get_Callback callback MHTMLCallbackDetails* callback_details = new MHTMLCallbackDetails(callback, user_data); int mhtml_callback_id = mhtml_callback_map_.Add(callback_details); return render_view_host->Send(new EwkViewMsg_GetMHTMLData(render_view_host->GetRoutingID(), mhtml_callback_id)); +#endif } void EWebView::OnMHTMLContentGet(const std::string& mhtml_content, int callback_id) { @@ -1974,11 +2019,13 @@ void EWebView::DidChangePageScaleRange(double min_scale, double max_scale) { } void EWebView::SetDrawsTransparentBackground(bool enabled) { +#if !defined(EWK_BRINGUP) RenderViewHost* render_view_host = web_contents_delegate()->web_contents()->GetRenderViewHost(); if (!render_view_host) return; render_view_host->Send(new EwkViewMsg_SetDrawsTransparentBackground(render_view_host->GetRoutingID(), enabled)); +#endif } void EWebView::GetSessionData(const char **data, unsigned *length) const { @@ -2043,9 +2090,11 @@ bool EWebView::RestoreFromSessionData(const char *data, unsigned length) { } void EWebView::SetBrowserFont() { +#if !defined(EWK_BRINGUP) RenderViewHost* render_view_host = web_contents_delegate()->web_contents()->GetRenderViewHost(); if (render_view_host) render_view_host->Send(new EwkViewMsg_SetBrowserFont(render_view_host->GetRoutingID())); +#endif } #ifdef OS_TIZEN diff --git a/tizen_src/impl/memory_purger.cc b/tizen_src/impl/memory_purger.cc index fc9bbe1..3977836 100644 --- a/tizen_src/impl/memory_purger.cc +++ b/tizen_src/impl/memory_purger.cc @@ -114,6 +114,8 @@ void MemoryPurger::PurgeRenderers() { // static void MemoryPurger::PurgeRendererForHost(content::RenderProcessHost* host) { +#if !defined(EWK_BRINGUP) // Direct the renderer to free everything it can. host->Send(new EwkViewMsg_PurgeMemory()); +#endif } diff --git a/tizen_src/impl/web_contents_delegate_efl.cc b/tizen_src/impl/web_contents_delegate_efl.cc index 7d3dd43..3456cc0 100755 --- a/tizen_src/impl/web_contents_delegate_efl.cc +++ b/tizen_src/impl/web_contents_delegate_efl.cc @@ -381,6 +381,9 @@ void WebContentsDelegateEfl::RequestCertificateConfirm(WebContents* /*web_conten } void WebContentsDelegateEfl::SetContentSecurityPolicy(const std::string& policy, tizen_webview::ContentSecurityPolicyType header_type) { + // Might makes sense as it only uses existing functionality already exposed for javascript. Needs extra api at blink side. + // Not necessary for eflwebview bringup. +#if !defined(EWK_BRINGUP) if (document_created_) { RenderViewHost* rvh = web_contents_->GetRenderViewHost(); rvh->Send(new EwkViewMsg_SetCSP(rvh->GetRoutingID(), policy, header_type)); @@ -388,6 +391,7 @@ void WebContentsDelegateEfl::SetContentSecurityPolicy(const std::string& policy, DCHECK(!pending_content_security_policy_.get()); pending_content_security_policy_.reset(new ContentSecurityPolicy(policy, header_type)); } +#endif } void WebContentsDelegateEfl::ShowPopupMenu(const gfx::Rect& rect, WebCore::TextDirection textDirection, double pageScaleFactor, const std::vector& items, int data, int selectedIndex, bool multiple) { -- 2.7.4