| 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 __gCrWeb['languageDetection'] = __gCrWeb.languageDetection; |
| 7 | 15 |
| 8 (function() { | 16 (function() { |
| 9 /** | 17 /** |
| 10 * The cache of the text content that was extracted from the page | 18 * The cache of the text content that was extracted from the page |
| 11 */ | 19 */ |
| 12 __gCrWeb.languageDetection.bufferedTextContent = null; | 20 __gCrWeb.languageDetection.bufferedTextContent = null; |
| 13 | 21 |
| 14 /** | 22 /** |
| 15 * The number of active requests that have populated the cache. This is | 23 * The number of active requests that have populated the cache. This is |
| 16 * incremented every time a call to |__gCrWeb.languageDetection.detectLanguage| | 24 * 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() { | 163 __gCrWeb.languageDetection['retrieveBufferedTextContent'] = function() { |
| 156 var textContent = __gCrWeb.languageDetection.bufferedTextContent; | 164 var textContent = __gCrWeb.languageDetection.bufferedTextContent; |
| 157 __gCrWeb.languageDetection.activeRequests -= 1; | 165 __gCrWeb.languageDetection.activeRequests -= 1; |
| 158 if (__gCrWeb.languageDetection.activeRequests == 0) { | 166 if (__gCrWeb.languageDetection.activeRequests == 0) { |
| 159 __gCrWeb.languageDetection.bufferedTextContent = null; | 167 __gCrWeb.languageDetection.bufferedTextContent = null; |
| 160 } | 168 } |
| 161 return textContent; | 169 return textContent; |
| 162 } | 170 } |
| 163 | 171 |
| 164 }()) // End of anonymous function. | 172 }()) // End of anonymous function. |
| OLD | NEW |