Chromium Code Reviews| Index: chrome/common/extensions/docs/examples/extensions/proxy_configuration/proxy_form_controller.js |
| diff --git a/chrome/common/extensions/docs/examples/extensions/proxy_configuration/proxy_form_controller.js b/chrome/common/extensions/docs/examples/extensions/proxy_configuration/proxy_form_controller.js |
| index 8a4fa192c22c50a3817fc3bb4fb09f1eb661dccb..9190944dd7e9547578cd97d2207ead47f2af6a42 100644 |
| --- a/chrome/common/extensions/docs/examples/extensions/proxy_configuration/proxy_form_controller.js |
| +++ b/chrome/common/extensions/docs/examples/extensions/proxy_configuration/proxy_form_controller.js |
| @@ -125,6 +125,12 @@ ProxyFormController.prototype = { |
| */ |
| config_: {regular: null, incognito: null}, |
| + /** |
| + * Do we have access to incognito mode? |
| + * @type {boolean} |
| + * @private |
| + */ |
| + isAllowedIncognitoAccess_: false, |
| /** |
| * @return {string} The PAC file URL (or an empty string). |
| @@ -323,10 +329,27 @@ ProxyFormController.prototype = { |
| * @private |
| */ |
| readCurrentState_: function() { |
| + chrome.extension.isAllowedIncognitoAccess( |
| + this.handleIncognitoAccessResponse_.bind(this)); |
| + }, |
| + |
| + /** |
| + * Handles the respnse from `chrome.extension.isAllowedIncognitoAccess` |
| + * We can't render the form until we know what our access level is, so |
| + * we wait until we have confirmed incognito access levels before |
| + * asking for the proxy state. |
| + * |
| + * @param {boolean} state The state of incognito access. |
| + * @private |
| + */ |
| + handleIncognitoAccessResponse_: function(state) { |
| + this.isAllowedIncognitoAccess_ = state; |
| chrome.experimental.proxy.settings.get({incognito: false}, |
| this.handleRegularState_.bind(this)); |
| - chrome.experimental.proxy.settings.get({incognito: true}, |
| - this.handleIncognitoState_.bind(this)); |
| + if (this.isAllowedIncognitoAccess_) { |
| + chrome.experimental.proxy.settings.get({incognito: true}, |
| + this.handleIncognitoState_.bind(this)); |
| + } |
| }, |
| /** |
| @@ -658,6 +681,9 @@ ProxyFormController.prototype = { |
| * @private |
| */ |
| recalcFormValues_: function(c) { |
| + var button = document.getElementsByTagName('button')[0]; |
| + button.style.display = this.isAllowedIncognitoAccess_ ? 'block' : 'none'; |
|
kurrik.chromium
2011/03/21 22:13:02
This button now wraps to another line. I think I
Mike West
2011/03/22 08:44:56
Done.
|
| + |
|
kurrik.chromium
2011/03/21 22:13:02
I think you could also add some UI indicating how
Mike West
2011/03/22 08:44:56
Fair enough. I've reworked this section entirely;
|
| // Normalize `auto_detect` |
| if (c.mode === 'auto_detect') |
| c.mode = 'pac_script'; |