Skip to content
This repository was archived by the owner on Nov 6, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 37 additions & 21 deletions chromium/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,33 @@ var switchPlannerInfo = {};

// Is HTTPSe enabled, or has it been manually disabled by the user?
var isExtensionEnabled = true;
// The setBadgeText API has an abandoned bug: https://crbug.com/170413
chrome.browserAction.setBadgeText({ text: "" });

// Load prefs about whether http nowhere is on. Structure is:
// { httpNowhere: true/false }
var httpNowhereOn = false;
chrome.storage.sync.get({httpNowhere: false}, function(item) {
httpNowhereOn = item.httpNowhere;
setIconColor();
updateState();
});
chrome.storage.onChanged.addListener(function(changes, areaName) {
if (areaName === 'sync') {
for (var key in changes) {
if (key === 'httpNowhere') {
httpNowhereOn = changes[key].newValue;
setIconColor();
updateState();
}
}
}
});
chrome.tabs.onActivated.addListener(function() {
updateState();
});
chrome.windows.onFocusChanged.addListener(function() {
updateState();
});
chrome.webNavigation.onCompleted.addListener(function() {
updateState();
});

/**
* Load stored user rules
Expand Down Expand Up @@ -88,26 +95,35 @@ loadStoredUserRules();

/**
* Set the icon color correctly
* Depending on http-nowhere it should be red/default
* inactive: extension is enabled, but no rules were triggered on this page.
* blocking: extension is in "block all HTTP requests" mode.
* active: extension is enabled and rewrote URLs on this page.
* disabled: extension is disabled from the popup menu.
*/
var setIconColor = function() {
var newIconPath = httpNowhereOn ? './icon38-red.png' : './icon38.png';
chrome.browserAction.setIcon({
path: newIconPath
var updateState = function() {
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
if (!tabs || tabs.length === 0) {
return;
}
var applied = activeRulesets.getRulesets(tabs[0].id)
var iconState = "inactive";
if (!isExtensionEnabled) {
iconState = "disabled";
} else if (httpNowhereOn) {
iconState = "blocking";
} else if (applied) {
iconState = "active";
}
chrome.browserAction.setIcon({
path: {
"38": "icons/icon-" + iconState + "-38.png"
}
});
chrome.browserAction.setTitle({
title: "HTTPS Everywhere (" + iconState + ")"
});
});
};

/*
for (var v in localStorage) {
log(DBUG, "localStorage["+v+"]: "+localStorage[v]);
}

var rs = all_rules.potentiallyApplicableRulesets("www.google.com");
for (r in rs) {
log(DBUG, rs[r].name +": "+ rs[r].active);
log(DBUG, rs[r].name +": "+ rs[r].default_state);
}
*/

/**
* Adds a new user rule
Expand Down
2 changes: 1 addition & 1 deletion chromium/devtools.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
chrome.devtools.panels.create("HTTPS Everywhere",
"icon48.png",
"icons/icon-active-38.png",
"devtools-panel.html",
function(panel) {
}
Expand Down
1 change: 1 addition & 0 deletions chromium/icons/icon-active-128.png
1 change: 1 addition & 0 deletions chromium/icons/icon-active-38.png
1 change: 1 addition & 0 deletions chromium/icons/icon-active-48.png
1 change: 1 addition & 0 deletions chromium/icons/icon-blocking-38.png
1 change: 1 addition & 0 deletions chromium/icons/icon-disabled-38.png
1 change: 1 addition & 0 deletions chromium/icons/icon-inactive-38.png
48 changes: 24 additions & 24 deletions chromium/manifest.json
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
{
"author": {
"email": "eff.software.projects@gmail.com"
},
},
"background": {
"scripts": [
"rules.js",
"util.js",
"background.js",
"incognito-cache-clearing.js"
]
},
},
"browser_action": {
"default_icon": {
"38": "icon38.png"
},
"default_popup": "popup.html",
"38": "icons/icon-active-38.png"
},
"default_popup": "popup.html",
"default_title": "__MSG_about_ext_name__"
},
"default_locale": "en",
"description": "__MSG_about_ext_description__",
"devtools_page": "devtools.html",
"homepage_url": "https://www.eff.org/https-everywhere",
},
"default_locale": "en",
"description": "__MSG_about_ext_description__",
"devtools_page": "devtools.html",
"homepage_url": "https://www.eff.org/https-everywhere",
"icons": {
"128": "icon128.png",
"16": "icon16.png",
"48": "icon48.png"
},
"48": "icons/icon-active-48.png",
"128": "icons/icon-active-128.png"
},
"incognito": "spanning",
"manifest_version": 2,
"manifest_version": 2,
"minimum_chrome_version": "45",
"name": "__MSG_about_ext_name__",
"name": "__MSG_about_ext_name__",
"permissions": [
"webRequest",
"webRequestBlocking",
"tabs",
"cookies",
"storage",
"webNavigation",
"webRequest",
"webRequestBlocking",
"tabs",
"cookies",
"storage",
"<all_urls>"
],
"update_url": "https://www.eff.org/files/https-everywhere-chrome-updates.xml",
],
"update_url": "https://www.eff.org/files/https-everywhere-chrome-updates.xml",
"version": "2015.12.16"
}
}
4 changes: 2 additions & 2 deletions chromium/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,22 +86,22 @@ function updateEnabledDisabledUI() {
} else {
document.body.className = "disabled"
}
backgroundPage.updateState();
}

// Toggle extension enabled/disabled status
function toggleEnabledDisabled() {
if (backgroundPage.isExtensionEnabled) {
// User wants to disable us
backgroundPage.isExtensionEnabled = false;
chrome.browserAction.setBadgeText({ text: "OFF" });
} else {
// User wants to enable us
backgroundPage.isExtensionEnabled = true;
chrome.browserAction.setBadgeText({ text: "" });
}
updateEnabledDisabledUI();
// The extension state changed, so reload this tab.
chrome.tabs.reload();
window.close();
}

/**
Expand Down
Binary file added common/https-everywhere-banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added common/icons/icon-active-128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added common/icons/icon-active-16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added common/icons/icon-active-24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added common/icons/icon-active-38.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added common/icons/icon-active-48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added common/icons/icon-blocking-128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added common/icons/icon-blocking-16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added common/icons/icon-blocking-24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added common/icons/icon-blocking-38.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added common/icons/icon-blocking-48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added common/icons/icon-disabled-128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added common/icons/icon-disabled-16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added common/icons/icon-disabled-24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added common/icons/icon-disabled-38.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added common/icons/icon-disabled-48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added common/icons/icon-inactive-128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added common/icons/icon-inactive-16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added common/icons/icon-inactive-24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added common/icons/icon-inactive-38.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added common/icons/icon-inactive-48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion makecrx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ sed -e "s/VERSION/$VERSION/g" chromium/updates-master.xml > chromium/updates.xml

mkdir -p pkg/crx/rules
cd pkg/crx
cp -a ../../chromium/* .
rsync -aL ../../chromium/ ./
# Turn the Firefox translations into the appropriate Chrome format:
rm -rf _locales/
mkdir _locales/
Expand Down
2 changes: 1 addition & 1 deletion makexpi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ fi

# Prepare packages suitable for uploading to EFF and AMO, respectively.
[ -d pkg ] || mkdir pkg
rsync -a --delete --delete-excluded --exclude /chrome/content/rules src/ pkg/xpi-eff
rsync -aL --delete --delete-excluded --exclude /chrome/content/rules src/ pkg/xpi-eff
cp -a translations/* pkg/xpi-eff/chrome/locale/
rsync -a --delete pkg/xpi-eff/ pkg/xpi-amo
# The AMO version of the package cannot contain the updateKey or updateURL tags.
Expand Down
2 changes: 1 addition & 1 deletion src/chrome/content/observatory-popup.xul
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
onload="document.getElementById('ask-me-later').focus()"
>
<script type="application/x-javascript" src="observatory-xul.js" />
<image src="chrome://https-everywhere/skin/ssl-observatory-messy.jpg" />
<image src="chrome://https-everywhere/skin/https-everywhere-banner.png" />
<label style="padding:25px;">&ssl-observatory.popup.text;</label>

<commandgroup>
Expand Down
2 changes: 1 addition & 1 deletion src/chrome/content/observatory-preferences.xul
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<hbox flex="1">
<spacer flex="1" />
<image id="obs-title-logo"
src="chrome://https-everywhere/skin/ssl-observatory-messy.jpg" />
src="chrome://https-everywhere/skin/https-everywhere-banner.png" />
<spacer flex="1" />
</hbox>
<spacer flex="2" />
Expand Down
2 changes: 1 addition & 1 deletion src/chrome/content/observatory-warning.xul
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
onload="warning_populate(window.arguments[0])"
>
<script type="application/x-javascript" src="observatory-xul.js" />
<image src="chrome://https-everywhere/skin/ssl-observatory-messy.jpg" />
<image src="chrome://https-everywhere/skin/https-everywhere-banner.png" />
<vbox flex="1">
<vbox id="warning-container" flex="1">
<label style="padding:25px 25px 10px;">&ssl-observatory.warning.text;</label>
Expand Down
Loading