From 7200cd97ba96357d050ba7015e54a16d421b63d0 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Mon, 24 Nov 2003 22:43:10 +0000 Subject: Implemented cookie and permissions observer used to actually send 2003-11-24 Christian Persch * embed/ephy-permission-manager.h: * embed/mozilla/EphyBrowser.cpp: * embed/mozilla/EphySingle.cpp: * embed/mozilla/EphySingle.h: * embed/mozilla/Makefile.am: * embed/mozilla/mozilla-embed-single.cpp: * src/ephy-encoding-dialog.c: (sync_embed_encoding), (automatic_toggled_cb), (ephy_encoding_dialog_init): Implemented cookie and permissions observer used to actually send notifications on EphyCookieManager and EphyPermissionManager signals. --- embed/mozilla/mozilla-embed-single.cpp | 97 ++++++++-------------------------- 1 file changed, 22 insertions(+), 75 deletions(-) (limited to 'embed/mozilla/mozilla-embed-single.cpp') diff --git a/embed/mozilla/mozilla-embed-single.cpp b/embed/mozilla/mozilla-embed-single.cpp index 7d9fe5070..55bac6535 100644 --- a/embed/mozilla/mozilla-embed-single.cpp +++ b/embed/mozilla/mozilla-embed-single.cpp @@ -39,6 +39,7 @@ #include "eel-gconf-extensions.h" #include "ephy-embed-prefs.h" #include "MozRegisterComponents.h" +#include "EphySingle.h" #include #include @@ -92,6 +93,8 @@ struct MozillaEmbedSinglePrivate /* monitor this widget for theme changes*/ GtkWidget *theme_window; + + EphySingle *mSingleObserver; }; static void mozilla_embed_single_class_init (MozillaEmbedSingleClass *klass); @@ -428,6 +431,17 @@ mozilla_init_chrome (void) return NS_OK; } +static void +mozilla_init_observer (MozillaEmbedSingle *single) +{ + single->priv->mSingleObserver = new EphySingle (); + + if (single->priv->mSingleObserver) + { + single->priv->mSingleObserver->Init (EPHY_EMBED_SINGLE (single)); + } +} + static gboolean init_services (MozillaEmbedSingle *single) { @@ -461,6 +475,8 @@ init_services (MozillaEmbedSingle *single) mozilla_register_external_protocols (); + mozilla_init_observer (single); + return TRUE; } @@ -477,6 +493,8 @@ mozilla_embed_single_init (MozillaEmbedSingle *mes) MOZILLA_PROFILE_FILE, NULL); + mes->priv->mSingleObserver = nsnull; + if (!init_services (mes)) { GtkWidget *dialog; @@ -589,61 +607,6 @@ impl_get_font_list (EphyEmbedSingle *shell, return g_list_reverse (l); } -static EphyCookie * -mozilla_cookie_to_ephy_cookie (nsICookie *keks) -{ - EphyCookie *cookie; - - cookie = ephy_cookie_new (); - - nsCAutoString transfer; - - keks->GetHost (transfer); - cookie->domain = g_strdup (transfer.get()); - keks->GetName (transfer); - cookie->name = g_strdup (transfer.get()); - keks->GetValue (transfer); - cookie->value = g_strdup (transfer.get()); - keks->GetPath (transfer); - cookie->path = g_strdup (transfer.get()); - - PRBool isSecure; - keks->GetIsSecure (&isSecure); - cookie->is_secure = isSecure != PR_FALSE; - - nsCookieStatus status; - keks->GetStatus (&status); - cookie->p3p_state = status; - - nsCookiePolicy policy; - keks->GetPolicy (&policy); - cookie->p3p_policy = policy; - - PRUint64 dateTime; - keks->GetExpires (&dateTime); - cookie->expires = dateTime; - -#if MOZILLA_SNAPSHOT > 9 - nsCOMPtr keks2 = do_QueryInterface (keks); - if (keks2) - { - - PRBool isSession; - keks2->GetIsSession (&isSession); - cookie->is_session = isSession != PR_FALSE; - - if (!isSession) - { - PRInt64 expiry; - keks2->GetExpiry (&expiry); - cookie->real_expires = expiry; - } - } -#endif - - return cookie; -} - static GList * impl_list_cookies (EphyCookieManager *manager) { @@ -892,29 +855,13 @@ impl_permission_manager_list (EphyPermissionManager *manager, if ((PRUint32) num == (PRUint32) type) #endif { - EphyPermissionInfo *info = g_new0 (EphyPermissionInfo, 1); + EphyPermissionInfo *info = + mozilla_permission_to_ephy_permission (perm); - info->type = type; - - nsCString host; - perm->GetHost(host); - info->host = g_strdup (host.get()); - - PRUint32 cap; - perm->GetCapability(&cap); - switch (cap) + if (info != NULL) { - case nsIPermissionManager::ALLOW_ACTION : - info->allowed = TRUE; - break; - case nsIPermissionManager::DENY_ACTION : - /* fallthrough */ - default : - info->allowed = FALSE; - break; + list = g_list_prepend (list, info); } - - list = g_list_prepend (list, info); } } -- cgit v1.2.3