diff options
16 files changed, 74 insertions, 45 deletions
diff --git a/chrome/browser/extensions/extension_content_settings_apitest.cc b/chrome/browser/extensions/extension_content_settings_apitest.cc index f16fdff..db3d481 100644 --- a/chrome/browser/extensions/extension_content_settings_apitest.cc +++ b/chrome/browser/extensions/extension_content_settings_apitest.cc @@ -40,6 +40,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, IncognitoContentSettings) { // Setting an incognito preference should not create an incognito profile. EXPECT_FALSE(browser()->profile()->HasOffTheRecordProfile()); + // TODO(battre): re-enable when incognito is available again. +#if 0 PrefService* otr_prefs = browser()->profile()->GetOffTheRecordProfile()->GetPrefs(); const PrefService::Preference* pref = @@ -52,6 +54,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, IncognitoContentSettings) { ASSERT_TRUE(pref); EXPECT_FALSE(pref->IsExtensionControlled()); EXPECT_FALSE(prefs->GetBoolean(prefs::kBlockThirdPartyCookies)); +#endif } IN_PROC_BROWSER_TEST_F(ExtensionApiTest, IncognitoDisabledContentSettings) { diff --git a/chrome/browser/extensions/extension_preference_api.cc b/chrome/browser/extensions/extension_preference_api.cc index 48b40e6..a45e5b6 100644 --- a/chrome/browser/extensions/extension_preference_api.cc +++ b/chrome/browser/extensions/extension_preference_api.cc @@ -38,7 +38,8 @@ const char kIncognitoSpecific[] = "incognitoSpecific"; const char kLevelOfControl[] = "levelOfControl"; const char kValue[] = "value"; -const char kOnPrefChangeFormat[] = "experimental.preferences.%s.onChange"; +const char kOnPrefChangeFormat[] = + "experimental.preferences.%s.onChange"; const char kIncognitoErrorMessage[] = "You do not have permission to access incognito preferences."; @@ -346,8 +347,10 @@ bool SetPreferenceFunction::RunImpl() { EXTENSION_FUNCTION_VALIDATE(details->Get(kValue, &value)); bool incognito = false; - if (details->HasKey(kIncognito)) - EXTENSION_FUNCTION_VALIDATE(details->GetBoolean(kIncognito, &incognito)); + + // TODO(battre): enable incognito preferences again. + // if (details->HasKey(kIncognito)) + // EXTENSION_FUNCTION_VALIDATE(details->GetBoolean(kIncognito, &incognito)); if (incognito && !include_incognito()) { error_ = kIncognitoErrorMessage; @@ -395,8 +398,10 @@ bool ClearPreferenceFunction::RunImpl() { EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &details)); bool incognito = false; - if (details->HasKey(kIncognito)) - EXTENSION_FUNCTION_VALIDATE(details->GetBoolean(kIncognito, &incognito)); + + // TODO(battre): enable incognito preferences again. + // if (details->HasKey(kIncognito)) + // EXTENSION_FUNCTION_VALIDATE(details->GetBoolean(kIncognito, &incognito)); // We don't check incognito permissions here, as an extension should be always // allowed to clear its own settings. diff --git a/chrome/browser/extensions/extension_proxy_apitest.cc b/chrome/browser/extensions/extension_proxy_apitest.cc index 174be30..364fa31 100644 --- a/chrome/browser/extensions/extension_proxy_apitest.cc +++ b/chrome/browser/extensions/extension_proxy_apitest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -190,8 +190,9 @@ IN_PROC_BROWSER_TEST_F(ProxySettingsApiTest, ProxyFixedIndividual) { } // Tests setting values only for incognito mode +// TODO(battre): re-enable when incognito is supported again IN_PROC_BROWSER_TEST_F(ProxySettingsApiTest, - ProxyFixedIndividualIncognitoOnly) { + DISABLED_ProxyFixedIndividualIncognitoOnly) { CommandLine::ForCurrentProcess()->AppendSwitch( switches::kEnableExperimentalExtensionApis); @@ -216,8 +217,9 @@ IN_PROC_BROWSER_TEST_F(ProxySettingsApiTest, } // Tests setting values also for incognito mode +// TODO(battre): re-enable when incognito is supported again IN_PROC_BROWSER_TEST_F(ProxySettingsApiTest, - ProxyFixedIndividualIncognitoAlso) { + DISABLED_ProxyFixedIndividualIncognitoAlso) { CommandLine::ForCurrentProcess()->AppendSwitch( switches::kEnableExperimentalExtensionApis); diff --git a/chrome/common/extensions/api/extension_api.json b/chrome/common/extensions/api/extension_api.json index f69c49d..5b76600 100644 --- a/chrome/common/extensions/api/extension_api.json +++ b/chrome/common/extensions/api/extension_api.json @@ -5382,10 +5382,11 @@ "description": "The value of the preference. <br>Note that every preference has a specific value type, which is described together with the preference. An extension should <em>not</em> set a preference value of a different type.", "type": "any" }, - "incognito": { - "type": "boolean", + "scope": { + "type": "string", + "enum": ["regular"], "optional": true, - "description": "Whether to modify the setting for the incognito session only (default false)." + "description": "Where to set the preference (default: regular). 'regular' = preference for regular profile (which is inherited by the incognito profile if not overridden elsewhere)." } } }, @@ -5406,12 +5407,13 @@ { "name": "details", "type": "object", - "description": "What setting to clear.", + "description": "What preference to clear.", "properties": { - "incognito": { - "type": "boolean", + "scope": { + "type": "string", + "enum": ["regular"], "optional": true, - "description": "Whether to clear the setting for the incognito session only (default false)." + "description": "Where to clear the preference (default: regular). 'regular' = preference for regular profile (which is inherited by the incognito profile if not overridden elsewhere)." } } }, diff --git a/chrome/common/extensions/docs/examples/extensions/proxy_configuration.zip b/chrome/common/extensions/docs/examples/extensions/proxy_configuration.zip Binary files differindex fa7b74b..519a08a 100644 --- a/chrome/common/extensions/docs/examples/extensions/proxy_configuration.zip +++ b/chrome/common/extensions/docs/examples/extensions/proxy_configuration.zip diff --git a/chrome/common/extensions/docs/examples/extensions/proxy_configuration/popup.html b/chrome/common/extensions/docs/examples/extensions/proxy_configuration/popup.html index 9152e24..041da4c 100644 --- a/chrome/common/extensions/docs/examples/extensions/proxy_configuration/popup.html +++ b/chrome/common/extensions/docs/examples/extensions/proxy_configuration/popup.html @@ -168,6 +168,10 @@ font-size: 1.1em; } + button[value="incognito"] { + display: none; + } + .overlay { display: block; text-align: center; 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 796d7b0..3350cf3 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 @@ -100,7 +100,9 @@ ProxyFormController.WrappedProxyConfig; * @static */ ProxyFormController.getPersistedSettings = function() { - var result = JSON.parse(window.localStorage['proxyConfig']); + var result = null; + if (window.localStorage['proxyConfig'] !== undefined) + result = JSON.parse(window.localStorage['proxyConfig']); return result ? result : null; }; @@ -353,7 +355,8 @@ ProxyFormController.prototype = { }, /** - * Handles the response from 'proxy.settings.get' for regular settings. + * Handles the response from 'proxy.settings.get' for regular + * settings. * * @param {ProxyFormController.WrappedProxyConfig} c The proxy data and * extension's level of control thereof. @@ -370,7 +373,8 @@ ProxyFormController.prototype = { }, /** - * Handles the response from 'proxy.settings.get' for incognito settings. + * Handles the response from 'proxy.settings.get' for incognito + * settings. * * @param {ProxyFormController.WrappedProxyConfig} c The proxy data and * extension's level of control thereof. @@ -505,7 +509,7 @@ ProxyFormController.prototype = { this.config_.regular = this.generateProxyConfig_(); chrome.experimental.proxy.settings.set( - {value: this.config_.regular, incognito: false}, + {value: this.config_.regular, scope: 'regular'}, this.callbackForRegularSettings_.bind(this)); }, @@ -521,9 +525,10 @@ ProxyFormController.prototype = { return; } if (this.config_.incognito) { - chrome.experimental.proxy.settings.set( - {value: this.config_.incognito, incognito: true}, - this.callbackForIncognitoSettings_.bind(this)); + // TODO(battre): change incognito value once available + // chrome.experimental.proxy.settings.set( + // {value: this.config_.incognito, scope: 'incognito'}, + // this.callbackForIncognitoSettings_.bind(this)); } else { ProxyFormController.setPersistedSettings(this.config_); this.generateAlert_(chrome.i18n.getMessage('successfullySetProxy')); diff --git a/chrome/common/extensions/docs/examples/extensions/proxy_configuration/test/proxy_form_controller_test.js b/chrome/common/extensions/docs/examples/extensions/proxy_configuration/test/proxy_form_controller_test.js index b577cb6..d56a2fc 100644 --- a/chrome/common/extensions/docs/examples/extensions/proxy_configuration/test/proxy_form_controller_test.js +++ b/chrome/common/extensions/docs/examples/extensions/proxy_configuration/test/proxy_form_controller_test.js @@ -136,9 +136,8 @@ var proxyform = new Test.Unit.Runner({ }, // On instantiation, ProxyFormController should read the current state - // from `chrome.experimental.getCurrentProxySettings`, and react - // accordingly. Let's see if that happens with the next four sets of - // assertsions. + // from `chrome.experimental.proxy.get`, and react accordingly. + // Let's see if that happens with the next four sets of assertsions. testSetupFormSystem: function() { chrome.experimental.proxy.settings.get = mockFunctionFactory({ value: {mode: 'system'}, diff --git a/chrome/common/extensions/docs/experimental.extension.html b/chrome/common/extensions/docs/experimental.extension.html index 8665e10..bb92fd8 100644 --- a/chrome/common/extensions/docs/experimental.extension.html +++ b/chrome/common/extensions/docs/experimental.extension.html @@ -585,7 +585,7 @@ <dd class="todo" style="display: none; "> Undocumented. </dd> - <dd>What setting to clear.</dd> + <dd>What preference to clear.</dd> <dd style="display: none; "> This parameter was added in version <b><span></span></b>. @@ -602,14 +602,14 @@ <div> <div> <dt> - <var>incognito</var> + <var>scope</var> <em> <!-- TYPE --> <div style="display:inline"> ( <span class="optional">optional</span> - <span class="enum" style="display: none; ">enumerated</span> + <span class="enum">enumerated</span> <span id="typeTemplate"> <span style="display: none; "> <a> Type</a> @@ -618,8 +618,8 @@ <span style="display: none; "> array of <span><span></span></span> </span> - <span>boolean</span> - <span style="display: none; "></span> + <span>string</span> + <span>["regular"]</span> </span> </span> ) @@ -630,7 +630,7 @@ <dd class="todo" style="display: none; "> Undocumented. </dd> - <dd>Whether to clear the setting for the incognito session only (default false).</dd> + <dd>Where to clear the preference (default: regular). 'regular' = preference for regular profile (which is inherited by the incognito profile if not overridden elsewhere).</dd> <dd style="display: none; "> This parameter was added in version <b><span></span></b>. @@ -1464,14 +1464,14 @@ </div><div> <div> <dt> - <var>incognito</var> + <var>scope</var> <em> <!-- TYPE --> <div style="display:inline"> ( <span class="optional">optional</span> - <span class="enum" style="display: none; ">enumerated</span> + <span class="enum">enumerated</span> <span id="typeTemplate"> <span style="display: none; "> <a> Type</a> @@ -1480,8 +1480,8 @@ <span style="display: none; "> array of <span><span></span></span> </span> - <span>boolean</span> - <span style="display: none; "></span> + <span>string</span> + <span>["regular"]</span> </span> </span> ) @@ -1492,7 +1492,7 @@ <dd class="todo" style="display: none; "> Undocumented. </dd> - <dd>Whether to modify the setting for the incognito session only (default false).</dd> + <dd>Where to set the preference (default: regular). 'regular' = preference for regular profile (which is inherited by the incognito profile if not overridden elsewhere).</dd> <dd style="display: none; "> This parameter was added in version <b><span></span></b>. diff --git a/chrome/common/extensions/docs/experimental.proxy.html b/chrome/common/extensions/docs/experimental.proxy.html index 4010576..20867e8 100644 --- a/chrome/common/extensions/docs/experimental.proxy.html +++ b/chrome/common/extensions/docs/experimental.proxy.html @@ -563,7 +563,7 @@ apply to regular and incognito windows. } }; chrome.experimental.proxy.settings.set( - {'value': config, 'incognito': false}, + {value: config, scope: 'regular'}, function() {}); </pre> @@ -582,7 +582,7 @@ The following code sets a custom pac script. } }; chrome.experimental.proxy.settings.set( - {'value': config, 'incognito': false}, + {value: config, scope: 'regular'}, function() {}); </pre> diff --git a/chrome/common/extensions/docs/samples.json b/chrome/common/extensions/docs/samples.json index 1b44c34..ccd354c 100644 --- a/chrome/common/extensions/docs/samples.json +++ b/chrome/common/extensions/docs/samples.json @@ -1561,7 +1561,7 @@ "test\/proxy_form_controller_test.js", "test\/unittest.css" ], - "source_hash": "7b3ff4599334eaa9f50aa70940bb5dead970665f", + "source_hash": "d4a52c15b1e5c8be5b26fe9305cf4aae0f2b0cc3", "zip_path": "examples\/extensions\/proxy_configuration.zip" }, { diff --git a/chrome/common/extensions/docs/static/experimental.proxy.html b/chrome/common/extensions/docs/static/experimental.proxy.html index 4e7f066..d391a95 100644 --- a/chrome/common/extensions/docs/static/experimental.proxy.html +++ b/chrome/common/extensions/docs/static/experimental.proxy.html @@ -218,7 +218,7 @@ var config = { } }; chrome.experimental.proxy.settings.set( - {'value': config, 'incognito': false}, + {value: config, scope: 'regular'}, function() {}); </pre> @@ -238,7 +238,7 @@ var config = { } }; chrome.experimental.proxy.settings.set( - {'value': config, 'incognito': false}, + {value: config, scope: 'regular'}, function() {}); </pre> diff --git a/chrome/renderer/resources/extension_process_bindings.js b/chrome/renderer/resources/extension_process_bindings.js index 0c4c9ff..89fd3d4 100644 --- a/chrome/renderer/resources/extension_process_bindings.js +++ b/chrome/renderer/resources/extension_process_bindings.js @@ -370,8 +370,8 @@ var chrome = chrome || {}; [prefKey, details, callback], extendSchema(clearSchema)); }; - this.onChange = new chrome.Event('experimental.preferences.' + prefKey - + '.onChange'); + this.onChange = new chrome.Event('experimental.preferences.' + + prefKey + '.onChange'); }; customBindings['Preference'].prototype = new CustomBindingsObject(); } diff --git a/chrome/test/data/extensions/api_test/content_settings/incognito/test.html b/chrome/test/data/extensions/api_test/content_settings/incognito/test.html index 40ee7b9..ab3b653 100644 --- a/chrome/test/data/extensions/api_test/content_settings/incognito/test.html +++ b/chrome/test/data/extensions/api_test/content_settings/incognito/test.html @@ -25,6 +25,8 @@ chrome.test.runTests([ 'levelOfControl': "ControllableByThisExtension" }, "third-party cookies should not be blocked in incognito mode")); }, + // TODO(battre): re-enable when incognito preferences are available again. + /* function set() { cs.misc.blockThirdPartyCookies.set( { 'incognito': true, 'value': true }, chrome.test.callbackPass()); @@ -44,5 +46,6 @@ chrome.test.runTests([ 'levelOfControl': "ControlledByThisExtension" }, "third-party cookies should be blocked in incognito mode")); }, + */ ]); </script> diff --git a/chrome/test/data/extensions/api_test/content_settings/onchange/test.html b/chrome/test/data/extensions/api_test/content_settings/onchange/test.html index 92d0758..7cfff1f 100644 --- a/chrome/test/data/extensions/api_test/content_settings/onchange/test.html +++ b/chrome/test/data/extensions/api_test/content_settings/onchange/test.html @@ -35,6 +35,8 @@ chrome.test.runTests([ 'value':true }, chrome.test.callbackPass()); }, + // TODO(battre): re-enable when incognito is available again. + /* function changeIncognitoOnly() { listenUntil(cs.misc.blockThirdPartyCookies.onChange, [{ 'value': false, @@ -46,6 +48,7 @@ chrome.test.runTests([ 'incognito': true }, chrome.test.callbackPass()); }, + */ function changeDefaultOnly() { listenUntil(cs.misc.blockThirdPartyCookies.onChange, [{ 'value': false, @@ -55,6 +58,8 @@ chrome.test.runTests([ 'value': false }, chrome.test.callbackPass()); }, + // TODO(battre): re-enable when incognito is available again. + /* function changeIncognitoOnlyBack() { // Change the incognito setting back to true so that we get an event when // clearing the value. @@ -78,6 +83,7 @@ chrome.test.runTests([ 'incognito': true }, chrome.test.callbackPass()); }, + */ function clearDefault() { listenUntil(cs.misc.blockThirdPartyCookies.onChange, [{ 'value': false, diff --git a/chrome/test/data/extensions/api_test/proxy/individual_remove/test.js b/chrome/test/data/extensions/api_test/proxy/individual_remove/test.js index d984c0c..f62019d 100644 --- a/chrome/test/data/extensions/api_test/proxy/individual_remove/test.js +++ b/chrome/test/data/extensions/api_test/proxy/individual_remove/test.js @@ -40,12 +40,12 @@ chrome.test.runTests([ }, function setIndividualProxies() { chrome.experimental.proxy.settings.set( - {'value': config, 'incognito': false}, + {'value': config, 'scope': 'regular'}, chrome.test.callbackPass()); }, function clearProxies() { chrome.experimental.proxy.settings.clear( - {'incognito': false}, + {'scope': 'regular'}, chrome.test.callbackPass()); } ]); |