|
Lines 1473-1506
static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
a/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp_sec1
|
| 1473 |
* You can handle this signal and use a switch to track any ongoing |
1473 |
* You can handle this signal and use a switch to track any ongoing |
| 1474 |
* load operation. |
1474 |
* load operation. |
| 1475 |
* |
1475 |
* |
| 1476 |
* <informalexample><programlisting> |
1476 |
* ```c |
| 1477 |
* static void web_view_load_changed (WebKitWebView *web_view, |
1477 |
* static void web_view_load_changed (WebKitWebView *web_view, |
| 1478 |
* WebKitLoadEvent load_event, |
1478 |
* WebKitLoadEvent load_event, |
| 1479 |
* gpointer user_data) |
1479 |
* gpointer user_data) |
| 1480 |
* { |
1480 |
* { |
| 1481 |
* switch (load_event) { |
1481 |
* switch (load_event) { |
| 1482 |
* case WEBKIT_LOAD_STARTED: |
1482 |
* case WEBKIT_LOAD_STARTED: |
| 1483 |
* /<!-- -->* New load, we have now a provisional URI *<!-- -->/ |
1483 |
* // New load, we have now a provisional URI |
| 1484 |
* provisional_uri = webkit_web_view_get_uri (web_view); |
1484 |
* provisional_uri = webkit_web_view_get_uri (web_view); |
| 1485 |
* /<!-- -->* Here we could start a spinner or update the |
1485 |
* // Here we could start a spinner or update the |
| 1486 |
* <!-- -->* location bar with the provisional URI *<!-- -->/ |
1486 |
* // location bar with the provisional URI |
| 1487 |
* break; |
1487 |
* break; |
| 1488 |
* case WEBKIT_LOAD_REDIRECTED: |
1488 |
* case WEBKIT_LOAD_REDIRECTED: |
| 1489 |
* redirected_uri = webkit_web_view_get_uri (web_view); |
1489 |
* redirected_uri = webkit_web_view_get_uri (web_view); |
| 1490 |
* break; |
1490 |
* break; |
| 1491 |
* case WEBKIT_LOAD_COMMITTED: |
1491 |
* case WEBKIT_LOAD_COMMITTED: |
| 1492 |
* /<!-- -->* The load is being performed. Current URI is |
1492 |
* // The load is being performed. Current URI is |
| 1493 |
* <!-- -->* the final one and it won't change unless a new |
1493 |
* // the final one and it won't change unless a new |
| 1494 |
* <!-- -->* load is requested or a navigation within the |
1494 |
* // load is requested or a navigation within the |
| 1495 |
* <!-- -->* same page is performed *<!-- -->/ |
1495 |
* // same page is performed |
| 1496 |
* uri = webkit_web_view_get_uri (web_view); |
1496 |
* uri = webkit_web_view_get_uri (web_view); |
| 1497 |
* break; |
1497 |
* break; |
| 1498 |
* case WEBKIT_LOAD_FINISHED: |
1498 |
* case WEBKIT_LOAD_FINISHED: |
| 1499 |
* /<!-- -->* Load finished, we can now stop the spinner *<!-- -->/ |
1499 |
* // Load finished, we can now stop the spinner |
| 1500 |
* break; |
1500 |
* break; |
| 1501 |
* } |
1501 |
* } |
| 1502 |
* } |
1502 |
* } |
| 1503 |
* </programlisting></informalexample> |
1503 |
* ``` |
| 1504 |
*/ |
1504 |
*/ |
| 1505 |
signals[LOAD_CHANGED] = |
1505 |
signals[LOAD_CHANGED] = |
| 1506 |
g_signal_new("load-changed", |
1506 |
g_signal_new("load-changed", |
|
Lines 1734-1740
static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
a/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp_sec2
|
| 1734 |
* @decision argument is a generic type, but should be casted to a more |
1734 |
* @decision argument is a generic type, but should be casted to a more |
| 1735 |
* specific type when making the decision. For example: |
1735 |
* specific type when making the decision. For example: |
| 1736 |
* |
1736 |
* |
| 1737 |
* <informalexample><programlisting> |
1737 |
* ```c |
| 1738 |
* static gboolean |
1738 |
* static gboolean |
| 1739 |
* decide_policy_cb (WebKitWebView *web_view, |
1739 |
* decide_policy_cb (WebKitWebView *web_view, |
| 1740 |
* WebKitPolicyDecision *decision, |
1740 |
* WebKitPolicyDecision *decision, |
|
Lines 1743-1767
static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
a/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp_sec3
|
| 1743 |
* switch (type) { |
1743 |
* switch (type) { |
| 1744 |
* case WEBKIT_POLICY_DECISION_TYPE_NAVIGATION_ACTION: { |
1744 |
* case WEBKIT_POLICY_DECISION_TYPE_NAVIGATION_ACTION: { |
| 1745 |
* WebKitNavigationPolicyDecision *navigation_decision = WEBKIT_NAVIGATION_POLICY_DECISION (decision); |
1745 |
* WebKitNavigationPolicyDecision *navigation_decision = WEBKIT_NAVIGATION_POLICY_DECISION (decision); |
| 1746 |
* /<!-- -->* Make a policy decision here. *<!-- -->/ |
1746 |
* // Make a policy decision here |
| 1747 |
* break; |
1747 |
* break; |
| 1748 |
* } |
1748 |
* } |
| 1749 |
* case WEBKIT_POLICY_DECISION_TYPE_NEW_WINDOW_ACTION: { |
1749 |
* case WEBKIT_POLICY_DECISION_TYPE_NEW_WINDOW_ACTION: { |
| 1750 |
* WebKitNavigationPolicyDecision *navigation_decision = WEBKIT_NAVIGATION_POLICY_DECISION (decision); |
1750 |
* WebKitNavigationPolicyDecision *navigation_decision = WEBKIT_NAVIGATION_POLICY_DECISION (decision); |
| 1751 |
* /<!-- -->* Make a policy decision here. *<!-- -->/ |
1751 |
* // Make a policy decision here |
| 1752 |
* break; |
1752 |
* break; |
| 1753 |
* } |
1753 |
* } |
| 1754 |
* case WEBKIT_POLICY_DECISION_TYPE_RESPONSE: |
1754 |
* case WEBKIT_POLICY_DECISION_TYPE_RESPONSE: |
| 1755 |
* WebKitResponsePolicyDecision *response = WEBKIT_RESPONSE_POLICY_DECISION (decision); |
1755 |
* WebKitResponsePolicyDecision *response = WEBKIT_RESPONSE_POLICY_DECISION (decision); |
| 1756 |
* /<!-- -->* Make a policy decision here. *<!-- -->/ |
1756 |
* // Make a policy decision here |
| 1757 |
* break; |
1757 |
* break; |
| 1758 |
* default: |
1758 |
* default: |
| 1759 |
* /<!-- -->* Making no decision results in webkit_policy_decision_use(). *<!-- -->/ |
1759 |
* // Making no decision results in webkit_policy_decision_use() |
| 1760 |
* return FALSE; |
1760 |
* return FALSE; |
| 1761 |
* } |
1761 |
* } |
| 1762 |
* return TRUE; |
1762 |
* return TRUE; |
| 1763 |
* } |
1763 |
* } |
| 1764 |
* </programlisting></informalexample> |
1764 |
* ``` |
| 1765 |
* |
1765 |
* |
| 1766 |
* It is possible to make policy decision asynchronously, by simply calling g_object_ref() |
1766 |
* It is possible to make policy decision asynchronously, by simply calling g_object_ref() |
| 1767 |
* on the @decision argument and returning %TRUE to block the default signal handler. |
1767 |
* on the @decision argument and returning %TRUE to block the default signal handler. |
|
Lines 1798-1804
static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
a/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp_sec4
|
| 1798 |
* A possible way to use this signal could be through a dialog |
1798 |
* A possible way to use this signal could be through a dialog |
| 1799 |
* allowing the user decide what to do with the request: |
1799 |
* allowing the user decide what to do with the request: |
| 1800 |
* |
1800 |
* |
| 1801 |
* <informalexample><programlisting> |
1801 |
* ```c |
| 1802 |
* static gboolean permission_request_cb (WebKitWebView *web_view, |
1802 |
* static gboolean permission_request_cb (WebKitWebView *web_view, |
| 1803 |
* WebKitPermissionRequest *request, |
1803 |
* WebKitPermissionRequest *request, |
| 1804 |
* GtkWindow *parent_window) |
1804 |
* GtkWindow *parent_window) |
|
Lines 1823-1829
static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
a/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp_sec5
|
| 1823 |
* |
1823 |
* |
| 1824 |
* return TRUE; |
1824 |
* return TRUE; |
| 1825 |
* } |
1825 |
* } |
| 1826 |
* </programlisting></informalexample> |
1826 |
* ``` |
| 1827 |
* |
1827 |
* |
| 1828 |
* It is possible to handle permission requests asynchronously, by |
1828 |
* It is possible to handle permission requests asynchronously, by |
| 1829 |
* simply calling g_object_ref() on the @request argument and |
1829 |
* simply calling g_object_ref() on the @request argument and |
|
Lines 3905-3911
void webkit_web_view_run_javascript(WebKitWebView* webView, const gchar* script,
a/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp_sec6
|
| 3905 |
* This is an example of using webkit_web_view_run_javascript() with a script returning |
3905 |
* This is an example of using webkit_web_view_run_javascript() with a script returning |
| 3906 |
* a string: |
3906 |
* a string: |
| 3907 |
* |
3907 |
* |
| 3908 |
* <informalexample><programlisting> |
3908 |
* ```c |
| 3909 |
* static void |
3909 |
* static void |
| 3910 |
* web_view_javascript_finished (GObject *object, |
3910 |
* web_view_javascript_finished (GObject *object, |
| 3911 |
* GAsyncResult *result, |
3911 |
* GAsyncResult *result, |
|
Lines 3924-3934
void webkit_web_view_run_javascript(WebKitWebView* webView, const gchar* script,
a/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp_sec7
|
| 3924 |
* |
3924 |
* |
| 3925 |
* value = webkit_javascript_result_get_js_value (js_result); |
3925 |
* value = webkit_javascript_result_get_js_value (js_result); |
| 3926 |
* if (jsc_value_is_string (value)) { |
3926 |
* if (jsc_value_is_string (value)) { |
| 3927 |
* JSCException *exception; |
3927 |
* gchar *str_value = jsc_value_to_string (value); |
| 3928 |
* gchar *str_value; |
3928 |
* JSCException *exception = jsc_context_get_exception (jsc_value_get_context (value)); |
| 3929 |
* |
|
|
| 3930 |
* str_value = jsc_value_to_string (value); |
| 3931 |
* exception = jsc_context_get_exception (jsc_value_get_context (value)); |
| 3932 |
* if (exception) |
3929 |
* if (exception) |
| 3933 |
* g_warning ("Error running javascript: %s", jsc_exception_get_message (exception)); |
3930 |
* g_warning ("Error running javascript: %s", jsc_exception_get_message (exception)); |
| 3934 |
* else |
3931 |
* else |
|
Lines 3944-3956
void webkit_web_view_run_javascript(WebKitWebView* webView, const gchar* script,
a/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp_sec8
|
| 3944 |
* web_view_get_link_url (WebKitWebView *web_view, |
3941 |
* web_view_get_link_url (WebKitWebView *web_view, |
| 3945 |
* const gchar *link_id) |
3942 |
* const gchar *link_id) |
| 3946 |
* { |
3943 |
* { |
| 3947 |
* gchar *script; |
3944 |
* gchar *script = g_strdup_printf ("window.document.getElementById('%s').href;", link_id); |
| 3948 |
* |
|
|
| 3949 |
* script = g_strdup_printf ("window.document.getElementById('%s').href;", link_id); |
| 3950 |
* webkit_web_view_run_javascript (web_view, script, NULL, web_view_javascript_finished, NULL); |
3945 |
* webkit_web_view_run_javascript (web_view, script, NULL, web_view_javascript_finished, NULL); |
| 3951 |
* g_free (script); |
3946 |
* g_free (script); |
| 3952 |
* } |
3947 |
* } |
| 3953 |
* </programlisting></informalexample> |
3948 |
* ``` |
| 3954 |
* |
3949 |
* |
| 3955 |
* Returns: (transfer full): a #WebKitJavascriptResult with the result of the last executed statement in @script |
3950 |
* Returns: (transfer full): a #WebKitJavascriptResult with the result of the last executed statement in @script |
| 3956 |
* or %NULL in case of error |
3951 |
* or %NULL in case of error |