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

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: rebase 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 4baefa1e043e2db69a6f61e202eea1f9868b4532..0dcc613367d0f40c54347ec2570962ba38c6a001 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);
@@ -315,6 +318,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) {
+ if (item.allow_incognito) {
+ var incognito = el.querySelector('.incognito-control');
+ incognito.addEventListener('change', function(e) {
+ chrome.developerPrivate.allowIncognito(
+ item.id, !!e.target.checked, function() {
+ 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.
« no previous file with comments | « chrome/browser/extensions/extension_function_histogram_value.h ('k') | chrome/browser/resources/apps_debugger/main.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698