Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2243)

Unified Diff: chrome/browser/extensions/api/i18n/i18n_api.h

Issue 1208993011: New thin layer of API extension chrome.i18n.detectLanguage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Style errors fixed Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/api/api_registration.gyp ('k') | chrome/browser/extensions/api/i18n/i18n_api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/i18n/i18n_api.h
diff --git a/chrome/browser/extensions/api/i18n/i18n_api.h b/chrome/browser/extensions/api/i18n/i18n_api.h
index 5863aaacf22c42625d43467e99cc5928bb968db7..ba01d8afef3228b51a449ed1e2e3f079dba43841 100644
--- a/chrome/browser/extensions/api/i18n/i18n_api.h
+++ b/chrome/browser/extensions/api/i18n/i18n_api.h
@@ -5,8 +5,15 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_I18N_I18N_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_I18N_I18N_API_H_
+#include <string>
+#include <vector>
+
#include "chrome/browser/extensions/chrome_extension_function.h"
+#include "chrome/common/extensions/api/i18n.h"
#include "extensions/browser/browser_context_keyed_api_factory.h"
+#include "extensions/browser/extension_function.h"
+#include "third_party/cld_2/src/public/compact_lang_det.h"
+#include "third_party/cld_2/src/public/encodings.h"
class Profile;
@@ -18,6 +25,24 @@ class I18nGetAcceptLanguagesFunction : public ChromeSyncExtensionFunction {
DECLARE_EXTENSION_FUNCTION("i18n.getAcceptLanguages", I18N_GETACCEPTLANGUAGES)
};
+class I18nDetectLanguageFunction : public UIThreadExtensionFunction {
+ private:
+ ~I18nDetectLanguageFunction() override{};
+
+ // UIThreadExtensionFunction:
+ ResponseAction Run() override;
+
+ scoped_ptr<base::ListValue> GetLanguage(const std::string& text);
+ void InitDetectedLanguages(
+ CLD2::Language* langs,
+ int* percent3,
+ std::vector<linked_ptr<
+ api::i18n::DetectLanguage::Results::Result::LanguagesType>>*
+ detected_langs);
+
+ DECLARE_EXTENSION_FUNCTION("i18n.detectLanguage", I18N_DETECTLANGUAGE)
+};
+
} // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_API_I18N_I18N_API_H_
« no previous file with comments | « chrome/browser/extensions/api/api_registration.gyp ('k') | chrome/browser/extensions/api/i18n/i18n_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698