OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script> | 4 <script> |
5 var pref = chrome.experimental.contentSettings.global.referrersEnabled; | 5 var pref = chrome.experimental.contentSettings.global.thirdPartyCookiesAllowed; |
6 | 6 |
7 /** | 7 /** |
8 * Returns whether the |levelOfControl| means that the extension can change the | 8 * Returns whether the |levelOfControl| means that the extension can change the |
9 * preference value. | 9 * preference value. |
10 * | 10 * |
11 * @param levelOfControl{string} | 11 * @param levelOfControl{string} |
12 */ | 12 */ |
13 function settingIsControllable(levelOfControl) { | 13 function settingIsControllable(levelOfControl) { |
14 return (levelOfControl == "controllable_by_this_extension" || | 14 return (levelOfControl == "controllable_by_this_extension" || |
15 levelOfControl == "controlled_by_this_extension"); | 15 levelOfControl == "controlled_by_this_extension"); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 pref.onChange.addListener(updateUIFromOnChange); | 78 pref.onChange.addListener(updateUIFromOnChange); |
79 } | 79 } |
80 | 80 |
81 /** | 81 /** |
82 * Called from the UI to change the preference value. | 82 * Called from the UI to change the preference value. |
83 * | 83 * |
84 * @param enabled{boolean} The new preference value. | 84 * @param enabled{boolean} The new preference value. |
85 * @param incognito{boolean} Whether the value is specific to incognito mode. | 85 * @param incognito{boolean} Whether the value is specific to incognito mode. |
86 */ | 86 */ |
87 function setPrefValue(enabled, incognito) { | 87 function setPrefValue(enabled, incognito) { |
88 pref.set({'value':enabled, 'incognito': incognito}); | 88 var scope = incognito ? 'incognito_session_only' : 'regular'; |
| 89 pref.set({'value': enabled, 'scope': scope}); |
89 } | 90 } |
90 | 91 |
91 /** | 92 /** |
92 * Called from the UI to change whether to use separate settings for | 93 * Called from the UI to change whether to use separate settings for |
93 * incognito mode. | 94 * incognito mode. |
94 * | 95 * |
95 * @param value{boolean} whether to use separate settings for | 96 * @param value{boolean} whether to use separate settings for |
96 * incognito mode. | 97 * incognito mode. |
97 */ | 98 */ |
98 function setUseSeparateIncognitoSettings(value) { | 99 function setUseSeparateIncognitoSettings(value) { |
99 if (!value) { | 100 if (!value) { |
100 pref.clear({'incognito': true}); | 101 pref.clear({'incognito': true}); |
101 } else { | 102 } else { |
102 // Explicitly set the value for incognito mode. | 103 // Explicitly set the value for incognito mode. |
103 pref.get({'incognito': true}, function(settings) { | 104 pref.get({'incognito': true}, function(settings) { |
104 pref.set({'incognito': true, 'value': settings.value}); | 105 pref.set({'incognito': true, 'value': settings.value}); |
105 }); | 106 }); |
106 } | 107 } |
107 document.getElementById("incognitoValue").disabled = !value; | 108 document.getElementById("incognitoValue").disabled = !value; |
108 } | 109 } |
109 | 110 |
110 </script> | 111 </script> |
111 </head> | 112 </head> |
112 <body onload="init()"> | 113 <body onload="init()"> |
113 | 114 |
114 <div style="width: 300px"> | 115 <div style="width: 300px"> |
115 <input type="checkbox" onclick="setPrefValue(this.checked)" id="regularValue" />
Enable referrers | 116 <input type="checkbox" onclick="setPrefValue(this.checked)" id="regularValue" />
Allow third-party sites to set cookies |
116 | 117 |
117 <div id="incognito" style="display:none"> | 118 <div id="incognito" style="display:none"> |
118 <input type="checkbox" onclick="setUseSeparateIncognitoSettings(this.checked)" i
d="useSeparateIncognitoSettings" /> Use separate setting for incognito mode: | 119 <input type="checkbox" onclick="setUseSeparateIncognitoSettings(this.checked)" i
d="useSeparateIncognitoSettings" /> Use separate setting for incognito mode: |
119 <br> | 120 <br> |
120 <input type="checkbox" onclick="setPrefValue(this.checked, true)" id="incognitoV
alue" disabled="disabled"/> Enable referrers in incognito sessions | 121 <input type="checkbox" onclick="setPrefValue(this.checked, true)" id="incognitoV
alue" disabled="disabled"/> Enable referrers in incognito sessions |
121 </div> | 122 </div> |
122 <div id="incognito-forbidden"> | 123 <div id="incognito-forbidden"> |
123 Select "Allow in incognito" to access incognito preferences | 124 Select "Allow in incognito" to access incognito preferences |
124 </div> | 125 </div> |
125 </div> | 126 </div> |
126 | 127 |
127 </body> | 128 </body> |
128 </html> | 129 </html> |
OLD | NEW |