OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 /** |
| 6 * Returns a handler which will open a new window when activated. |
| 7 */ |
| 8 function getClickHandler() { |
| 9 return function(info, tab) { |
| 10 |
| 11 // The srcUrl property is only available for image elements. |
| 12 var url = 'info.html#' + info.srcUrl; |
| 13 |
| 14 // Create a new window to the info page. |
| 15 chrome.windows.create({ url: url, width: 520, height: 660 }); |
| 16 }; |
| 17 }; |
| 18 |
| 19 /** |
| 20 * Create a context menu which will only show up for images. |
| 21 */ |
| 22 chrome.contextMenus.create({ |
| 23 "title" : "Get image info", |
| 24 "type" : "normal", |
| 25 "contexts" : ["image"], |
| 26 "onclick" : getClickHandler() |
| 27 }); |
OLD | NEW |