Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_BROWSER_EXTENSIONS_API_I18N_I18N_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_I18N_I18N_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_I18N_I18N_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_I18N_I18N_API_H_ |
| 7 | 7 |
| 8 #include "base/strings/string16.h" | |
| 9 #include "base/strings/utf_string_conversions.h" | |
| 8 #include "chrome/browser/extensions/chrome_extension_function.h" | 10 #include "chrome/browser/extensions/chrome_extension_function.h" |
| 9 #include "extensions/browser/browser_context_keyed_api_factory.h" | 11 #include "extensions/browser/browser_context_keyed_api_factory.h" |
| 12 // Added | |
|
Takashi Toyoshima
2015/07/08 03:19:41
remove this comment line
amalika
2015/07/08 21:58:03
Done.
| |
| 13 #include "third_party/cld_2/src/public/compact_lang_det.h" | |
| 14 #include "third_party/cld_2/src/public/encodings.h" | |
| 10 | 15 |
| 11 class Profile; | 16 class Profile; |
| 12 | 17 |
| 13 namespace extensions { | 18 namespace extensions { |
| 14 | 19 |
| 15 class I18nGetAcceptLanguagesFunction : public ChromeSyncExtensionFunction { | 20 class I18nGetAcceptLanguagesFunction : public ChromeSyncExtensionFunction { |
| 16 ~I18nGetAcceptLanguagesFunction() override {} | 21 ~I18nGetAcceptLanguagesFunction() override {} |
| 17 bool RunSync() override; | 22 bool RunSync() override; |
| 18 DECLARE_EXTENSION_FUNCTION("i18n.getAcceptLanguages", I18N_GETACCEPTLANGUAGES) | 23 DECLARE_EXTENSION_FUNCTION("i18n.getAcceptLanguages", I18N_GETACCEPTLANGUAGES) |
| 19 }; | 24 }; |
| 20 | 25 |
| 26 typedef struct { | |
|
Takashi Toyoshima
2015/07/08 03:19:41
I think 'typedef struct { ... }' is not famous in
amalika
2015/07/08 21:58:03
Done.
Takashi Toyoshima
2015/07/09 03:32:34
Not yet.
struct DetectedLanguage {
std::string
| |
| 27 std::string language; | |
| 28 int percentage; | |
| 29 } DetectedLanguage; | |
| 30 | |
| 31 class I18nDetectLanguageFunction : public ChromeAsyncExtensionFunction { | |
| 32 private: | |
|
Takashi Toyoshima
2015/07/08 03:19:41
wrong indent.
It would be useful to try 'git cl fo
amalika
2015/07/08 21:58:03
Done.
| |
| 33 ~I18nDetectLanguageFunction() override {}; | |
| 34 bool RunAsync() override; | |
| 35 void GetLanguage(const std::string& text); | |
| 36 void SendLanguagesResult(DetectedLanguage *detected_langs, | |
| 37 const bool is_reliable); | |
| 38 void InitDetectedLanguages(CLD2::Language *langs, int *percent3, | |
| 39 DetectedLanguage detected_langs[3]); | |
| 40 | |
| 41 DECLARE_EXTENSION_FUNCTION("i18n.detectLanguage", I18N_DETECTLANGUAGE) | |
| 42 }; | |
| 43 | |
| 21 } // namespace extensions | 44 } // namespace extensions |
| 22 | 45 |
| 23 #endif // CHROME_BROWSER_EXTENSIONS_API_I18N_I18N_API_H_ | 46 #endif // CHROME_BROWSER_EXTENSIONS_API_I18N_I18N_API_H_ |
| OLD | NEW |