| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 __gCrWeb['languageDetection'] = {}; | 5 /** |
| 6 * @fileoverview Installs Language Detection management functions on the |
| 7 * __gCrWeb object. |
| 8 * |
| 9 * TODO(crbug.com/659442): Enable checkTypes error for this file. |
| 10 * @suppress {checkTypes} |
| 11 */ |
| 6 | 12 |
| 13 __gCrWeb.languageDetection = {}; |
| 14 |
| 15 // Store languageDetection namespace object in a global __gCrWeb object |
| 16 // referenced by a string, so it does not get renamed by closure compiler during |
| 17 // the minification. |
| 18 __gCrWeb['languageDetection'] = __gCrWeb.languageDetection; |
| 7 | 19 |
| 8 (function() { | 20 (function() { |
| 9 /** | 21 /** |
| 10 * The cache of the text content that was extracted from the page | 22 * The cache of the text content that was extracted from the page |
| 11 */ | 23 */ |
| 12 __gCrWeb.languageDetection.bufferedTextContent = null; | 24 __gCrWeb.languageDetection.bufferedTextContent = null; |
| 13 | 25 |
| 14 /** | 26 /** |
| 15 * The number of active requests that have populated the cache. This is | 27 * The number of active requests that have populated the cache. This is |
| 16 * incremented every time a call to |__gCrWeb.languageDetection.detectLanguage| | 28 * incremented every time a call to |__gCrWeb.languageDetection.detectLanguage| |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 __gCrWeb.languageDetection['retrieveBufferedTextContent'] = function() { | 167 __gCrWeb.languageDetection['retrieveBufferedTextContent'] = function() { |
| 156 var textContent = __gCrWeb.languageDetection.bufferedTextContent; | 168 var textContent = __gCrWeb.languageDetection.bufferedTextContent; |
| 157 __gCrWeb.languageDetection.activeRequests -= 1; | 169 __gCrWeb.languageDetection.activeRequests -= 1; |
| 158 if (__gCrWeb.languageDetection.activeRequests == 0) { | 170 if (__gCrWeb.languageDetection.activeRequests == 0) { |
| 159 __gCrWeb.languageDetection.bufferedTextContent = null; | 171 __gCrWeb.languageDetection.bufferedTextContent = null; |
| 160 } | 172 } |
| 161 return textContent; | 173 return textContent; |
| 162 } | 174 } |
| 163 | 175 |
| 164 }()) // End of anonymous function. | 176 }()) // End of anonymous function. |
| OLD | NEW |