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

Unified Diff: chrome/common/extensions/docs/examples/api/preferences/allowThirdPartyCookies/popup.js

Issue 8341010: Samples for `enableReferrer` and `allowThirdPartyCookies` should use the `privacy` namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 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/common/extensions/docs/examples/api/preferences/allowThirdPartyCookies/popup.js
diff --git a/chrome/common/extensions/docs/examples/api/preferences/enableReferrer/popup.html b/chrome/common/extensions/docs/examples/api/preferences/allowThirdPartyCookies/popup.js
similarity index 77%
copy from chrome/common/extensions/docs/examples/api/preferences/enableReferrer/popup.html
copy to chrome/common/extensions/docs/examples/api/preferences/allowThirdPartyCookies/popup.js
index 11f8d11b15c397db837fcfa1e72fe2b67c45b0a5..dd6f11c68c3342c15d85b8eeee23dbb27ec99bcf 100644
--- a/chrome/common/extensions/docs/examples/api/preferences/enableReferrer/popup.html
+++ b/chrome/common/extensions/docs/examples/api/preferences/allowThirdPartyCookies/popup.js
@@ -1,8 +1,13 @@
-<!DOCTYPE html>
-<html>
-<head>
- <script>
-var pref = chrome.experimental.contentSettings.global.referrersEnabled;
+// 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.
+
+
+var pref = chrome.experimental.privacy.websites.thirdPartyCookiesAllowed;
+
+function $(id) {
+ return document.getElementById(id);
+}
/**
* Returns whether the |levelOfControl| means that the extension can change the
@@ -70,12 +75,22 @@ function init() {
chrome.extension.isAllowedIncognitoAccess(function(allowed) {
if (allowed) {
pref.get({'incognito': true}, updateUIFromGet);
- document.getElementById("incognito").style.display = "block";
- document.getElementById("incognito-forbidden").style.display = "none";
+ $("incognito").style.display = "block";
Bernhard Bauer 2011/10/18 13:21:44 I know I'm pretty inconsistent in that regard myse
Mike West 2011/10/18 13:47:00 Excellent point. Done.
+ $("incognito-forbidden").style.display = "none";
}
});
pref.get({}, updateUIFromGet);
pref.onChange.addListener(updateUIFromOnChange);
+
+ $('regularValue').addEventListener('click', function () {
+ setPrefValue(this.checked, false);
+ });
+ $('useSeparateIncognitoSettings').addEventListener('click', function () {
+ setUseSeparateIncognitoSettings(this.checked);
+ });
+ $('incognitoValue').addEventListener('click', function () {
+ setPrefValue(this.checked, true);
+ });
}
/**
@@ -108,22 +123,5 @@ function setUseSeparateIncognitoSettings(value) {
document.getElementById("incognitoValue").disabled = !value;
}
- </script>
-</head>
-<body onload="init()">
-
-<div style="width: 300px">
-<input type="checkbox" onclick="setPrefValue(this.checked)" id="regularValue" /> Enable referrers
-
-<div id="incognito" style="display:none">
-<input type="checkbox" onclick="setUseSeparateIncognitoSettings(this.checked)" id="useSeparateIncognitoSettings" /> Use separate setting for incognito mode:
-<br>
-<input type="checkbox" onclick="setPrefValue(this.checked, true)" id="incognitoValue" disabled="disabled"/> Enable referrers in incognito sessions
-</div>
-<div id="incognito-forbidden">
-Select "Allow in incognito" to access incognito preferences
-</div>
-</div>
-
-</body>
-</html>
+// Call `init` to kick things off.
+document.addEventListener('DOMContentLoaded', init);

Powered by Google App Engine
This is Rietveld 408576698