Add disabled _initChromeExtension
authorRobert Sesek <rsesek@google.com>
Sat, 9 Jun 2012 21:47:05 +0000 (17:47 -0400)
committerRobert Sesek <rsesek@google.com>
Sat, 9 Jun 2012 21:47:05 +0000 (17:47 -0400)
core.js

diff --git a/core.js b/core.js
index 78937c6b0d0485342c645da27b30d22e0688307a..b1c96f90d8481a9315fc68c82c498086025c8658 100644 (file)
--- a/core.js
+++ b/core.js
@@ -70,6 +70,8 @@ SkeletonKey.prototype._init = function() {
   this._generateButton.onclick = this._onGenerate.bind(this);
 
   this._password.labels[0].onclick = this._selectPassword.bind(this);
+
+  this._initChromeExtension();
 };
 
 /**
@@ -141,3 +143,26 @@ SkeletonKey.prototype._selectPassword = function() {
   this._password.focus();
   this._password.select();
 };
+
+/**
+ * Initalizes the Chrome extension pieces if running inside chrome.
+ * @private
+ */
+SkeletonKey.prototype._initChromeExtension = function() {
+  return;
+  if (typeof chrome == 'undefined' || typeof chrome.extension == 'undefined')
+    return;
+
+  // getCurrent is undefined for backround pages. Need content script.
+  chrome.tabs.getCurrent(function (tab) {
+    if (tab == null)
+      return;
+
+    var url = tab.url;
+    if (url == null || url == "")
+      return;
+
+    var siteKey = url.search(/https?:\/\/(www.?|login|accounts?)\.(.*)\.(com?|net|org|edu|biz|info)?.*/);
+    console.log(siteKey);
+  });
+};