diff options
author | Eric Butler <eric@extremeboredom.net> | 2006-12-18 03:17:36 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2006-12-18 03:17:36 +0800 |
commit | f509a34254a254348465dbe018c6ee9db081193e (patch) | |
tree | f6ce0dbc582fa603779bf6fc055a876f9b082bf3 /embed/mozilla | |
parent | 25a74360022714d8dcb51b1c306069255da92079 (diff) | |
download | gsoc2013-epiphany-f509a34254a254348465dbe018c6ee9db081193e.tar gsoc2013-epiphany-f509a34254a254348465dbe018c6ee9db081193e.tar.gz gsoc2013-epiphany-f509a34254a254348465dbe018c6ee9db081193e.tar.bz2 gsoc2013-epiphany-f509a34254a254348465dbe018c6ee9db081193e.tar.lz gsoc2013-epiphany-f509a34254a254348465dbe018c6ee9db081193e.tar.xz gsoc2013-epiphany-f509a34254a254348465dbe018c6ee9db081193e.tar.zst gsoc2013-epiphany-f509a34254a254348465dbe018c6ee9db081193e.zip |
Add search_link entry to _EphyEmbedIface
2006-12-17 Eric Butler <eric@extremeboredom.net>
* src/ephy-embed.h:
Add search_link entry to _EphyEmbedIface
* src/ephy-embed.c:
Add ge-search-link signal
* embed/mozilla/EphyBrowser.cs:
Fire ge-search-link signal for opensearch tags
Diffstat (limited to 'embed/mozilla')
-rw-r--r-- | embed/mozilla/EphyBrowser.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/embed/mozilla/EphyBrowser.cpp b/embed/mozilla/EphyBrowser.cpp index aba1645eb..a233279a3 100644 --- a/embed/mozilla/EphyBrowser.cpp +++ b/embed/mozilla/EphyBrowser.cpp @@ -221,6 +221,39 @@ EphyDOMLinkEventListener::HandleEvent (nsIDOMEvent* aDOMEvent) /* ok, we accept this as a valid favicon for this site */ g_signal_emit_by_name (mOwner->mEmbed, "ge_favicon", spec.get()); } + else if (g_ascii_strcasecmp (rel.get (), "search") == 0) + { + linkElement->GetAttribute (NS_LITERAL_STRING ("type"), value); + + nsCString cTypeVal; + NS_UTF16ToCString (value, NS_CSTRING_ENCODING_UTF8, cTypeVal); + + if (g_ascii_strcasecmp (cTypeVal.get (), + "application/opensearchdescription+xml") == 0) + { + rv = linkElement->GetAttribute (NS_LITERAL_STRING ("href"), value); + if (NS_FAILED (rv) || !value.Length()) return NS_ERROR_FAILURE; + + nsCString cLink; + NS_UTF16ToCString (value, NS_CSTRING_ENCODING_UTF8, cLink); + + nsCOMPtr<nsIURI> docUri; + rv = GetDocURI (linkElement, getter_AddRefs (docUri)); + NS_ENSURE_TRUE (NS_SUCCEEDED (rv) && docUri, NS_ERROR_FAILURE); + + nsCString resolvedLink; + rv = docUri->Resolve (cLink, resolvedLink); + NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE); + + linkElement->GetAttribute (NS_LITERAL_STRING ("title"), value); + + nsCString cTitle; + NS_UTF16ToCString (value, NS_CSTRING_ENCODING_UTF8, cTitle); + + g_signal_emit_by_name (mOwner->mEmbed, "ge_search_link", + cTypeVal.get(), cTitle.get(), resolvedLink.get()); + } + } else if (g_ascii_strcasecmp (rel.get (), "alternate") == 0) { linkElement->GetAttribute (NS_LITERAL_STRING ("type"), value); |