Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3854)

Unified Diff: chrome/browser/resources/access_chromevox/scripts/loader.js

Issue 6254007: Adding ChromeVox as a component extensions (enabled only for ChromeOS, for no... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/access_chromevox/scripts/loader.js
===================================================================
--- chrome/browser/resources/access_chromevox/scripts/loader.js (revision 0)
+++ chrome/browser/resources/access_chromevox/scripts/loader.js (revision 0)
@@ -0,0 +1,57 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * @fileoverview The script chooser loads any page specific enhancement
+ * scripts that are applicable to the page the user is currently on.
+ */
+
+goog.provide('cvox.SiteSpecificEnhancements');
+
+var ENHANCEMENT_SCRIPTS_BASE_URL =
+ 'http://www.gstatic.com/accessibility/javascript/ext/';
+
+/**
+ * Loads site specific enhancement scripts.
+ */
+cvox.SiteSpecificEnhancements.load = function() {
+ // Append this to the end of a remote URL to force it to bypass the cache
+ // and be redownloaded.
+ var forceRedownload = '?' + new Date().getTime();
+
+ function loadScript(src) {
+ var theScript = document.createElement('script');
+ theScript.type = 'text/javascript';
+ if (src.substr(0, 4) == 'http') {
+ theScript.src = src + forceRedownload;
+ } else if (ENHANCEMENT_SCRIPTS_BASE_URL) {
+ theScript.src = ENHANCEMENT_SCRIPTS_BASE_URL + src + forceRedownload;
+ } else {
+ theScript.src = chrome.extension.getURL(src) + forceRedownload;
+ }
+ document.getElementsByTagName('head')[0].appendChild(theScript);
+ }
+
+ var currentURL = document.baseURI;
+
+ if ((currentURL.indexOf('http://www.google.com/search?') == 0) ||
+ (currentURL.indexOf('http://www.google.com/webhp') == 0) ||
+ (currentURL.indexOf('http://www.google.com/#') == 0) ||
+ (currentURL == 'http://www.google.com/')) {
+ // Google Instant Search
+ loadScript('instant.js');
+ } else if (currentURL.indexOf('https://mail.google.com/mail/') == 0) {
+ // GMail
+ loadScript('gmail_api.js');
+ loadScript('gmail.js');
+ } else if ((currentURL.indexOf('http://books.google.com/ebooks?id=') == 0) &&
+ (currentURL.indexOf('&printsec=frontcover&output=reader') != -1)) {
+ // Google Books Web Reader
+ loadScript('booksReader_api.js');
+ loadScript('booksReader.js');
+ } else if (currentURL.indexOf('http://news.google.com/') == 0) {
+ // News
+ loadScript('news/axsEnableNews.js');
+ }
+};
Property changes on: chrome/browser/resources/access_chromevox/scripts/loader.js
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:eol-style
+ LF

Powered by Google App Engine
This is Rietveld 408576698