void WebViewImpl::LoadUrl(const std::string& url, const std::string& mime) {
SCOPE_PROFILE();
if (!mime.empty()) {
- mime_ = mime;
- auto mime_override_cb = [](const char* url, const char* mime,
- char** new_mime, void* data) -> Eina_Bool{
+ mime_set_cb_ = [url, mime]
+ (const char* request_url, const char* request_mime,
+ char** new_mime, void* data) {
WebViewImpl* view = static_cast<WebViewImpl*>(data);
if (view != nullptr &&
common::utils::BaseName(url) ==
- common::utils::BaseName(view->GetUrl())) {
- *new_mime = strdup(view->mime().c_str());
+ common::utils::BaseName(request_url)) {
+ *new_mime = strdup(mime.c_str());
LOGGER(DEBUG) << "ewk's new_mime: " << *new_mime;
return EINA_TRUE;
}
return EINA_FALSE;
};
+ auto mime_override_cb = [](const char* url, const char* mime,
+ char** new_mime, void* data) -> Eina_Bool {
+ WebViewImpl* view = static_cast<WebViewImpl*>(data);
+ return view->mime_set_cb_(url, mime, new_mime, data);
+ };
ewk_context_mime_override_callback_set(context_, mime_override_cb, this);
}
ewk_view_url_set(ewk_view_, url.c_str());
void SetEventListener(WebView::EventListener* listener);
Evas_Object* evas_object() const;
- std::string mime() const { return mime_; }
private:
void OnKeyEvent(Eext_Callback_Type key_type);
void InitRotaryEventCallback();
#endif // ROTARY_EVENT_FEATURE_SUPPORT
+ std::function<bool (const char*, const char*, char**, void*)> mime_set_cb_;
+
NativeWindow* window_;
Ewk_Context* context_;
Evas_Object* ewk_view_;
WebView* view_;
std::map<const std::string, Evas_Smart_Cb> smart_callbacks_;
bool fullscreen_;
- std::string mime_;
Evas_Smart* evas_smart_class_;
Ewk_View_Smart_Class ewk_smart_class_;
bool internal_popup_opened_;