epiphany r8110 - trunk/embed/mozilla



Author: chpe
Date: Fri Mar 14 21:58:08 2008
New Revision: 8110
URL: http://svn.gnome.org/viewvc/epiphany?rev=8110&view=rev

Log:
Add a service to open the cert exception dialogue.


Added:
   trunk/embed/mozilla/ephyAddCertException.h
   trunk/embed/mozilla/ephyAddCertException.idl
   trunk/embed/mozilla/ephyAddCertException.js
   trunk/embed/mozilla/ephyAddCertException.xpt   (contents, props changed)

Added: trunk/embed/mozilla/ephyAddCertException.h
==============================================================================
--- (empty file)
+++ trunk/embed/mozilla/ephyAddCertException.h	Fri Mar 14 21:58:08 2008
@@ -0,0 +1,99 @@
+/*
+ * DO NOT EDIT.  THIS FILE IS GENERATED FROM ephyAddCertException.idl
+ */
+
+#ifndef __gen_ephyAddCertException_h__
+#define __gen_ephyAddCertException_h__
+
+
+#ifndef __gen_nsISupports_h__
+#include "nsISupports.h"
+#endif
+
+#ifndef __gen_nsIDOMWindow_h__
+#include "nsIDOMWindow.h"
+#endif
+
+#ifndef __gen_nsIDOMDocument_h__
+#include "nsIDOMDocument.h"
+#endif
+
+/* For IDL files that don't want to include root IDL files. */
+#ifndef NS_NO_VTABLE
+#define NS_NO_VTABLE
+#endif
+
+/* starting interface:    ephyAddCertException */
+#define EPHYADDCERTEXCEPTION_IID_STR "cfdca027-c2c7-446a-8031-4d0041ab9f1e"
+
+#define EPHYADDCERTEXCEPTION_IID \
+  {0xcfdca027, 0xc2c7, 0x446a, \
+    { 0x80, 0x31, 0x4d, 0x00, 0x41, 0xab, 0x9f, 0x1e }}
+
+class NS_NO_VTABLE ephyAddCertException : public nsISupports {
+ public: 
+
+  NS_DECLARE_STATIC_IID_ACCESSOR(EPHYADDCERTEXCEPTION_IID)
+
+  /* void showAddCertExceptionDialog (in nsIDOMDocument aDocument); */
+  NS_IMETHOD ShowAddCertExceptionDialog(nsIDOMDocument *aDocument) = 0;
+
+};
+
+  NS_DEFINE_STATIC_IID_ACCESSOR(ephyAddCertException, EPHYADDCERTEXCEPTION_IID)
+
+/* Use this macro when declaring classes that implement this interface. */
+#define NS_DECL_EPHYADDCERTEXCEPTION \
+  NS_IMETHOD ShowAddCertExceptionDialog(nsIDOMDocument *aDocument); 
+
+/* Use this macro to declare functions that forward the behavior of this interface to another object. */
+#define NS_FORWARD_EPHYADDCERTEXCEPTION(_to) \
+  NS_IMETHOD ShowAddCertExceptionDialog(nsIDOMDocument *aDocument) { return _to ShowAddCertExceptionDialog(aDocument); } 
+
+/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
+#define NS_FORWARD_SAFE_EPHYADDCERTEXCEPTION(_to) \
+  NS_IMETHOD ShowAddCertExceptionDialog(nsIDOMDocument *aDocument) { return !_to ? NS_ERROR_NULL_POINTER : _to->ShowAddCertExceptionDialog(aDocument); } 
+
+#if 0
+/* Use the code below as a template for the implementation class for this interface. */
+
+/* Header file */
+class _MYCLASS_ : public ephyAddCertException
+{
+public:
+  NS_DECL_ISUPPORTS
+  NS_DECL_EPHYADDCERTEXCEPTION
+
+  _MYCLASS_();
+
+private:
+  ~_MYCLASS_();
+
+protected:
+  /* additional members */
+};
+
+/* Implementation file */
+NS_IMPL_ISUPPORTS1(_MYCLASS_, ephyAddCertException)
+
+_MYCLASS_::_MYCLASS_()
+{
+  /* member initializers and constructor code */
+}
+
+_MYCLASS_::~_MYCLASS_()
+{
+  /* destructor code */
+}
+
+/* void showAddCertExceptionDialog (in nsIDOMDocument aDocument); */
+NS_IMETHODIMP _MYCLASS_::ShowAddCertExceptionDialog(nsIDOMDocument *aDocument)
+{
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+/* End of implementation class template. */
+#endif
+
+
+#endif /* __gen_ephyAddCertException_h__ */

Added: trunk/embed/mozilla/ephyAddCertException.idl
==============================================================================
--- (empty file)
+++ trunk/embed/mozilla/ephyAddCertException.idl	Fri Mar 14 21:58:08 2008
@@ -0,0 +1,8 @@
+#include "nsISupports.idl"
+#include "nsIDOMWindow.idl"
+#include "nsIDOMDocument.idl"
+
+[uuid(cfdca027-c2c7-446a-8031-4d0041ab9f1e)]
+interface ephyAddCertException : nsISupports {
+  void showAddCertExceptionDialog (in nsIDOMDocument aDocument);
+};

Added: trunk/embed/mozilla/ephyAddCertException.js
==============================================================================
--- (empty file)
+++ trunk/embed/mozilla/ephyAddCertException.js	Fri Mar 14 21:58:08 2008
@@ -0,0 +1,105 @@
+/*
+   1 # -*- Mode: javascript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+   2 # ***** BEGIN LICENSE BLOCK *****
+   3 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
+   4 #
+   5 # The contents of this file are subject to the Mozilla Public License Version
+   6 # 1.1 (the "License"); you may not use this file except in compliance with
+   7 # the License. You may obtain a copy of the License at
+   8 # http://www.mozilla.org/MPL/
+   9 #
+  10 # Software distributed under the License is distributed on an "AS IS" basis,
+  11 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+  12 # for the specific language governing rights and limitations under the
+  13 # License.
+  14 #
+  15 # The Original Code is mozilla.org code.
+  16 #
+  17 # The Initial Developer of the Original Code is
+  18 # Netscape Communications Corporation.
+  19 # Portions created by the Initial Developer are Copyright (C) 1998
+  20 # the Initial Developer. All Rights Reserved.
+  21 #
+  22 # Contributor(s):
+  23 #   Blake Ross <blake cs stanford edu>
+  24 #   David Hyatt <hyatt mozilla org>
+  25 #   Peter Annema <disttsc bart nl>
+  26 #   Dean Tessman <dean_tessman hotmail com>
+  27 #   Kevin Puetz <puetzk iastate edu>
+  28 #   Ben Goodger <ben netscape com>
+  29 #   Pierre Chanial <chanial noos fr>
+  30 #   Jason Eager <jce2 po cwru edu>
+  31 #   Joe Hewitt <hewitt netscape com>
+  32 #   Alec Flett <alecf netscape com>
+  33 #   Asaf Romano <mozilla mano sent com>
+  34 #   Jason Barnabe <jason_barnabe fastmail fm>
+  35 #   Peter Parente <parente cs unc edu>
+  36 #   Giorgio Maone <g maone informaction com>
+  37 #   Tom Germeau <tom germeau epigoon com>
+  38 #   Jesse Ruderman <jruderman gmail com>
+  39 #   Joe Hughes <joe retrovirus com>
+  40 #   Pamela Greene <pamg bugs gmail com>
+  41 #   Michael Ventnor <m ventnor gmail com>
+  42 #   Simon BÃnzli <zeniko gmail com>
+  43 #   Johnathan Nightingale <johnath mozilla com>
+  44 #   Ehsan Akhgari <ehsan akhgari gmail com>
+  45 #   DÃo Gottwald <dao mozilla com>
+  46 #
+  47 # Alternatively, the contents of this file may be used under the terms of
+  48 # either the GNU General Public License Version 2 or later (the "GPL"), or
+  49 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+  50 # in which case the provisions of the GPL or the LGPL are applicable instead
+  51 # of those above. If you wish to allow use of your version of this file only
+  52 # under the terms of either the GPL or the LGPL, and not to allow others to
+  53 # use your version of this file under the terms of the MPL, indicate your
+  54 # decision by deleting the provisions above and replace them with the notice
+  55 # and other provisions required by the GPL or the LGPL. If you do not delete
+  56 # the provisions above, a recipient may use your version of this file under
+  57 # the terms of any one of the MPL, the GPL or the LGPL.
+*/
+
+var Cc = Components.classes;
+var Ci = Components.interfaces;
+var Cu = Components.utils;
+
+Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+
+function ephyAddCertExceptionService() { }
+
+ephyAddCertExceptionService.prototype = {
+
+    classDescription: "ephyAddCertException dialogue",
+    contractID: "@gnome.org/epiphany/add-cert-exception;1",
+    classID: Components.ID("{f32ede25-4135-4896-834a-303326c553d4}"),
+    QueryInterface: XPCOMUtils.generateQI([Ci.ephyAddCertException]),
+
+    showAddCertExceptionDialog : function(aDocument) {
+        var params = { exceptionAdded : false };
+
+        try {
+            /*
+            switch (gPrefService.getIntPref("browser.ssl_override_behavior")) {
+                case 2 : // Pre-fetch & pre-populate
+                    params.prefetchCert = true;
+                case 1 : // Pre-populate
+                    params.location = aLocation.href;
+            }*/
+            params.location = aDocument.location.href;
+            params.prefetchCert = true;
+        } catch (e) {
+            Cu.reportError("Couldn't get ssl_override pref: " + e);
+        }
+
+        window.openDialog('chrome://pippki/content/exceptionDialog.xul',
+                          '','chrome,centerscreen,modal', params);
+
+        // If the user added the exception cert, attempt to reload the page
+        if (params.exceptionAdded)
+            aDocument.location.reload();
+    }
+};
+
+var component = [ephyAddCertExceptionService];
+function NSGetModule(compMgr, fileSpec) {
+    return XPCOMUtils.generateModule(component);
+}

Added: trunk/embed/mozilla/ephyAddCertException.xpt
==============================================================================
Binary file. No diff available.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]