diff options
Diffstat (limited to 'embed/mozilla')
-rw-r--r-- | embed/mozilla/EphyWrapper.cpp | 574 | ||||
-rw-r--r-- | embed/mozilla/EphyWrapper.h | 18 | ||||
-rw-r--r-- | embed/mozilla/Makefile.am | 38 | ||||
-rw-r--r-- | embed/mozilla/mozilla-embed-shell.cpp | 112 | ||||
-rw-r--r-- | embed/mozilla/mozilla-embed.cpp | 93 |
5 files changed, 25 insertions, 810 deletions
diff --git a/embed/mozilla/EphyWrapper.cpp b/embed/mozilla/EphyWrapper.cpp index ade9e67b2..716b5e75c 100644 --- a/embed/mozilla/EphyWrapper.cpp +++ b/embed/mozilla/EphyWrapper.cpp @@ -671,26 +671,6 @@ nsresult EphyWrapper::GetDocumentUrl (nsCString &url) return NS_OK; } -nsresult EphyWrapper::GetDocumentTitle (char **title) -{ - nsresult result; - - nsCOMPtr<nsIDOMDocument> DOMDocument; - - result = GetDOMDocument (getter_AddRefs(DOMDocument)); - if (NS_FAILED(result) || !DOMDocument) return NS_ERROR_FAILURE; - - nsCOMPtr<nsIDocument> doc = do_QueryInterface(DOMDocument); - if(!doc) return NS_ERROR_FAILURE; - - const nsString* t; - t = doc->GetDocumentTitle(); - - *title = g_strdup (NS_ConvertUCS2toUTF8(*t).get()); - - return NS_OK; -} - nsresult EphyWrapper::CopyHistoryTo (EphyWrapper *dest) { nsresult result; @@ -809,566 +789,12 @@ nsresult EphyWrapper::Paste(void) return clipboard->Paste (); } -nsresult EphyWrapper::GetLinkInterfaceItems (GList **list) -{ -#ifdef NOT_PORTED - nsresult result; - PRUint32 links_count; - - /* we accept these rel=.. elements, specified by the w3c */ - const gchar *rel_types[] = { - "START", "NEXT", "PREV", "PREVIOUS", "CONTENTS", "TOC", "INDEX", - "GLOSSARY", "COPYRIGHT", "CHAPTER", "SECTION", - "SUBSECTION", "APPENDIX", "HELP", "TOP", "SEARCH", "MADE", - "BOOKMARK", "HOME", - NULL /* terminator, must be last */ - }; - - nsCOMPtr<nsIDOMDocument> DOMDocument; - result = GetMainDOMDocument (getter_AddRefs(DOMDocument)); - if (NS_FAILED(result) || !DOMDocument) return NS_ERROR_FAILURE; - - /* get list of link elements*/ - NS_NAMED_LITERAL_STRING(strname, "LINK"); - - nsCOMPtr<nsIDOMNodeList> links; - result = aDOMDocument->GetElementsByTagName (strname, - getter_AddRefs (links)); - if (NS_FAILED (result)) return NS_ERROR_FAILURE; - - result = links->GetLength (&links_count); - if (NS_FAILED (result)) return NS_ERROR_FAILURE; - - for (PRUint32 i = 0; i < links_count; i++) - { - /* get to the link element */ - nsCOMPtr<nsIDOMNode> link; - result = links->Item (i, getter_AddRefs (link)); - if (NS_FAILED (result)) return NS_ERROR_FAILURE; - - nsCOMPtr<nsIDOMElement> linkElement; - linkElement = do_QueryInterface (aLink); - if (!linkElement) return NS_ERROR_FAILURE; - - /* get rel=.. element */ - NS_NAMED_LITERAL_STRING(attr_rel, "rel"); - nsAutoString value; - linkElement->GetAttribute (attr_rel, value); - - if (value.IsEmpty()) - { - NS_NAMED_LITERAL_STRING(attr_rev, "rev"); - linkElement->GetAttribute (attr_rev, value); - if (value.IsEmpty()) continue; - } - - nsCString relstr = NS_ConvertUCS2toUTF8(value); - ToUpperCase(relstr); - - /* check for elements we want */ - for (gint j = 0; (rel_types[j] != NULL); j++) - { - if (strcmp (relstr.get(), rel_types[j]) == 0) - { - /* found one! */ - LinkInterfaceItem *lti = - g_new0 (LinkInterfaceItem, 1); - - /* fill in struct */ - lti->type = (LinkInterfaceItemType) j; - - /* get href=.. element */ - NS_NAMED_LITERAL_STRING(attr_href, "href"); - nsAutoString value; - linkElement->GetAttribute (attr_href, value); - - if (value.IsEmpty()) - { - g_free (lti); - continue; - } - - /* resolve uri */ - nsCOMPtr<nsIDocument> doc = - do_QueryInterface (aDOMDocument); - if(!doc) return NS_ERROR_FAILURE; - - nsCOMPtr<nsIURI> uri; - doc->GetDocumentURL(getter_AddRefs(uri)); - - const nsACString &link = NS_ConvertUCS2toUTF8(value); - nsCAutoString href; - result = uri->Resolve (link, href); - if (NS_FAILED (result)) return NS_ERROR_FAILURE; - lti->href = g_strdup (href.get()); - - /* append to list of items */ - *list = g_list_append (*list, lti); - - /* get optional title=... element */ - NS_NAMED_LITERAL_STRING(attr_title, "title"); - linkElement->GetAttribute (attr_title, value); - if (value.IsEmpty()) continue; - - const nsACString &title = NS_ConvertUCS2toUTF8 (value); - lti->title = gul_string_strip_newline (PromiseFlatCString(title).get()); - } - } - } -#endif - return NS_OK; -} - -nsresult EphyWrapper::GetRealURL (nsCString &ret) -{ - nsresult result; - - nsCOMPtr<nsIDocShell> DocShell; - result = GetDocShell (getter_AddRefs(DocShell)); - if (NS_FAILED(result) || !DocShell) return NS_ERROR_FAILURE; - - nsCOMPtr<nsIWebNavigation> ContentNav = do_QueryInterface (DocShell, - &result); - if (!ContentNav) return NS_ERROR_FAILURE; - - nsCOMPtr<nsIURI> uri; - result = ContentNav->GetCurrentURI (getter_AddRefs(uri)); - if (!NS_SUCCEEDED(result) || (!uri)) return NS_ERROR_FAILURE; - - result = uri->GetSpec(ret); - if (!NS_SUCCEEDED(result) || ret.IsEmpty()) return NS_ERROR_FAILURE; - - return NS_OK; -} - nsresult EphyWrapper::SelectAll (void) { nsCOMPtr<nsIClipboardCommands> clipboard (do_GetInterface(mWebBrowser)); return clipboard->SelectAll (); } -nsresult EphyWrapper::ScrollUp (void) -{ - nsresult result; - - nsCOMPtr<nsIDOMWindow> DOMWindow; - result = GetFocusedDOMWindow (getter_AddRefs(DOMWindow)); - if (NS_FAILED(result) || !DOMWindow) return NS_ERROR_FAILURE; - - DOMWindow->ScrollByLines(-1); - - return NS_OK; -} - -nsresult EphyWrapper::ScrollDown (void) -{ - nsresult result; - - nsCOMPtr<nsIDOMWindow> DOMWindow; - result = GetFocusedDOMWindow (getter_AddRefs(DOMWindow)); - if (NS_FAILED(result) || !DOMWindow) return NS_ERROR_FAILURE; - - DOMWindow->ScrollByLines(1); - - return NS_OK; -} - -nsresult EphyWrapper::ScrollLeft (void) -{ - nsresult result; - - nsCOMPtr<nsIDOMWindow> DOMWindow; - result = GetFocusedDOMWindow (getter_AddRefs(DOMWindow)); - if (NS_FAILED(result) || !DOMWindow) return NS_ERROR_FAILURE; - - DOMWindow->ScrollBy(-16, 0); - - return NS_OK; -} - -nsresult EphyWrapper::ScrollRight (void) -{ - nsresult result; - - nsCOMPtr<nsIDOMWindow> DOMWindow; - result = GetFocusedDOMWindow (getter_AddRefs(DOMWindow)); - if (NS_FAILED(result) || !DOMWindow) return NS_ERROR_FAILURE; - - DOMWindow->ScrollBy(16, 0); - - return NS_OK; -} - -nsresult EphyWrapper::FineScroll (int horiz, int vert) -{ - nsresult result; - - nsCOMPtr<nsIDOMWindow> DOMWindow; - result = GetFocusedDOMWindow (getter_AddRefs(DOMWindow)); - if (NS_FAILED(result) || !DOMWindow) return NS_ERROR_FAILURE; - - DOMWindow->ScrollBy(horiz, vert); - - return NS_OK; -} - -nsresult EphyWrapper::GetLastModified (gchar **ret) -{ - nsresult result; - - nsCOMPtr<nsIDOMDocument> DOMDocument; - - result = GetDOMDocument (getter_AddRefs(DOMDocument)); - if (NS_FAILED(result) || !DOMDocument) return NS_ERROR_FAILURE; - - nsCOMPtr<nsIDOMNSHTMLDocument> doc = do_QueryInterface(DOMDocument); - if(!doc) return NS_ERROR_FAILURE; - - nsAutoString value; - doc->GetLastModified(value); - - *ret = g_strdup (NS_ConvertUCS2toUTF8(value).get()); - - return NS_OK; -} - -nsresult EphyWrapper::GetImages (GList **ret) -{ -#ifdef NOT_PORTED - nsresult result; - GHashTable *hash = g_hash_table_new (g_str_hash, g_str_equal); - - nsCOMPtr<nsIDOMDocument> DOMDocument; - - result = GetDOMDocument (getter_AddRefs(DOMDocument)); - if (NS_FAILED(result) || !DOMDocument) return NS_ERROR_FAILURE; - - nsCOMPtr<nsIDOMHTMLDocument> doc = do_QueryInterface(DOMDocument); - if(!doc) return NS_ERROR_FAILURE; - - nsCOMPtr<nsIDOMHTMLCollection> col; - doc->GetImages(getter_AddRefs(col)); - - PRUint32 count, i; - col->GetLength(&count); - for (i = 0; i < count; i++) - { - nsCOMPtr<nsIDOMNode> node; - col->Item(i, getter_AddRefs(node)); - if (!node) continue; - - nsCOMPtr<nsIDOMHTMLElement> element; - element = do_QueryInterface(node); - if (!element) continue; - - nsCOMPtr<nsIDOMHTMLImageElement> img; - img = do_QueryInterface(element); - if (!img) continue; - - ImageListItem *item = g_new0 (ImageListItem, 1); - - nsAutoString tmp; - result = img->GetSrc (tmp); - if (NS_SUCCEEDED(result)) - { - const nsACString &c = NS_ConvertUCS2toUTF8(tmp); - if (g_hash_table_lookup (hash, PromiseFlatCString(c).get())) - { - g_free (item); - continue; - } - item->url = g_strdup (c.get()); - g_hash_table_insert (hash, item->url, - GINT_TO_POINTER (TRUE)); - } - result = img->GetAlt (tmp); - if (NS_SUCCEEDED(result)) - { - const nsACString &c = NS_ConvertUCS2toUTF8(tmp); - item->alt = gul_string_strip_newline (PromiseFlatCString(c).get()); - } - result = element->GetTitle (tmp); - if (NS_SUCCEEDED(result)) - { - const nsACString &c = NS_ConvertUCS2toUTF8(tmp); - item->title = gul_string_strip_newline (PromiseFlatCString(c).get()); - } - result = img->GetWidth (&(item->width)); - result = img->GetHeight (&(item->height)); - - *ret = g_list_append (*ret, item); - } - - g_hash_table_destroy (hash); -#endif - return NS_OK; -} - -nsresult EphyWrapper::GetForms (GList **ret) -{ -#ifdef NOT_PORTED - nsresult result; - - nsCOMPtr<nsIDOMDocument> DOMDocument; - - result = GetDOMDocument (getter_AddRefs(DOMDocument)); - if (NS_FAILED(result) || !DOMDocument) return NS_ERROR_FAILURE; - - nsCOMPtr<nsIDOMHTMLDocument> doc = do_QueryInterface(DOMDocument); - if(!doc) return NS_ERROR_FAILURE; - - nsCOMPtr<nsIDOMHTMLCollection> col; - doc->GetForms(getter_AddRefs(col)); - - PRUint32 count, i; - col->GetLength(&count); - for (i = 0; i < count; i++) - { - nsCOMPtr<nsIDOMNode> node; - col->Item(i, getter_AddRefs(node)); - if (!node) continue; - - nsCOMPtr<nsIDOMHTMLElement> element; - element = do_QueryInterface(node); - if (!element) continue; - - nsCOMPtr<nsIDOMHTMLFormElement> form; - form = do_QueryInterface(element); - if (!form) continue; - - FormListItem *item = g_new0 (FormListItem, 1); - - nsAutoString tmp; - result = form->GetAction (tmp); - if (NS_SUCCEEDED(result)) - { - nsCOMPtr<nsIDocument> doc = - do_QueryInterface (aDOMDocument); - if(!doc) return NS_ERROR_FAILURE; - - nsCOMPtr<nsIURI> uri; - doc->GetDocumentURL(getter_AddRefs(uri)); - - const nsACString &s = NS_ConvertUTF8toUCS2(tmp); - nsCAutoString c; - result = uri->Resolve (c, s); - - item->action = s.Length() ? g_strdup (s.get()) : g_strdup (c.get()); - } - result = form->GetMethod (tmp); - if (NS_SUCCEEDED(result)) - { - const nsACString &c = NS_ConvertUTF8toUCS2(tmp); - item->method = g_strdup (PromiseFlatCString(c).get()); - } - result = form->GetName (tmp); - if (NS_SUCCEEDED(result)) - { - const nsACString &c = NS_ConvertUTF8toUCS2(tmp); - item->name = g_strdup (PromiseFlatCString(c).get()); - } - - *ret = g_list_append (*ret, item); - } -#endif - return NS_OK; -} - -nsresult EphyWrapper::GetLinks (GList **ret) -{ -#ifdef NOT_PORTED - nsresult result; - - nsCOMPtr<nsIDOMDocument> DOMDocument; - result = GetMainDOMDocument (getter_AddRefs(DOMDocument)); - if (NS_FAILED(result) || !DOMDocument) return NS_ERROR_FAILURE; - - /* first, get a list of <link> elements */ - PRUint32 links_count; - - NS_NAMED_LITERAL_STRING(strname, "LINK"); - - nsCOMPtr<nsIDOMNodeList> links; - result = DOMDocument->GetElementsByTagName (strname, - getter_AddRefs (links)); - if (NS_FAILED (result)) return NS_ERROR_FAILURE; - - result = aLinks->GetLength (&links_count); - if (NS_FAILED (result)) return NS_ERROR_FAILURE; - - for (PRUint32 i = 0; i < links_count; i++) - { - nsCOMPtr<nsIDOMNode> link; - result = links->Item (i, getter_AddRefs (link)); - if (NS_FAILED (result)) continue; - - nsCOMPtr<nsIDOMElement> linkElement; - linkElement = do_QueryInterface (link); - if (!linkElement) continue; - - NS_NAMED_LITERAL_STRING(attr_href, "href"); - nsAutoString value; - linkElement->GetAttribute (attr_href, value); - if (value.IsEmpty()) continue; - - const nsACString &link = NS_ConvertUCS2toUTF8(value); - - if (link.IsEmpty()) continue; - - nsCOMPtr<nsIDocument> doc = - do_QueryInterface (aDOMDocument); - if(!doc) continue; - - nsCOMPtr<nsIURI> uri; - doc->GetDocumentURL(getter_AddRefs(uri)); - - nsCAutoString tmp; - result = uri->Resolve (link, tmp); - - LinkListItem *i = g_new0 (LinkListItem, 1); - - if (!tmp.IsEmpty()) - { - i->url = g_strdup (tmp.get()); - } - else - { - i->url = g_strdup (link.get()); - } - - NS_NAMED_LITERAL_STRING(attr_title, "title"); - linkElement->GetAttribute (attr_title, value); - if (!value.IsEmpty()) - { - const nsACString &s = NS_ConvertUCS2toUTF8(value); - i->title = gul_string_strip_newline (PromiseFlatCString(s).get()); - } - - NS_NAMED_LITERAL_STRING(attr_rel, "rel"); - linkElement->GetAttribute (attr_rel, value); - if (!value.IsEmpty()) - { - const nsACString &s = NS_ConvertUCS2toUTF8(value); - i->rel = g_strdup (PromiseFlatCString(s).get()); - g_strdown (i->rel); - } - if (!i->rel || strlen (i->rel) == 0) - { - NS_NAMED_LITERAL_STRING(attr_rev, "rev"); - linkElement->GetAttribute (attr_rev, value); - if (!value.IsEmpty()) - { - const nsACString &s = NS_ConvertUCS2toUTF8(value); - i->rel = g_strdup (PromiseFlatCString(s).get()); - g_strdown (i->rel); - } - } - - *ret = g_list_append (*ret, i); - } - - /* next, get a list of anchors */ - nsCOMPtr<nsIDOMHTMLDocument> doc = do_QueryInterface(aDOMDocument); - if(!doc) return NS_ERROR_FAILURE; - - nsCOMPtr<nsIDOMHTMLCollection> col; - doc->GetLinks(getter_AddRefs(col)); - - PRUint32 count, i; - col->GetLength(&count); - for (i = 0; i < count; i++) - { - nsCOMPtr<nsIDOMNode> node; - col->Item(i, getter_AddRefs(node)); - if (!node) continue; - - nsCOMPtr<nsIDOMHTMLElement> element; - element = do_QueryInterface(node); - if (!element) continue; - - nsCOMPtr<nsIDOMHTMLAnchorElement> lnk; - lnk = do_QueryInterface(element); - if (!lnk) continue; - - LinkListItem *i = g_new0 (LinkListItem, 1); - - nsAutoString tmp; - - result = lnk->GetHref (tmp); - if (NS_SUCCEEDED(result)) - { - const nsACString &c = NS_ConvertUCS2toUTF8(tmp); - i->url = g_strdup (PromiseFlatCString(c).get()); - } - - result = lnk->GetRel (tmp); - if (NS_SUCCEEDED(result)) - { - const nsACString &c = NS_ConvertUCS2toUTF8(tmp); - i->rel = g_strdup (PromiseFlatCString(c).get()); - g_strdown (i->rel); - } - - if (!i->rel || strlen (i->rel) == 0) - { - result = lnk->GetRev (tmp); - if (NS_SUCCEEDED(result)) - { - const nsACString &c = NS_ConvertUCS2toUTF8(tmp); - i->rel = g_strdup (PromiseFlatCString(c).get()); - g_strdown (i->rel); - } - } - - i->title = mozilla_get_link_text (node); - if (i->title == NULL) - { - result = element->GetTitle (tmp); - if (NS_SUCCEEDED(result)) - { - const nsACString &c = NS_ConvertUCS2toUTF8(tmp); - i->title = gul_string_strip_newline (PromiseFlatCString(c).get()); - } - } - - - *ret = g_list_append (*ret, i); - } -#endif - return NS_OK; -} - -nsresult EphyWrapper::EvaluateJS (char *script) -{ - nsresult rv; - - nsCOMPtr<nsIDOMWindow> DOMWindow; - rv = mWebBrowser->GetContentDOMWindow(getter_AddRefs(DOMWindow)); - - nsCOMPtr<nsIScriptGlobalObject> globalObject; - globalObject = do_QueryInterface (DOMWindow); - if (!globalObject) return NS_ERROR_FAILURE; - - nsCOMPtr<nsIScriptContext> context; - rv = globalObject->GetContext(getter_AddRefs(context)); - if (NS_FAILED(rv) || !context) { - return NS_ERROR_FAILURE; - } - - context->SetProcessingScriptTag(PR_TRUE); - - PRBool isUndefined; - nsAutoString ret; - const nsAString &aScript = NS_ConvertUTF8toUCS2(script); - context->EvaluateString(aScript, nsnull, nsnull, nsnull, - 0, nsnull, - ret, &isUndefined); - - context->SetProcessingScriptTag(PR_FALSE); - - return NS_OK; -} - nsresult EphyWrapper::PushTargetDocument (nsIDOMDocument *domDoc) { mTargetDocument = domDoc; diff --git a/embed/mozilla/EphyWrapper.h b/embed/mozilla/EphyWrapper.h index 04379546c..0345ede30 100644 --- a/embed/mozilla/EphyWrapper.h +++ b/embed/mozilla/EphyWrapper.h @@ -62,7 +62,6 @@ public: nsresult GetMainDocumentUrl (nsCString &url); nsresult GetDocumentUrl (nsCString &url); - nsresult GetDocumentTitle (char **title); nsresult ReloadDocument (); nsresult LoadDocument(nsISupports *aPageDescriptor, PRUint32 aDisplayType); @@ -95,25 +94,8 @@ public: nsresult GetMainDOMDocument (nsIDOMDocument **aDOMDocument); - nsresult GetLinkInterfaceItems (GList **list); - - nsresult GetRealURL (nsCString &ret); - nsresult SelectAll (void); - nsresult ScrollUp (void); - nsresult ScrollDown (void); - nsresult ScrollLeft (void); - nsresult ScrollRight (void); - - nsresult FineScroll (int horiz, int vert); - - nsresult GetLastModified (gchar **ret); - nsresult GetImages (GList **ret); - nsresult GetForms (GList **ret); - nsresult GetLinks (GList **ret); - nsresult EvaluateJS (char *script); - nsresult PushTargetDocument (nsIDOMDocument *domDoc); nsresult PopTargetDocument (); diff --git a/embed/mozilla/Makefile.am b/embed/mozilla/Makefile.am index ef7ef9dfa..0bac73513 100644 --- a/embed/mozilla/Makefile.am +++ b/embed/mozilla/Makefile.am @@ -54,32 +54,22 @@ INCLUDES = \ noinst_LTLIBRARIES = libephymozillaembed.la libephymozillaembed_la_SOURCES = \ - mozilla-embed.cpp \ - mozilla-embed.h \ - mozilla-embed-shell.cpp \ - mozilla-embed-shell.h \ - mozilla-embed-persist.cpp \ - mozilla-embed-persist.h \ - mozilla-prefs.cpp \ - mozilla-prefs.h \ - mozilla-notifiers.cpp \ - mozilla-notifiers.h \ - mozilla-i18n.c \ - mozilla-i18n.h \ BaseProtocolHandler.cpp \ BaseProtocolHandler.h \ BaseProtocolContentHandler.cpp \ BaseProtocolContentHandler.h \ ContentHandler.cpp \ ContentHandler.h \ + EphyWrapper.cpp \ + EphyWrapper.h \ EventContext.cpp \ EventContext.h \ + ExternalProtocolService.cpp \ + ExternalProtocolService.h \ FilePicker.cpp \ FilePicker.h \ FtpProtocolHandler.cpp \ FtpProtocolHandler.h \ - EphyWrapper.cpp \ - EphyWrapper.h \ GlobalHistory.cpp \ GlobalHistory.h \ IRCProtocolHandler.cpp \ @@ -98,11 +88,21 @@ libephymozillaembed_la_SOURCES = \ PromptService.h \ ProgressListener.cpp \ ProgressListener.h \ - nsUnicharUtils.cpp \ - nsUnicharUtils.h \ - ExternalProtocolService.cpp \ - ExternalProtocolService.h \ StartHereProtocolHandler.cpp \ StartHereProtocolHandler.h \ EphyEventListener.cpp \ - EphyEventListener.h + EphyEventListener.h \ + mozilla-embed.cpp \ + mozilla-embed.h \ + mozilla-embed-persist.cpp \ + mozilla-embed-persist.h \ + mozilla-embed-shell.cpp \ + mozilla-embed-shell.h \ + mozilla-i18n.c \ + mozilla-i18n.h \ + mozilla-notifiers.cpp \ + mozilla-notifiers.h \ + mozilla-prefs.cpp \ + mozilla-prefs.h \ + nsUnicharUtils.cpp \ + nsUnicharUtils.h diff --git a/embed/mozilla/mozilla-embed-shell.cpp b/embed/mozilla/mozilla-embed-shell.cpp index 717985d45..8a66191b9 100644 --- a/embed/mozilla/mozilla-embed-shell.cpp +++ b/embed/mozilla/mozilla-embed-shell.cpp @@ -46,9 +46,7 @@ #include <nsIFontList.h> #include <nsISupportsPrimitives.h> #include <nsReadableUtils.h> -#include <nsIPermissionManager.h> #include <nsICookieManager.h> -#include <nsIPermission.h> #include <nsIPasswordManager.h> #include <nsIPassword.h> #include <nsICookie.h> @@ -92,19 +90,6 @@ impl_get_font_list (EphyEmbedShell *shell, GList **fontList, char **default_font); static gresult -impl_set_permission (EphyEmbedShell *shell, - const char *url, - PermissionType type, - gboolean allow); -static gresult -impl_list_permissions (EphyEmbedShell *shell, - PermissionType type, - GList **permissions); -static gresult -impl_remove_permissions (EphyEmbedShell *shell, - PermissionType type, - GList *permissions); -static gresult impl_list_cookies (EphyEmbedShell *shell, GList **cookies); static gresult @@ -191,9 +176,6 @@ mozilla_embed_shell_class_init (MozillaEmbedShellClass *klass) shell_class->get_charset_titles = impl_get_charset_titles; shell_class->get_charset_groups = impl_get_charset_groups; shell_class->get_font_list = impl_get_font_list; - shell_class->set_permission = impl_set_permission; - shell_class->list_permissions = impl_list_permissions; - shell_class->remove_permissions = impl_remove_permissions; shell_class->list_cookies = impl_list_cookies; shell_class->remove_cookies = impl_remove_cookies; shell_class->list_passwords = impl_list_passwords; @@ -533,7 +515,6 @@ impl_get_capabilities (EphyEmbedShell *shell, JAVA_CONSOLE_CAP | JS_CONSOLE_CAP | CHARSETS_CAP | - PERMISSIONS_CAP | COOKIES_CAP | PASSWORDS_CAP); @@ -777,95 +758,6 @@ impl_get_font_list (EphyEmbedShell *shell, } static gresult -impl_set_permission (EphyEmbedShell *shell, - const char *url, - PermissionType type, - gboolean allow) -{ - nsresult rv; - nsCOMPtr<nsIPermissionManager> permissionManager = - do_CreateInstance (NS_PERMISSIONMANAGER_CONTRACTID); - - rv = permissionManager->Add (nsDependentCString(url), - allow ? PR_TRUE : PR_FALSE, type); - if (NS_FAILED(rv)) return G_FAILED; - - return G_OK; -} - -static gresult -impl_list_permissions (EphyEmbedShell *shell, - PermissionType type, - GList **permissions) -{ - nsresult result; - - *permissions = NULL; - - nsCOMPtr<nsIPermissionManager> permissionManager = - do_CreateInstance (NS_PERMISSIONMANAGER_CONTRACTID); - nsCOMPtr<nsISimpleEnumerator> permissionEnumerator; - result = permissionManager->GetEnumerator (getter_AddRefs(permissionEnumerator)); - if (NS_FAILED(result)) return G_FAILED; - - PRBool enumResult; - for (permissionEnumerator->HasMoreElements(&enumResult) ; - enumResult == PR_TRUE ; - permissionEnumerator->HasMoreElements(&enumResult)) - { - nsCOMPtr<nsIPermission> nsPermission; - result = permissionEnumerator->GetNext (getter_AddRefs(nsPermission)); - if (NS_FAILED(result)) return G_FAILED; - - PRInt32 cType; - nsPermission->GetType (&cType); - if (cType == type) - { - PermissionInfo *b = g_new0 (PermissionInfo, 1); - gchar *tmp = NULL; - - nsPermission->GetHost (&tmp); - b->domain = g_strdup (tmp); - nsMemory::Free (tmp); - - PRBool cap; - nsPermission->GetCapability (&cap); - if (cap == PR_TRUE) - b->type = g_strdup (_("Allowed")); - else - b->type = g_strdup (_("Blocked")); - - *permissions = g_list_prepend (*permissions, b); - } - } - - *permissions = g_list_reverse (*permissions); - - return G_OK; -} - -static gresult -impl_remove_permissions (EphyEmbedShell *shell, - PermissionType type, - GList *permissions) -{ - nsresult result; - nsCOMPtr<nsIPermissionManager> permissionManager = - do_CreateInstance (NS_PERMISSIONMANAGER_CONTRACTID); - - for (GList *permissions = g_list_first(permissions); permissions != NULL; - permissions = g_list_next(permissions)) - { - PermissionInfo *b = (PermissionInfo *)permissions->data; - result = permissionManager->Remove (nsDependentCString(b->domain), - type); - if (NS_FAILED(result)) return G_FAILED; - }; - - return G_OK; -} - -static gresult impl_list_cookies (EphyEmbedShell *shell, GList **cookies) { @@ -894,7 +786,7 @@ impl_list_cookies (EphyEmbedShell *shell, nsCAutoString transfer; nsCookie->GetHost (transfer); - c->base.domain = g_strdup (transfer.get()); + c->domain = g_strdup (transfer.get()); nsCookie->GetName (transfer); c->name = g_strdup (transfer.get()); nsCookie->GetValue (transfer); @@ -938,7 +830,7 @@ impl_remove_cookies (EphyEmbedShell *shell, { CookieInfo *c = (CookieInfo *)cl->data; - result = cookieManager->Remove (NS_LITERAL_CSTRING(c->base.domain), + result = cookieManager->Remove (NS_LITERAL_CSTRING(c->domain), NS_LITERAL_CSTRING(c->name), NS_LITERAL_CSTRING(c->path), PR_FALSE); diff --git a/embed/mozilla/mozilla-embed.cpp b/embed/mozilla/mozilla-embed.cpp index d3d2277b0..66330db4a 100644 --- a/embed/mozilla/mozilla-embed.cpp +++ b/embed/mozilla/mozilla-embed.cpp @@ -93,7 +93,6 @@ impl_get_title (EphyEmbed *embed, static gresult impl_get_location (EphyEmbed *embed, gboolean toplevel, - gboolean requested, char **location); static gresult impl_reload (EphyEmbed *embed, @@ -102,12 +101,6 @@ static gresult impl_copy_page (EphyEmbed *dest, EphyEmbed *source, EmbedDisplayType display_type); -static gresult -impl_grab_focus (EphyEmbed *embed); -static gresult -impl_get_link_tags (EphyEmbed *embed, - const char *link_type, - GList **tags); static gresult impl_zoom_set (EphyEmbed *embed, int zoom, @@ -148,12 +141,6 @@ static gboolean impl_shistory_copy (EphyEmbed *source, EphyEmbed *dest); static gresult -impl_scroll (EphyEmbed *embed, - EmbedScrollDirection direction); -static gresult -impl_fine_scroll (EphyEmbed *embed, - int horiz, int vert); -static gresult impl_get_security_level (EphyEmbed *embed, EmbedSecurityLevel *level, char **description); @@ -325,8 +312,6 @@ ephy_embed_init (EphyEmbedClass *embed_class) embed_class->get_location = impl_get_location; embed_class->reload = impl_reload; embed_class->copy_page = impl_copy_page; - embed_class->grab_focus = impl_grab_focus; - embed_class->get_link_tags = impl_get_link_tags; embed_class->zoom_set = impl_zoom_set; embed_class->zoom_get = impl_zoom_get; embed_class->selection_can_cut = impl_selection_can_cut; @@ -340,8 +325,6 @@ ephy_embed_init (EphyEmbedClass *embed_class) embed_class->shistory_get_pos = impl_shistory_get_pos; embed_class->shistory_go_nth = impl_shistory_go_nth; embed_class->shistory_copy = impl_shistory_copy; - embed_class->scroll = impl_scroll; - embed_class->fine_scroll = impl_fine_scroll; embed_class->get_security_level = impl_get_security_level; embed_class->find = impl_find; embed_class->set_charset = impl_set_charset; @@ -462,8 +445,6 @@ impl_get_capabilities (EphyEmbed *embed, EMBED_ZOOM_CAP | EMBED_PRINT_CAP | EMBED_FIND_CAP | - EMBED_SCROLL_CAP | - EMBED_FINE_SCROLL_CAP | EMBED_SECURITY_CAP | EMBED_CHARSET_CAP | EMBED_SHISTORY_CAP ); @@ -523,7 +504,7 @@ impl_can_go_up (EphyEmbed *embed) char *s; gresult result; - if (ephy_embed_get_location (embed, TRUE, FALSE, &location) != G_OK) + if (ephy_embed_get_location (embed, TRUE, &location) != G_OK) return G_FAILED; g_return_val_if_fail (location != NULL, G_FAILED); if ((s = mozilla_embed_get_uri_parent (location)) != NULL) @@ -547,7 +528,7 @@ impl_get_go_up_list (EphyEmbed *embed, GSList **l) char *location; char *s; - if (ephy_embed_get_location (embed, TRUE, FALSE, &location) != G_OK) + if (ephy_embed_get_location (embed, TRUE, &location) != G_OK) return G_FAILED; g_return_val_if_fail (location != NULL, G_FAILED); @@ -586,7 +567,7 @@ impl_go_up (EphyEmbed *embed) char *uri; char *parent_uri; - ephy_embed_get_location (embed, TRUE, FALSE, &uri); + ephy_embed_get_location (embed, TRUE, &uri); g_return_val_if_fail (uri != NULL, G_FAILED); parent_uri = mozilla_embed_get_uri_parent (uri); @@ -708,7 +689,6 @@ impl_get_title (EphyEmbed *embed, static gresult impl_get_location (EphyEmbed *embed, gboolean toplevel, - gboolean requested, char **location) { char *l; @@ -726,25 +706,17 @@ impl_get_location (EphyEmbed *embed, return G_FAILED; } - /* FIXME !toplevel requested not implemented */ - if (toplevel) { l = gtk_moz_embed_get_location (GTK_MOZ_EMBED(embed)); } - else if (!toplevel) + else { rv = wrapper->GetDocumentUrl (url); l = (NS_SUCCEEDED (rv) && !url.IsEmpty()) ? g_strdup (url.get()) : NULL; } - else if (requested) - { - rv = wrapper->GetRealURL (url); - l = (NS_SUCCEEDED (rv) && !url.IsEmpty()) ? - g_strdup (url.get()) : NULL; - } *location = l; @@ -804,22 +776,6 @@ impl_copy_page (EphyEmbed *dest, return G_OK; } -static gresult -impl_grab_focus (EphyEmbed *embed) -{ - gtk_widget_grab_focus (GTK_BIN (embed)->child); - - return G_OK; -} - -static gresult -impl_get_link_tags (EphyEmbed *embed, - const char *link_type, - GList **tags) -{ - return G_NOT_IMPLEMENTED; -} - static gresult impl_zoom_set (EphyEmbed *embed, int zoom, @@ -1079,47 +1035,6 @@ impl_shistory_copy (EphyEmbed *source, } static gresult -impl_scroll (EphyEmbed *embed, - EmbedScrollDirection direction) -{ - EphyWrapper *wrapper; - - wrapper = MOZILLA_EMBED(embed)->priv->wrapper; - g_return_val_if_fail (wrapper != NULL, G_FAILED); - - switch (direction) - { - case EMBED_SCROLL_UP: - wrapper->ScrollUp (); - break; - case EMBED_SCROLL_DOWN: - wrapper->ScrollDown (); - break; - case EMBED_SCROLL_LEFT: - wrapper->ScrollLeft (); - break; - case EMBED_SCROLL_RIGHT: - wrapper->ScrollRight (); - break; - } - - return G_OK; -} - -static gresult -impl_fine_scroll (EphyEmbed *embed, int horiz, int vert) -{ - EphyWrapper *wrapper; - - wrapper = MOZILLA_EMBED(embed)->priv->wrapper; - g_return_val_if_fail (wrapper != NULL, G_FAILED); - - wrapper->FineScroll (horiz, vert); - - return G_OK; -} - -static gresult impl_get_security_level (EphyEmbed *embed, EmbedSecurityLevel *level, char **description) |