diff options
author | Marco Pesenti Gritti <marco@gnome.org> | 2004-06-13 04:25:09 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <marco@src.gnome.org> | 2004-06-13 04:25:09 +0800 |
commit | b59ab61dde301128d88778045f502cc30008bf8f (patch) | |
tree | 57dd181d409b16ca5abe7d2bddac9c3c54219e95 /embed | |
parent | decb30ea6768b634476d351f3d5f5e73e4308326 (diff) | |
download | gsoc2013-epiphany-b59ab61dde301128d88778045f502cc30008bf8f.tar.gz gsoc2013-epiphany-b59ab61dde301128d88778045f502cc30008bf8f.tar.zst gsoc2013-epiphany-b59ab61dde301128d88778045f502cc30008bf8f.zip |
Add a way to open new windows passing features and uri. Something like js
2004-06-12 Marco Pesenti Gritti <marco@gnome.org>
* embed/ephy-embed-single.c: (ephy_embed_single_open_window):
* embed/ephy-embed-single.h:
* embed/ephy-embed.h:
* embed/mozilla/EphyBrowser.cpp:
* embed/mozilla/EphyBrowser.h:
* embed/mozilla/EventContext.cpp:
* embed/mozilla/mozilla-embed-single.cpp:
Add a way to open new windows passing features and uri.
Something like js window.open. It's necessary for popup
blocker.
Diffstat (limited to 'embed')
-rw-r--r-- | embed/ephy-embed-single.c | 10 | ||||
-rw-r--r-- | embed/ephy-embed-single.h | 12 | ||||
-rw-r--r-- | embed/ephy-embed.h | 2 | ||||
-rw-r--r-- | embed/mozilla/EphyBrowser.cpp | 9 | ||||
-rw-r--r-- | embed/mozilla/EphyBrowser.h | 1 | ||||
-rw-r--r-- | embed/mozilla/EventContext.cpp | 2 | ||||
-rw-r--r-- | embed/mozilla/mozilla-embed-single.cpp | 23 |
7 files changed, 54 insertions, 5 deletions
diff --git a/embed/ephy-embed-single.c b/embed/ephy-embed-single.c index 72891edf8..0ea626128 100644 --- a/embed/ephy-embed-single.c +++ b/embed/ephy-embed-single.c @@ -169,3 +169,13 @@ ephy_embed_single_get_font_list (EphyEmbedSingle *single, EphyEmbedSingleIface *iface = EPHY_EMBED_SINGLE_GET_IFACE (single); return iface->get_font_list (single, lang_group); } + +void +ephy_embed_single_open_window (EphyEmbedSingle *single, + EphyEmbed *parent, + const char *address, + const char *features) +{ + EphyEmbedSingleIface *iface = EPHY_EMBED_SINGLE_GET_IFACE (single); + return iface->open_window (single, parent, address, features); +} diff --git a/embed/ephy-embed-single.h b/embed/ephy-embed-single.h index f78910e90..3893a4aa8 100644 --- a/embed/ephy-embed-single.h +++ b/embed/ephy-embed-single.h @@ -21,8 +21,7 @@ #ifndef EPHY_EMBED_SINGLE_H #define EPHY_EMBED_SINGLE_H -#include <glib-object.h> -#include <glib.h> +#include "ephy-embed.h" G_BEGIN_DECLS @@ -48,6 +47,10 @@ struct _EphyEmbedSingleIface /* Methods */ + void (* open_window) (EphyEmbedSingle *single, + EphyEmbed *parent, + const char *address, + const char *features); void (* clear_cache) (EphyEmbedSingle *shell); void (* clear_auth_cache) (EphyEmbedSingle *shell); void (* set_offline_mode) (EphyEmbedSingle *shell, @@ -60,6 +63,11 @@ struct _EphyEmbedSingleIface GType ephy_embed_single_get_type (void); +void ephy_embed_single_open_window (EphyEmbedSingle *single, + EphyEmbed *parent, + const char *address, + const char *features); + void ephy_embed_single_clear_cache (EphyEmbedSingle *single); void ephy_embed_single_clear_auth_cache (EphyEmbedSingle *single); diff --git a/embed/ephy-embed.h b/embed/ephy-embed.h index b890222b7..e55152272 100644 --- a/embed/ephy-embed.h +++ b/embed/ephy-embed.h @@ -39,7 +39,7 @@ G_BEGIN_DECLS #define EPHY_TYPE_EMBED_CHROME_MASK (ephy_embed_chrome_get_type ()) -typedef struct _EphyEmbed EphyEmbed; /* dummy typedef */ +typedef struct _EphyEmbed EphyEmbed; typedef struct _EphyEmbedIface EphyEmbedIface; typedef enum diff --git a/embed/mozilla/EphyBrowser.cpp b/embed/mozilla/EphyBrowser.cpp index 066532790..2ca36a9bb 100644 --- a/embed/mozilla/EphyBrowser.cpp +++ b/embed/mozilla/EphyBrowser.cpp @@ -548,6 +548,15 @@ nsresult EphyBrowser::GetPageDescriptor(nsISupports **aPageDescriptor) return NS_OK; } +nsresult EphyBrowser::GetDOMWindow (nsIDOMWindow **aDOMWindow) +{ + NS_ENSURE_TRUE (mWebBrowser, NS_ERROR_FAILURE); + + NS_IF_ADDREF (*aDOMWindow = mDOMWindow); + + return NS_OK; +} + nsresult EphyBrowser::GetDocumentUrl (nsACString &url) { nsresult rv; diff --git a/embed/mozilla/EphyBrowser.h b/embed/mozilla/EphyBrowser.h index d8a6300bb..f2f034dd1 100644 --- a/embed/mozilla/EphyBrowser.h +++ b/embed/mozilla/EphyBrowser.h @@ -111,6 +111,7 @@ public: nsresult GetTargetDocument (nsIDOMDocument **aDOMDocument); nsresult GetDocumentUrl (nsACString &url); nsresult GetTargetDocumentUrl (nsACString &url); + nsresult GetDOMWindow (nsIDOMWindow **window); nsresult GetHasModifiedForms (PRBool *modified); diff --git a/embed/mozilla/EventContext.cpp b/embed/mozilla/EventContext.cpp index 5b815a756..656def8c8 100644 --- a/embed/mozilla/EventContext.cpp +++ b/embed/mozilla/EventContext.cpp @@ -177,8 +177,6 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget, { nsresult rv; - const PRUnichar bgLiteral[] = {'b', 'a', 'c', 'k', 'g', 'r', 'o', 'u', - 'n', 'd', '\0'}; const PRUnichar hrefLiteral[] = {'h', 'r', 'e', 'f', '\0'}; const PRUnichar typeLiteral[] = {'t', 'y', 'p', 'e', '\0'}; const PRUnichar xlinknsLiteral[] = {'h', 't', 't', 'p', ':', '/', '/','w', diff --git a/embed/mozilla/mozilla-embed-single.cpp b/embed/mozilla/mozilla-embed-single.cpp index 522767150..bf74c9305 100644 --- a/embed/mozilla/mozilla-embed-single.cpp +++ b/embed/mozilla/mozilla-embed-single.cpp @@ -40,6 +40,7 @@ #include "ephy-embed-prefs.h" #include "MozRegisterComponents.h" #include "EphySingle.h" +#include "EphyBrowser.h" #include "EphyUtils.h" #include <glib/gi18n.h> @@ -50,6 +51,7 @@ #include <nsEmbedString.h> #include <nsIPrefService.h> #include <nsIServiceManager.h> +#include <nsIWindowWatcher.h> #include <nsIIOService.h> #include <nsISupportsPrimitives.h> #include <nsICookieManager.h> @@ -838,6 +840,27 @@ impl_permission_manager_list (EphyPermissionManager *manager, return list; } +void +mozilla_embed_single_open_window (EphyEmbedSingle *single, + EphyEmbed *parent, + const char *address, + const char *features) +{ + nsCOMPtr<nsIDOMWindow> domWindow; + if (parent) + { + EphyBrowser *browser; + + browser = (EphyBrowser *) _mozilla_embed_get_ephy_browser (MOZILLA_EMBED(parent)); + g_return_if_fail (browser != NULL); + + browser->GetDOMWindow (getter_AddRefs (domWindow)); + } + + nsCOMPtr<nsIWindowWatcher> wWatch(do_GetService ("@mozilla.org/embedcomp/window-watcher;1")); + wWatch->OpenWindow (domWindow, address, "", features, nsnull, nsnull); +} + static void mozilla_embed_single_class_init (MozillaEmbedSingleClass *klass) { |