changeset 5:c01a64fefbf5 default tip

Added mock 'capability request' page.
author Atul Varma <varmaa@toolness.com>
date Fri, 07 Aug 2009 14:20:28 -0700
parents 1c02976d8809
children
files extension/content/css/base.css extension/content/request.html extension/modules/content-injector.js
diffstat 3 files changed, 48 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/extension/content/css/base.css	Fri Aug 07 14:20:28 2009 -0700
@@ -0,0 +1,18 @@
+body {
+    font-family: Helvetica;
+    font-size: 18pt;
+    background-color: #eeeeee;
+    text-align: center;
+}
+
+#content {
+    width: 640px;
+    margin: 0 auto;
+    text-align: left;
+}
+
+.button {
+    padding: 12pt;
+    color: white;
+    background-color: #222222;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/extension/content/request.html	Fri Aug 07 14:20:28 2009 -0700
@@ -0,0 +1,23 @@
+<html>
+<head>
+  <link rel="stylesheet" type="text/css" media="all"
+        href="css/base.css" />
+  <title>With Great Power Comes Great Responsibility.</title>
+</head>
+<body>
+<div id="content">
+<h1>With Great Power Comes Great Responsibility.</h1>
+<p>The page
+at <a href="file:///Users/varmaa/Documents/blah.html">file:///Users/varmaa/Documents/blah.html</a>
+would like the following superpowers:</p>
+<ul>
+  <li><b>Filesystem Access.</b> <i>Good</i> web pages will let you
+  edit files on your computer. <i>Evil</i> web pages will delete your
+  precious data.</li>
+</ul>
+<p>Will you grant these superpowers to the web page?</p>
+<br/>
+<span class="button">Sure.</span> <span class="button">No way!</span>
+</div>
+</body>
+</html>
--- a/extension/modules/content-injector.js	Thu Aug 06 17:18:45 2009 -0700
+++ b/extension/modules/content-injector.js	Fri Aug 07 14:20:28 2009 -0700
@@ -31,13 +31,18 @@
     if (oldNotification)
       nBox.removeNotification(oldNotification);
 
+    function onClickButton() {
+      // TODO: Implement a real callback.
+      const CAP_URI = "chrome://powerbox/content/request.html";
+      tabbrowser.selectedTab = tabbrowser.addTab(CAP_URI);
+    }
+
     nBox.appendNotification(REQUEST_BOX_TEXT,
                             REQUEST_BOX_NAME,
                             null,
                             nBox.PRIORITY_INFO_MEDIUM,
                             [{accessKey: null,
-                              // TODO: Implement a real callback.
-                              callback: function() {},
+                              callback: onClickButton,
                               label: REQUEST_BOX_BUTTON_TEXT,
                               popup: null}]);
   }