Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2110)

Unified Diff: chrome/browser/resources/apps_debugger/js/items_list.js

Issue 12317036: Add API in developerPrivate to allow/ disallow incognito mode. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: . Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/apps_debugger/js/items_list.js
diff --git a/chrome/browser/resources/apps_debugger/js/items_list.js b/chrome/browser/resources/apps_debugger/js/items_list.js
index 9494fa22bf1a233bc45a74d53f22d103b1d65f68..d96a3c2df826986a0883c4520ffbe66dccf5baa6 100644
--- a/chrome/browser/resources/apps_debugger/js/items_list.js
+++ b/chrome/browser/resources/apps_debugger/js/items_list.js
@@ -146,6 +146,9 @@ cr.define('apps_dev_tool', function() {
var description = node.querySelector('.extension-description span');
description.textContent = item.description;
+ // The 'allow in incognito' checkbox.
+ this.setAllowIncognitoCheckbox_(item, node);
+
// The 'allow file:// access' checkbox.
if (item.wants_file_access)
this.setAllowFileAccessCheckbox_(item, node);
@@ -291,6 +294,7 @@ cr.define('apps_dev_tool', function() {
fileAccess.addEventListener('click', function(e) {
chrome.developerPrivate.allowFileAccess(
item.id, !!e.target.checked, function(result) {
+ ItemsList.loadItemsInfo();
});
});
fileAccess.querySelector('input').checked = item.allow_file_access;
@@ -298,6 +302,26 @@ cr.define('apps_dev_tool', function() {
},
/**
+ * Sets the handler for the allow_incognito checkbox.
+ * @param {!Object} item A dictionary of item metadata.
+ * @param {HTMLElement} el HTML element containing all items.
+ * @private
+ */
+ setAllowIncognitoCheckbox_: function(item, el) {
+ var incognito = el.querySelector('.incognito-control');
Dan Beam 2013/02/21 01:14:28 nit: put this inside the if (item.allow_incognito)
Gaurav 2013/02/25 18:26:51 Done.
+ if (item.allow_incognito) {
+ incognito.addEventListener('change', function(e) {
+ chrome.developerPrivate.allowIncognito(
+ item.id, !!e.target.checked, function(result) {
+ ItemsList.loadItemsInfo();
+ });
+ });
+ incognito.querySelector('input').checked = item.incognito_enabled;
+ incognito.hidden = false;
+ }
+ },
+
+ /**
* Sets the active views link of an item. Clicking on the link
* opens devtools window to inspect.
* @param {!Object} item A dictionary of item metadata.

Powered by Google App Engine
This is Rietveld 408576698