Bug 248970 - Private Browsing mode (global toggle for saving/caching everything) [nsIPrivateBrowsingService interface]; r,sr=bzbarsky
authorEhsan Akhgari <ehsan.akhgari@gmail.com>
Mon, 20 Oct 2008 00:39:56 +0330
changeset 20635 ab63f0d13ea8
parent 20634 d84c0a032a2c
child 20636 53b78b1b3910
push id3021
push userehsan.akhgari@gmail.com
push date2008-10-19 21:18 +0000
Treeherderresults
reviewersbzbarsky
bugs248970
milestone1.9.1b2pre
Bug 248970 - Private Browsing mode (global toggle for saving/caching everything) [nsIPrivateBrowsingService interface]; r,sr=bzbarsky
netwerk/base/public/Makefile.in
netwerk/base/public/nsIPrivateBrowsingService.idl
netwerk/build/nsNetCID.h
--- a/netwerk/base/public/Makefile.in
+++ b/netwerk/base/public/Makefile.in
@@ -84,16 +84,17 @@ XPIDLSRCS	= \
 		nsIInputStreamChannel.idl \
                 nsIIOService2.idl \
 		nsIMIMEInputStream.idl \
                 nsINetworkLinkService.idl \
 		nsIPasswordManager.idl \
 		nsIPasswordManagerInternal.idl \
 		nsIPermission.idl \
 		nsIPermissionManager.idl \
+		nsIPrivateBrowsingService.idl \
 		nsIProgressEventSink.idl \
 		nsIPrompt.idl \
 		nsIProtocolProxyService.idl \
 		nsIProtocolProxyService2.idl \
 		nsIProtocolProxyFilter.idl \
 		nsIProtocolProxyCallback.idl \
 		nsIProxiedProtocolHandler.idl \
 		nsIProxyAutoConfig.idl \
new file mode 100644
--- /dev/null
+++ b/netwerk/base/public/nsIPrivateBrowsingService.idl
@@ -0,0 +1,77 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Private Browsing.
+ *
+ * The Initial Developer of the Original Code is
+ * Ehsan Akhgari.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Ehsan Akhgari <ehsan.akhgari@gmail.com> (Original Author)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "nsISupports.idl"
+
+[scriptable, uuid(d2943870-c781-11dc-95ff-0800200c9a66)]
+interface nsIPrivateBrowsingService : nsISupports
+{
+    // When read, determines whether the private browsing mode is currently
+    // active.  Setting to true enters the private browsing mode, and setting
+    // to false leaves the private browsing mode.
+    // Setting this value while handling one of the notifications generated
+    // by the private browsing service throws NS_ERROR_FAILURE.
+    attribute boolean privateBrowsingEnabled;
+};
+
+%{C++
+/**
+ * Private Browsing service notifications:
+ *
+ * - NS_PRIVATE_BROWSING_REQUEST_TOPIC:
+ *   The data parameter determines which kind of request this represents:
+ * --- NS_PRIVATE_BROWSING_ENTER:
+ *     We send this notification before switching to the private browsing mode.
+ *     The subject parameter is set to a nsISupportsPRBool, which observers can
+ *     set to true to prevent the switch to the private browsing mode.
+ * --- NS_PRIVATE_BROWSING_LEAVE:
+ *     We send this notification before leaving the private browsing mode.
+ *     The subject parameter is set to a nsISupportsPRBool, which observers can
+ *     set to true to prevent leaving the private browsing mode.
+ *
+ * - NS_PRIVATE_BROWSING_SWITCH_TOPIC:
+ *   The data parameter determines which kind of switch this represents:
+ * --- NS_PRIVATE_BROWSING_ENTER:
+ *     We send this notification while switching to the private browsing mode.
+ * --- NS_PRIVATE_BROWSING_LEAVE:
+ *     We send this notification while leaving the private browsing mode.
+ */
+#define NS_PRIVATE_BROWSING_SWITCH_TOPIC  "private-browsing"
+#define NS_PRIVATE_BROWSING_REQUEST_TOPIC "private-browsing-cancel-vote"
+#define NS_PRIVATE_BROWSING_ENTER         "enter"
+#define NS_PRIVATE_BROWSING_LEAVE         "exit"
+%}
--- a/netwerk/build/nsNetCID.h
+++ b/netwerk/build/nsNetCID.h
@@ -425,16 +425,27 @@
 #define NS_SAFELOCALFILEOUTPUTSTREAM_CID             \
 { /* a181af0d-68b8-4308-94db-d4f859058215 */         \
     0xa181af0d,                                      \
     0x68b8,                                          \
     0x4308,                                          \
     {0x94, 0xdb, 0xd4, 0xf8, 0x59, 0x05, 0x82, 0x15} \
 }
 
+// component implementing nsIPrivateBrowsingService
+#define NS_PRIVATE_BROWSING_SERVICE_CONTRACTID \
+    "@mozilla.org/privatebrowsing;1"
+#define NS_PRIVATE_BROWSING_SERVICE_CID              \
+{ /* c31f4883-839b-45f6-82ad-a6a9bc5ad599 */         \
+    0xc31f4883,                                      \
+    0x839b,                                          \
+    0x45f6,                                          \
+    {0x82, 0xad, 0xa6, 0xa9, 0xbc, 0x5a, 0xd5, 0x99} \
+}
+
 // component implementing nsIPrompt
 //
 // NOTE: this implementation does not have any way to correctly parent itself,
 //       it is almost always wrong to get a prompt via this interface.
 //       use nsIWindowWatcher instead whenever possible.
 //
 #define NS_DEFAULTPROMPT_CONTRACTID \
     "@mozilla.org/network/default-prompt;1"