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 <string> | |
9 #include <vector> | |
10 | |
8 #include "chrome/browser/extensions/chrome_extension_function.h" | 11 #include "chrome/browser/extensions/chrome_extension_function.h" |
12 #include "chrome/common/extensions/api/i18n.h" | |
9 #include "extensions/browser/browser_context_keyed_api_factory.h" | 13 #include "extensions/browser/browser_context_keyed_api_factory.h" |
14 #include "extensions/browser/extension_function.h" | |
15 #include "third_party/cld_2/src/public/compact_lang_det.h" | |
16 #include "third_party/cld_2/src/public/encodings.h" | |
10 | 17 |
11 class Profile; | 18 class Profile; |
12 | 19 |
13 namespace extensions { | 20 namespace extensions { |
14 | |
not at google - send to devlin
2015/07/14 18:42:58
Leave this blank line in i.e. don't delete it.
amalika
2015/07/14 22:41:02
Done.
| |
15 class I18nGetAcceptLanguagesFunction : public ChromeSyncExtensionFunction { | 21 class I18nGetAcceptLanguagesFunction : public ChromeSyncExtensionFunction { |
16 ~I18nGetAcceptLanguagesFunction() override {} | 22 ~I18nGetAcceptLanguagesFunction() override {} |
17 bool RunSync() override; | 23 bool RunSync() override; |
18 DECLARE_EXTENSION_FUNCTION("i18n.getAcceptLanguages", I18N_GETACCEPTLANGUAGES) | 24 DECLARE_EXTENSION_FUNCTION("i18n.getAcceptLanguages", I18N_GETACCEPTLANGUAGES) |
19 }; | 25 }; |
20 | 26 |
27 class I18nDetectLanguageFunction : public UIThreadExtensionFunction { | |
28 private: | |
29 ~I18nDetectLanguageFunction() override{}; | |
30 ResponseAction Run() override; | |
not at google - send to devlin
2015/07/14 18:42:58
For overrides of an interface you usually do
// U
amalika
2015/07/14 22:41:02
Done.
| |
31 void GetLanguage(const std::string& text); | |
32 void SendLanguagesResult( | |
33 const extensions::api::i18n::DetectLanguage::Results::Result& result); | |
34 void InitDetectedLanguages( | |
35 CLD2::Language* langs, | |
36 int* percent3, | |
37 std::vector<linked_ptr<extensions::api::i18n::DetectLanguage::Results:: | |
not at google - send to devlin
2015/07/14 18:42:58
"extensions::" prefix not necessary anywhere, this
amalika
2015/07/14 22:41:02
Done.
| |
38 Result::LanguagesType>>* detected_langs); | |
39 | |
40 DECLARE_EXTENSION_FUNCTION("i18n.detectLanguage", I18N_DETECTLANGUAGE) | |
41 }; | |
42 | |
21 } // namespace extensions | 43 } // namespace extensions |
22 | 44 |
23 #endif // CHROME_BROWSER_EXTENSIONS_API_I18N_I18N_API_H_ | 45 #endif // CHROME_BROWSER_EXTENSIONS_API_I18N_I18N_API_H_ |
OLD | NEW |