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 * @fileoverview The main entry point for the extension content script. |
| 7 * |
| 8 * This is the only file that has access to the chrome.extension API |
| 9 * from the content script, because all other scripts are loaded into the |
| 10 * document head. So, any use of these extension APIs must be done in this |
| 11 * file. |
| 12 */ |
| 13 |
| 14 // TODO(dmazzoni): pull in these dependencies without explicitly |
| 15 // calling the private method writeScriptTag_. |
| 16 function initialize() { |
| 17 if (COMPILED) { |
| 18 var loadCompiledScript = function(scriptRelPath) { |
| 19 var scriptElt = document.createElement('script'); |
| 20 scriptElt.type = 'text/javascript'; |
| 21 scriptElt.src = chrome.extension.getURL(scriptRelPath); |
| 22 document.getElementsByTagName('head')[0].appendChild(scriptElt); |
| 23 }; |
| 24 if (BUILD_TYPE == BUILD_TYPE_CHROME) { |
| 25 loadCompiledScript('/chromeVoxChromePageScript.js'); |
| 26 } else if (BUILD_TYPE == BUILD_TYPE_ANDROID_DEV) { |
| 27 loadCompiledScript('/androidVoxDev.js'); |
| 28 } else { |
| 29 throw 'Unknown or unsupported build type: ' + BUILD_TYPE; |
| 30 } |
| 31 } else { |
| 32 goog.writeScriptTag_(chrome.extension.getURL('/closure/base.js')); |
| 33 goog.writeScriptTag_(chrome.extension.getURL('../powerkey-bundle.js')); |
| 34 goog.require('cvox.ChromeVoxInit'); |
| 35 } |
| 36 } |
| 37 |
| 38 initialize(); |
OLD | NEW |