IPC_MESSAGE_HANDLER(ViewHostMsg_DidFirstVisuallyNonEmptyLayout, OnDidFirstVisuallyNonEmptyLayout)
IPC_MESSAGE_HANDLER(EwkHostMsg_PlainTextGetContents, OnPlainTextGetContents)
IPC_MESSAGE_HANDLER(EwkHostMsg_WebAppIconUrlGet, OnWebAppIconUrlGet)
+ IPC_MESSAGE_HANDLER(EwkHostMsg_WebAppCapableGet, OnWebAppCapableGet)
IPC_MESSAGE_HANDLER(EwkHostMsg_DidChangeContentsSize, OnDidChangeContentsSize)
IPC_MESSAGE_HANDLER(EwkHostMsg_OrientationChangeEvent, OnOrientationChangeEvent)
IPC_MESSAGE_HANDLER(EwkViewMsg_SelectionTextStyleState, OnSelectionTextStyleState)
eweb_view()->InvokePlainTextGetCallback(content_text, plain_text_get_callback_id);
}
+void RenderWidgetHostViewEfl::OnWebAppCapableGet(bool capable, int callback_id) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ eweb_view()->InvokeWebAppCapableGetCallback(capable, callback_id);
+}
+
void RenderWidgetHostViewEfl::OnWebAppIconUrlGet(const std::string &icon_url, int callback_id) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
eweb_view()->InvokeWebAppIconUrlGetCallback(icon_url, callback_id);
void HandleGesture(ui::GestureEvent*);
void HandleTouchEvent(ui::TouchEvent*);
void OnPlainTextGetContents(const std::string&, int);
+ void OnWebAppCapableGet(bool capable, int callback_id);
void OnWebAppIconUrlGet(const std::string &icon_url, int callback_id);
void SelectRange(const gfx::Point&, const gfx::Point&);
void MoveCaret(const gfx::Point&);
std::string, /* icon url */
int /* callback id */)
+IPC_MESSAGE_ROUTED1(EwkViewMsg_WebAppCapableGet,
+ int /* calback id */)
+
+IPC_MESSAGE_ROUTED2(EwkHostMsg_WebAppCapableGet,
+ bool, /* capable */
+ int /* calback id */)
SmartCallback<EWebViewCallbacks::BackForwardListChange>().call();
}
+bool EWebView::WebAppCapableGet(Ewk_Web_App_Capable_Get_Callback callback, void *userData) {
+ RenderViewHost *renderViewHost = web_contents_delegate()->web_contents()->GetRenderViewHost();
+ if (!renderViewHost) {
+ return false;
+ }
+ 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));
+}
+
bool EWebView::WebAppIconUrlGet(Ewk_Web_App_Icon_URL_Get_Callback callback, void* userData) {
RenderViewHost* renderViewHost = web_contents_delegate()->web_contents()->GetRenderViewHost();
if (!renderViewHost) {
return renderViewHost->Send(new EwkViewMsg_WebAppIconUrlGet(renderViewHost->GetRoutingID(), callbackId));
}
+void EWebView::InvokeWebAppCapableGetCallback(bool capable, int callbackId) {
+ WebApplicationCapableGetCallback *callback = web_app_capable_get_callback_map_.Lookup(callbackId);
+ if (!callback)
+ return;
+ callback->Run(capable);
+}
+
void EWebView::InvokeWebAppIconUrlGetCallback(const std::string& iconUrl, int callbackId) {
WebApplicationIconUrlGetCallback *callback = web_app_icon_url_get_callback_map_.Lookup(callbackId);
if (!callback)
void *user_data_;
};
+class WebApplicationCapableGetCallback {
+ public:
+ WebApplicationCapableGetCallback(Ewk_Web_App_Capable_Get_Callback func, void *user_data)
+ : func_(func), user_data_(user_data)
+ {}
+ void Run(bool capable) {
+ if (func_) {
+ (func_)(capable ? EINA_TRUE : EINA_FALSE, user_data_);
+ }
+ }
+
+ private:
+ Ewk_Web_App_Capable_Get_Callback func_;
+ void *user_data_;
+};
+
class JavaScriptDialogManagerEfl;
class EWebView
bool SaveAsPdf(int width, int height, const std::string& file_name);
void BackForwardListClear();
void InvokeBackForwardListChangedCallback();
+ bool WebAppCapableGet(Ewk_Web_App_Capable_Get_Callback callback, void *userData);
bool WebAppIconUrlGet(Ewk_Web_App_Icon_URL_Get_Callback callback, void *userData);
+ void InvokeWebAppCapableGetCallback(bool capable, int callbackId);
void InvokeWebAppIconUrlGetCallback(const std::string &iconUrl, int callbackId);
bool GetMHTMLData(Ewk_View_MHTML_Data_Get_Callback callback, void* user_data);
scoped_ptr<OrientationLockCallback> orientation_lock_callback_;
scoped_ptr<content::InputPicker> inputPicker_;
IDMap<WebApplicationIconUrlGetCallback, IDMapOwnPointer> web_app_icon_url_get_callback_map_;
+ IDMap<WebApplicationCapableGetCallback, IDMapOwnPointer> web_app_capable_get_callback_map_;
#ifdef TIZEN_EDGE_EFFECT
scoped_refptr<EdgeEffect> edge_effect_;
#endif
IPC_MESSAGE_HANDLER(EwkViewMsg_PrintToPdf, OnPrintToPdf)
IPC_MESSAGE_HANDLER(EwkViewMsg_GetMHTMLData, OnGetMHTMLData);
IPC_MESSAGE_HANDLER(EwkViewMsg_WebAppIconUrlGet, OnWebAppIconUrlGet);
+ IPC_MESSAGE_HANDLER(EwkViewMsg_WebAppCapableGet, OnWebAppCapableGet);
IPC_MESSAGE_HANDLER(EwkViewMsg_SetDrawsTransparentBackground, OnSetDrawsTransparentBackground);
IPC_MESSAGE_HANDLER(EwkViewMsg_SetBrowserFont, OnSetBrowserFont);
IPC_MESSAGE_UNHANDLED(handled = false)
Send(new EwkHostMsg_WebAppIconUrlGet(render_view()->GetRoutingID(), appleIconUrl.empty() ? iconUrl : appleIconUrl, callback_id));
}
+void RenderViewObserverEfl::OnWebAppCapableGet(int callback_id) {
+ blink::WebFrame *frame = render_view()->GetWebView()->mainFrame();
+ if (!frame)
+ return;
+
+ blink::WebDocument document = frame->document();
+ blink::WebElement head = document.head();
+ if (head.isNull())
+ return;
+
+ bool capable = false;
+ blink::WebNodeList nodes = head.childNodes();
+ for (int i = 0; i < nodes.length(); ++i) {
+ blink::WebNode node = nodes.item(i);
+ if (!node.isElementNode())
+ continue;
+
+ blink::WebElement elem = node.to<blink::WebElement>();
+ if (!elem.hasTagName("meta"))
+ continue;
+
+ std::string name = elem.getAttribute("name").utf8();
+ if (LowerCaseEqualsASCII(name, "apple-mobile-web-app-capable") || // Apple's way
+ LowerCaseEqualsASCII(name, "mobile-web-app-capable")) { // Google's way
+ std::string content = elem.getAttribute("content").utf8();
+ if (LowerCaseEqualsASCII(content, "yes")) {
+ capable = true;
+ }
+ break;
+ }
+ }
+ Send(new EwkHostMsg_WebAppCapableGet(render_view()->GetRoutingID(), capable, callback_id));
+}
+
void RenderViewObserverEfl::OrientationChangeEvent(int orientation)
{
Send(new EwkHostMsg_OrientationChangeEvent(render_view()->GetRoutingID(), orientation));
void OnGetMHTMLData(int callback_id);
void OnSetDrawsTransparentBackground(bool enabled);
void OnWebAppIconUrlGet(int callback_id);
+ void OnWebAppCapableGet(int callback_id);
void WillSubmitForm(blink::WebFrame* frame, const blink::WebFormElement& form);
void OnSetBrowserFont();