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 #ifndef CHROME_COMMON_TRANSLATE_TRANSLATE_ERRORS_H_ | 5 #ifndef CHROME_COMMON_TRANSLATE_TRANSLATE_ERRORS_H_ |
6 #define CHROME_COMMON_TRANSLATE_TRANSLATE_ERRORS_H_ | 6 #define CHROME_COMMON_TRANSLATE_TRANSLATE_ERRORS_H_ |
7 | 7 |
8 // This file consolidates all the error types for translation of a page. | 8 // This file consolidates all the error types for translation of a page. |
9 // Note: TranslateErrors is used for UMA and translate_internals.js. | 9 // Note: TranslateErrors is used for UMA and translate_internals.js. |
| 10 // Assigned numbers should be changed because the number is binded to UMA value. |
10 // enum TranslateError in histograms.xml and errorStrs in translate_internals.js | 11 // enum TranslateError in histograms.xml and errorStrs in translate_internals.js |
11 // should be updated when the type is updated. | 12 // should be updated when the type is updated. |
12 | 13 |
13 class TranslateErrors { | 14 class TranslateErrors { |
14 public: | 15 public: |
15 enum Type { | 16 enum Type { |
16 NONE = 0, | 17 NONE = 0, |
17 NETWORK, // No connectivity. | 18 NETWORK, // No connectivity. |
18 INITIALIZATION_ERROR, // The translation script failed to initialize. | 19 INITIALIZATION_ERROR, // The translation script failed to initialize. |
19 UNKNOWN_LANGUAGE, // The page's language could not be detected. | 20 UNKNOWN_LANGUAGE, // The page's language could not be detected. |
20 UNSUPPORTED_LANGUAGE, // The server detected a language that the browser | 21 UNSUPPORTED_LANGUAGE, // The server detected a language that the browser |
21 // does not know. | 22 // does not know. |
22 IDENTICAL_LANGUAGES, // The original and target languages are the same. | 23 IDENTICAL_LANGUAGES, // The original and target languages are the same. |
23 TRANSLATION_ERROR, // An error was reported by the translation script | 24 TRANSLATION_ERROR, // An error was reported by the translation script |
24 // during translation. | 25 // during translation. |
| 26 TRANSLATION_TIMEOUT, // The library doesn't finish the translation. |
| 27 UNEXPECTED_SCRIPT_ERROR, // The library raises an unexpected exception. |
| 28 BAD_ORIGIN, // The library is blocked because of bad origin. |
| 29 SCRIPT_LOAD_ERROR, // Loader fails to load a dependent JavaScript. |
25 TRANSLATE_ERROR_MAX, | 30 TRANSLATE_ERROR_MAX, |
26 }; | 31 }; |
27 | 32 |
28 private: | 33 private: |
29 TranslateErrors() {} | 34 TranslateErrors() {} |
30 | 35 |
31 DISALLOW_COPY_AND_ASSIGN(TranslateErrors); | 36 DISALLOW_COPY_AND_ASSIGN(TranslateErrors); |
32 }; | 37 }; |
33 | 38 |
34 #endif // CHROME_COMMON_TRANSLATE_TRANSLATE_ERRORS_H_ | 39 #endif // CHROME_COMMON_TRANSLATE_TRANSLATE_ERRORS_H_ |
OLD | NEW |