Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <!-- | 2 <!-- |
| 3 * Copyright (c) 2010 The Chromium Authors. All rights reserved. Use of this | 3 * Copyright (c) 2011 The Chromium Authors. All rights reserved. Use of this |
| 4 * source code is governed by a BSD-style license that can be found in the | 4 * source code is governed by a BSD-style license that can be found in the |
| 5 * LICENSE file. | 5 * LICENSE file. |
| 6 --> | 6 --> |
| 7 <html> | 7 <html> |
| 8 <head> | 8 <head> |
| 9 | 9 <title>Background Page</title> |
| 10 </head> | 10 </head> |
| 11 <body> | 11 <body> |
| 12 <script> | 12 <script src="./background.js"></script> |
|
abarth-chromium
2011/10/15 18:23:12
why ./background rather than just background.js ?
Use mkwst_at_chromium.org plz.
2011/10/15 18:41:26
Done.
| |
| 13 /** | |
| 14 * Returns a handler which will open a new window when activated. | |
| 15 */ | |
| 16 function getClickHandler() { | |
| 17 return function(info, tab) { | |
| 18 | |
| 19 // The srcUrl property is only available for image elements. | |
| 20 var url = 'info.html#' + info.srcUrl; | |
| 21 | |
| 22 // Create a new window to the info page. | |
| 23 chrome.windows.create({ url: url, width: 520, height: 660 }); | |
| 24 }; | |
| 25 }; | |
| 26 | |
| 27 /** | |
| 28 * Create a context menu which will only show up for images. | |
| 29 */ | |
| 30 chrome.contextMenus.create({ | |
| 31 "title" : "Get image info", | |
| 32 "type" : "normal", | |
| 33 "contexts" : ["image"], | |
| 34 "onclick" : getClickHandler() | |
| 35 }); | |
| 36 </script> | |
| 37 </body> | 13 </body> |
| 38 </html> | 14 </html> |
| OLD | NEW |