| OLD | NEW |
| 1 // Copyright (c) 2009 The chrome Authors. All rights reserved. | 1 // Copyright (c) 2009 The chrome 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 // This script contains privileged chrome extension related javascript APIs. | 5 // This script contains privileged chrome extension related javascript APIs. |
| 6 // It is loaded by pages whose URL has the chrome-extension protocol. | 6 // It is loaded by pages whose URL has the chrome-extension protocol. |
| 7 | 7 |
| 8 var chrome = chrome || {}; | 8 var chrome = chrome || {}; |
| 9 (function() { | 9 (function() { |
| 10 native function GetExtensionAPIDefinition(); | 10 native function GetExtensionAPIDefinition(); |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 // constructor is not public. | 342 // constructor is not public. |
| 343 // | 343 // |
| 344 // We do this manually instead of using JSONSchema to avoid having these | 344 // We do this manually instead of using JSONSchema to avoid having these |
| 345 // properties show up in the doc. | 345 // properties show up in the doc. |
| 346 if (!("width" in details.imageData) || | 346 if (!("width" in details.imageData) || |
| 347 !("height" in details.imageData) || | 347 !("height" in details.imageData) || |
| 348 !("data" in details.imageData)) { | 348 !("data" in details.imageData)) { |
| 349 throw new Error( | 349 throw new Error( |
| 350 "The imageData property must contain an ImageData object."); | 350 "The imageData property must contain an ImageData object."); |
| 351 } | 351 } |
| 352 |
| 352 sendCustomRequest(SetBrowserActionIcon, "browserAction.setIcon", | 353 sendCustomRequest(SetBrowserActionIcon, "browserAction.setIcon", |
| 353 details, this.definition.parameters); | 354 details, this.definition.parameters); |
| 354 } else { | 355 } else { |
| 355 throw new Error( | 356 throw new Error( |
| 356 "Either the iconIndex or imageData property must be specified."); | 357 "Either the iconIndex or imageData property must be specified."); |
| 357 } | 358 } |
| 358 } | 359 } |
| 359 | 360 |
| 360 setupBrowserActionEvent(extensionId); | 361 setupBrowserActionEvent(extensionId); |
| 361 setupPageActionEvents(extensionId); | 362 setupPageActionEvents(extensionId); |
| 362 setupToolstripEvents(GetRenderViewId()); | 363 setupToolstripEvents(GetRenderViewId()); |
| 363 }); | 364 }); |
| 364 })(); | 365 })(); |
| OLD | NEW |