[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r20275: {} forgotten files from last commit (torbutton/branches/gsoc2009-koryk/src/chrome/content)
Author: koryk
Date: 2009-08-12 17:14:49 -0400 (Wed, 12 Aug 2009)
New Revision: 20275
Added:
torbutton/branches/gsoc2009-koryk/src/chrome/content/torcookie.js
torbutton/branches/gsoc2009-koryk/src/chrome/content/torcookiedialog.xul
Log:
forgotten files from last commit
Added: torbutton/branches/gsoc2009-koryk/src/chrome/content/torcookie.js
===================================================================
--- torbutton/branches/gsoc2009-koryk/src/chrome/content/torcookie.js (rev 0)
+++ torbutton/branches/gsoc2009-koryk/src/chrome/content/torcookie.js 2009-08-12 21:14:49 UTC (rev 20275)
@@ -0,0 +1,82 @@
+var cookiesTree = null;
+var prefs = null;
+var cookies = [];
+var protectedcookies = [];
+//custom tree view, this is how we dynamically add the cookies
+var cookiesTreeView = {
+ rowCount : 0,
+ setTree : function(tree){},
+ getImageSrc : function(row,column) {},
+ getProgressMode : function(row,column) {},
+ getCellValue : function(row,column) {},
+ getCellText : function(row,column){
+ var rv="";
+ switch (column.id) {
+ case "domainCol" : rv = cookies[row].rawHost; break;
+ case "nameCol" : rv = cookies[row].name; break;
+ case "lockCol" : rv = cookies[row].isProtected;
+ }
+ return rv;
+ },
+ isSeparator : function(index) {return false;},
+ isSorted: function() { return false; },
+ isContainer : function(index) {return false;},
+ cycleHeader : function(column, aElt) {},
+ getRowProperties : function(row,column,prop){},
+ getColumnProperties : function(column,columnElement,prop){},
+ getCellProperties : function(row,column,prop) {}
+ };
+
+function Cookie(number,name,value,isDomain,host,rawHost,path,isSecure,expires,
+ isProtected) {
+ this.number = number;
+ this.name = name;
+ this.value = value;
+ this.isDomain = isDomain;
+ this.host = host;
+ this.rawHost = rawHost;
+ this.path = path;
+ this.isSecure = isSecure;
+ this.expires = expires;
+ this.isProtected = isProtected;
+}
+
+function initDialog() {
+ cookiesTree = document.getElementById("cookiesTree");
+ prefs =Components.classes["@mozilla.org/preferences-service;1"]
+ .getService(Components.interfaces.nsIPrefBranch);
+ var tor_enabled = prefs.getBoolPref("extensions.torbutton.tor_enabled");
+ //init cookie manager
+ var cookiemanager = Components.classes["@mozilla.org/cookiemanager;1"].getService();
+ cookiemanager = cookiemanager.QueryInterface(Components.interfaces.nsICookieManager);
+ var enumerator = cookiemanager.enumerator;
+ var count = 0;
+ while (enumerator.hasMoreElements()) {
+ var nextCookie = enumerator.getNext();
+ if (!nextCookie) break;
+ nextCookie = nextCookie.QueryInterface(Components.interfaces.nsICookie);
+ var host = nextCookie.host;
+ var isProt = checkIfProtected(nextCookie.name, host, nextCookie.path);
+ //populate list
+ cookies[count] =
+ new Cookie(count++, nextCookie.name, nextCookie.value, nextCookie.isDomain, host,
+ (host.charAt(0)==".") ? host.substring(1,host.length) : host,
+ nextCookie.path, nextCookie.isSecure, nextCookie.expires,
+ isProt);
+ }
+ //apply custom view
+ cookiesTreeView.rowCount = cookies.length;
+ cookiesTree.treeBoxObject.view = cookiesTreeView;
+
+ //grab data from xml files
+ //add protected tag
+}
+function checkIfProtected(name, host, path)
+{
+
+ return false;
+}
+function itemSelected() {
+ var item = document.getElementById("cookiesTree").selectedItemIndex;
+
+}
\ No newline at end of file
Added: torbutton/branches/gsoc2009-koryk/src/chrome/content/torcookiedialog.xul
===================================================================
--- torbutton/branches/gsoc2009-koryk/src/chrome/content/torcookiedialog.xul (rev 0)
+++ torbutton/branches/gsoc2009-koryk/src/chrome/content/torcookiedialog.xul 2009-08-12 21:14:49 UTC (rev 20275)
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://torbutton/skin/torbutton.css" type="text/css"?>
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+
+<!DOCTYPE overlay SYSTEM "chrome://torbutton/locale/torbutton.dtd">
+
+<dialog id="TorCookieDialog"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ title="Manage Cookies"
+ buttons="accept,cancel"
+ style="width: 30em;"
+ onload="initDialog();"
+ ondialogaccept="return;"
+ persist="screenX screenY width height">
+ <script src="chrome://torbutton/content/torbutton.js" type="application/x-javascript"/>
+ <script src="chrome://torbutton/content/torcookie.js" type="application/x-javascript"/>
+ <stringbundleset id="torbutton-stringbundleset">
+ <stringbundle id="torbutton-bundle" src="chrome://torbutton/locale/torbutton.properties"/>
+ </stringbundleset>
+
+ <label value=""/>
+ <separator class="thin"/>
+ <vbox flex="1">
+ <tree id="cookiesTree" flex="1" style="height: 10em;"
+ onkeypress="return;//do this later"
+ onselect="itemSelected();"
+ hidecolumnpicker="true">
+ <treecols>
+ <treecol id="lockCol" label="Protected" flex="1"
+ onclick="CookieColumnSort('isProtected', true);" persist="width"/>
+ <splitter class="tree-splitter"/>
+ <treecol id="domainCol" label="Host" flex="2"
+ onclick="CookieColumnSort('rawHost', true);" persist="width"/>
+ <splitter class="tree-splitter"/>
+ <treecol id="nameCol" label="Name" flex="1"
+ onclick="CookieColumnSort('name', true);" persist="width"/>
+ </treecols>
+ <treechildren/>
+ </tree>
+ </vbox>
+</dialog>