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

Unified Diff: chrome/common/extensions/docs/examples/extensions/imageinfo/background.js

Issue 8310002: Adding `content_security_policy` to imageinfo extension. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Docs. 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/extensions/imageinfo/background.js
diff --git a/chrome/common/extensions/docs/examples/extensions/imageinfo/background.js b/chrome/common/extensions/docs/examples/extensions/imageinfo/background.js
new file mode 100644
index 0000000000000000000000000000000000000000..41147e4d074b1f6795e714a8a5c13262716c32b0
--- /dev/null
+++ b/chrome/common/extensions/docs/examples/extensions/imageinfo/background.js
@@ -0,0 +1,27 @@
+// 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.
+
+/**
+ * Returns a handler which will open a new window when activated.
+ */
+function getClickHandler() {
+ return function(info, tab) {
+
+ // The srcUrl property is only available for image elements.
+ var url = 'info.html#' + info.srcUrl;
+
+ // Create a new window to the info page.
+ chrome.windows.create({ url: url, width: 520, height: 660 });
+ };
+};
+
+/**
+ * Create a context menu which will only show up for images.
+ */
+chrome.contextMenus.create({
+ "title" : "Get image info",
+ "type" : "normal",
+ "contexts" : ["image"],
+ "onclick" : getClickHandler()
+});

Powered by Google App Engine
This is Rietveld 408576698