| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 chrome.browserAction.onClicked.addListener(function() { | 5 chrome.browserAction.onClicked.addListener(function() { |
| 6 chrome.windows.getCurrent(function(win) { | 6 chrome.windows.getCurrent(function(win) { |
| 7 chrome.tabs.getSelected(win.id, actionClicked); | 7 chrome.tabs.getSelected(win.id, actionClicked); |
| 8 }); | 8 }); |
| 9 }); | 9 }); |
| 10 | 10 |
| 11 var version = "1.0"; | 11 var version = "1.0"; |
| 12 | 12 |
| 13 function actionClicked(tab) { | 13 function actionClicked(tab) { |
| 14 chrome.debugger.attach({tabId:tab.id}, version, onAttach.bind(null, tab.id)); | 14 chrome.debugger.attach({tabId:tab.id}, version, onAttach.bind(null, tab.id)); |
| 15 } | 15 } |
| 16 | 16 |
| 17 function onAttach(tabId) { | 17 function onAttach(tabId) { |
| 18 if (chrome.extension.lastError) { | 18 if (chrome.runtime.lastError) { |
| 19 alert(chrome.extension.lastError.message); | 19 alert(chrome.runtime.lastError.message); |
| 20 return; | 20 return; |
| 21 } | 21 } |
| 22 | 22 |
| 23 chrome.windows.create( | 23 chrome.windows.create( |
| 24 {url: "headers.html?" + tabId, type: "popup", width: 800, height: 600}); | 24 {url: "headers.html?" + tabId, type: "popup", width: 800, height: 600}); |
| 25 } | 25 } |
| OLD | NEW |