+2011-12-12 Raphael Kubo da Costa <kubo@profusion.mobi>
+
+ [EFL] Add API to notify that mixed content has been loaded.
+ https://bugs.webkit.org/show_bug.cgi?id=74301
+
+ Reviewed by Gustavo Noronha Silva.
+
+ When mixed content is displayed/run, both frames and views
+ emit the proper signals to notify API users.
+
+ * WebCoreSupport/FrameLoaderClientEfl.cpp:
+ (WebCore::FrameLoaderClientEfl::didDisplayInsecureContent):
+ (WebCore::FrameLoaderClientEfl::didRunInsecureContent):
+ * ewk/ewk_frame.cpp:
+ (ewk_frame_view_create_for_view):
+ (ewk_frame_mixed_content_displayed_get):
+ (ewk_frame_mixed_content_run_get):
+ (ewk_frame_mixed_content_displayed_set):
+ (ewk_frame_mixed_content_run_set):
+ * ewk/ewk_frame.h:
+ * ewk/ewk_private.h:
+ * ewk/ewk_view.cpp:
+ (ewk_view_frame_main_cleared):
+ (ewk_view_mixed_content_displayed_get):
+ (ewk_view_mixed_content_run_get):
+ (ewk_view_mixed_content_displayed_set):
+ (ewk_view_mixed_content_run_set):
+ * ewk/ewk_view.h:
+
2011-12-12 Raphael Kubo da Costa <kubo@profusion.mobi>
[EFL] Add API to manage root X.509 CA certificates.
void FrameLoaderClientEfl::didDisplayInsecureContent()
{
- notImplemented();
+ ewk_frame_mixed_content_displayed_set(m_frame, true);
}
void FrameLoaderClientEfl::didRunInsecureContent(SecurityOrigin*, const KURL&)
{
- notImplemented();
+ ewk_frame_mixed_content_run_set(m_frame, true);
}
void FrameLoaderClientEfl::didDetectXSS(const KURL&, bool)
const char* uri;
const char* name;
bool editable : 1;
+ bool hasDisplayedMixedContent : 1;
+ bool hasRunMixedContent : 1;
};
struct Eina_Iterator_Ewk_Frame {
const char* theme = ewk_view_theme_get(view);
smartData->frame->view()->setEdjeTheme(theme);
smartData->frame->view()->setEvasObject(ewkFrame);
+
+ ewk_frame_mixed_content_displayed_set(ewkFrame, false);
+ ewk_frame_mixed_content_run_set(ewkFrame, false);
}
ssize_t ewk_frame_source_get(const Evas_Object* ewkFrame, char** frameSource)
return strdup(documentElement->innerText().utf8().data());
}
+Eina_Bool ewk_frame_mixed_content_displayed_get(const Evas_Object* ewkFrame)
+{
+ EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, smartData, false);
+ return smartData->hasDisplayedMixedContent;
+}
+
+Eina_Bool ewk_frame_mixed_content_run_get(const Evas_Object* ewkFrame)
+{
+ EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, smartData, false);
+ return smartData->hasRunMixedContent;
+}
+
/**
* @internal
* Reports uri changed and swap internal string reference.
ewk_view_editor_client_contents_changed(smartData->view);
}
+/**
+ * @internal
+ * Defines whether the frame has displayed mixed content.
+ *
+ * When a frame has displayed mixed content, the currently loaded URI is secure (HTTPS) but it has
+ * loaded and displayed a resource, such as an image, from an insecure (HTTP) source.
+ *
+ * @param hasDisplayed Do or do not clear the flag from the frame. If @c true, the container view
+ * is also notified and it then emits the "mixedcontent,displayed" signal.
+ *
+ * Emits signal: "mixedcontent,displayed" with no parameters when @p hasDisplayed is @c true.
+ */
+void ewk_frame_mixed_content_displayed_set(Evas_Object* ewkFrame, bool hasDisplayed)
+{
+ EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, smartData);
+ smartData->hasDisplayedMixedContent = hasDisplayed;
+
+ if (hasDisplayed) {
+ ewk_view_mixed_content_displayed_set(smartData->view, true);
+ evas_object_smart_callback_call(ewkFrame, "mixedcontent,displayed", 0);
+ }
+}
+
+/**
+ * @internal
+ * Defines whether the frame has run mixed content.
+ *
+ * When a frame has run mixed content, the currently loaded URI is secure (HTTPS) but it has
+ * loaded and run a resource, such as a script, from an insecure (HTTP) source.
+ *
+ * @param hasDisplayed Do or do not clear the flag from the frame. If @c true, the container view
+ * is also notified and it then emits the "mixedcontent,run" signal.
+ *
+ * Emits signal: "mixedcontent,run" with no parameters when @p hasRun is @c true.
+ */
+void ewk_frame_mixed_content_run_set(Evas_Object* ewkFrame, bool hasRun)
+{
+ EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, smartData);
+ smartData->hasRunMixedContent = hasRun;
+
+ if (hasRun) {
+ ewk_view_mixed_content_run_set(smartData->view, true);
+ evas_object_smart_callback_call(ewkFrame, "mixedcontent,run", 0);
+ }
+}
+
namespace EWKPrivate {
WebCore::Frame *coreFrame(const Evas_Object *ewkFrame)
* from 0.0 to 1.0, connect to individual frames for fine grained).
* - "load,provisional", void: frame started provisional load.
* - "load,started", void: frame started loading the document.
+ * - "mixedcontent,displayed", void: frame has loaded and displayed mixed content.
+ * - "mixedcontent,run", void: frame has loaded and run mixed content.
* - "navigation,first", void: first navigation was occurred.
* - "resource,request,new", Ewk_Frame_Resource_Request*: reports that
* there's a new resource request.
*/
EAPI char* ewk_frame_plain_text_get(const Evas_Object* o);
+/**
+ * Returns whether the frame has displayed mixed content.
+ *
+ * When a frame has displayed mixed content, its current URI is an HTTPS one, but it has
+ * loaded and displayed a resource (such as an image) from an insecure (non-HTTPS) URI.
+ * Both the frame and the container view send a "mixedcontent,displayed" signal in this case.
+ *
+ * The status is reset only when a load event occurs (eg. the page is reloaded or a new page is loaded).
+ *
+ * @param o The frame to query.
+ *
+ * @sa ewk_view_mixed_content_displayed_get
+ */
+EAPI Eina_Bool ewk_frame_mixed_content_displayed_get(const Evas_Object *o);
+
+/**
+ * Returns whether the frame has run mixed content.
+ *
+ * When a frame has run mixed content, its current URI is an HTTPS one, but it has
+ * loaded and run a resource (such as an image) from an insecure (non-HTTPS) URI.
+ * Both the frame and the container view send a "mixedcontent,run" signal in this case.
+ *
+ * The status is reset only when a load event occurs (eg. the page is reloaded or a new page is loaded).
+ *
+ * @param o The frame to query.
+ *
+ * @sa ewk_view_mixed_content_run_get
+ */
+EAPI Eina_Bool ewk_frame_mixed_content_run_get(const Evas_Object *o);
+
#ifdef __cplusplus
}
#endif
void ewk_frame_editor_client_contents_changed(Evas_Object* o);
void ewk_frame_editor_client_selection_changed(Evas_Object* o);
+void ewk_frame_mixed_content_displayed_set(Evas_Object* ewkFrame, bool hasDisplayed);
+void ewk_frame_mixed_content_run_set(Evas_Object* ewkFrame, bool hasRun);
+void ewk_view_mixed_content_displayed_set(Evas_Object* ewkView, bool hasDisplayed);
+void ewk_view_mixed_content_run_set(Evas_Object* ewkView, bool hasRun);
+
#ifdef __cplusplus
}
struct {
bool viewCleared : 1;
bool needTouchEvents : 1;
+ bool hasDisplayedMixedContent : 1;
+ bool hasRunMixedContent : 1;
} flags;
struct {
const char* userAgent;
EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
EINA_SAFETY_ON_NULL_RETURN(smartData->api->flush);
smartData->api->flush(smartData);
+
+ ewk_view_mixed_content_displayed_set(ewkView, false);
+ ewk_view_mixed_content_run_set(ewkView, false);
}
/**
return static_cast<Ewk_View_Mode>(priv->page->viewMode());
}
+Eina_Bool ewk_view_mixed_content_displayed_get(const Evas_Object* ewkView)
+{
+ EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
+ EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
+ return priv->flags.hasDisplayedMixedContent;
+}
+
+Eina_Bool ewk_view_mixed_content_run_get(const Evas_Object* ewkView)
+{
+ EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
+ EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
+ return priv->flags.hasRunMixedContent;
+}
+
/**
* @internal
* Reports the view that editor client selection has changed.
evas_object_smart_callback_call(ewkView, "editorclient,contents,changed", 0);
}
+/**
+ * @internal
+ * Defines whether the view has displayed mixed content.
+ *
+ * When a view has displayed mixed content, any of its frames has loaded an HTTPS URI
+ * which has itself loaded and displayed a resource (such as an image) from an insecure,
+ * that is, non-HTTPS, URI.
+ *
+ * @param hasDisplayed Do or do not clear the flag from the view.
+ *
+ * Emits signal: "mixedcontent,displayed" with no parameters when @p hasDisplayed is @c true.
+ */
+void ewk_view_mixed_content_displayed_set(Evas_Object* ewkView, bool hasDisplayed)
+{
+ EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
+ EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
+
+ priv->flags.hasDisplayedMixedContent = hasDisplayed;
+
+ if (hasDisplayed)
+ evas_object_smart_callback_call(ewkView, "mixedcontent,displayed", 0);
+}
+
+/**
+ * @internal
+ * Defines whether the view has run mixed content.
+ *
+ * When a view has run mixed content, any of its frames has loaded an HTTPS URI
+ * which has itself loaded and run a resource (such as a script) from an insecure,
+ * that is, non-HTTPS, URI.
+ *
+ * @param hasRun Do or do not clear the flag from the view.
+ *
+ * Emits signal: "mixedcontent,run" with no parameters when @p hasRun is @c true.
+ */
+void ewk_view_mixed_content_run_set(Evas_Object* ewkView, bool hasRun)
+{
+ EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
+ EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
+
+ priv->flags.hasRunMixedContent = hasRun;
+
+ if (hasRun)
+ evas_object_smart_callback_call(ewkView, "mixedcontent,run", 0);
+}
+
Eina_Bool ewk_view_visibility_state_set(Evas_Object* ewkView, Ewk_Page_Visibility_State pageVisibilityState, Eina_Bool initialState)
{
#if ENABLE(PAGE_VISIBILITY_API)
* - "menubar,visible,get", Eina_Bool *: expects a @c EINA_TRUE if menubar is
* visible; @c EINA_FALSE, otherwise.
* - "menubar,visible,set", Eina_Bool: sets menubar visibility.
+ * - "mixedcontent,displayed", void: any of the containing frames has loaded and displayed mixed content.
+ * - "mixedcontent,run", void: any of the containing frames has loaded and run mixed content.
* - "ready", void: page is fully loaded.
* - "scrollbars,visible,get", Eina_Bool *: expects a @c EINA_TRUE if scrollbars
* are visible; @c EINA_FALSE, otherwise.
*/
EAPI Ewk_Page_Visibility_State ewk_view_visibility_state_get(const Evas_Object *o);
+/**
+ * Returns whether the view has displayed mixed content.
+ *
+ * When a view has displayed mixed content, any of its frames has loaded an HTTPS URI
+ * which has itself loaded and displayed a resource (such as an image) from an insecure,
+ * that is, non-HTTPS, URI.
+ *
+ * The status is reset only when a load event occurs (eg. the page is reloaded or a new page is loaded).
+ *
+ * When one of the containing frames displays mixed content, the view emits the "mixedcontent,displayed" signal.
+ *
+ * @param o The view to query.
+ *
+ * @sa ewk_frame_mixed_content_displayed_get
+ */
+EAPI Eina_Bool ewk_view_mixed_content_displayed_get(const Evas_Object *o);
+
+/**
+ * Returns whether the view has run mixed content.
+ *
+ * When a view has run mixed content, any of its frames has loaded an HTTPS URI
+ * which has itself loaded and run a resource (such as an image) from an insecure,
+ * that is, non-HTTPS, URI.
+ *
+ * The status is reset only when a load event occurs (eg. the page is reloaded or a new page is loaded).
+ *
+ * When one of the containing frames runs mixed content, the view emits the "mixedcontent,run" signal.
+ *
+ * @param o The view to query.
+ *
+ * @sa ewk_frame_mixed_content_run_get
+ */
+EAPI Eina_Bool ewk_view_mixed_content_run_get(const Evas_Object *o);
+
#ifdef __cplusplus
}
#endif