| Index: chrome/browser/extensions/api/i18n/i18n_api.cc
|
| diff --git a/chrome/browser/extensions/api/i18n/i18n_api.cc b/chrome/browser/extensions/api/i18n/i18n_api.cc
|
| index ad2ef32c45afd58cd969ecac1978b1dd5db9214d..4351dad52426b07e7be13555806e5745c5ba0b91 100644
|
| --- a/chrome/browser/extensions/api/i18n/i18n_api.cc
|
| +++ b/chrome/browser/extensions/api/i18n/i18n_api.cc
|
| @@ -8,18 +8,28 @@
|
| #include <string>
|
| #include <vector>
|
|
|
| +#include "base/lazy_instance.h"
|
| #include "base/string_piece.h"
|
| #include "base/string_split.h"
|
| #include "chrome/browser/prefs/pref_service.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "chrome/common/extensions/api/i18n.h"
|
| +#include "chrome/common/extensions/api/i18n/default_locale_handler.h"
|
| +#include "chrome/common/extensions/extension_manifest_constants.h"
|
| +#include "chrome/common/extensions/manifest_handler.h"
|
| #include "chrome/common/pref_names.h"
|
|
|
| namespace GetAcceptLanguages = extensions::api::i18n::GetAcceptLanguages;
|
|
|
| +namespace extensions {
|
| +
|
| +namespace {
|
| +
|
| // Errors.
|
| static const char kEmptyAcceptLanguagesError[] = "accept-languages is empty.";
|
|
|
| +}
|
| +
|
| bool I18nGetAcceptLanguagesFunction::RunImpl() {
|
| std::string accept_languages =
|
| profile()->GetPrefs()->GetString(prefs::kAcceptLanguages);
|
| @@ -51,3 +61,21 @@ bool I18nGetAcceptLanguagesFunction::RunImpl() {
|
| results_ = GetAcceptLanguages::Results::Create(languages);
|
| return true;
|
| }
|
| +
|
| +I18nAPI::I18nAPI(Profile* profile) {
|
| + ManifestHandler::Register(extension_manifest_keys::kDefaultLocale,
|
| + new DefaultLocaleHandler);
|
| +}
|
| +
|
| +I18nAPI::~I18nAPI() {
|
| +}
|
| +
|
| +static base::LazyInstance<ProfileKeyedAPIFactory<I18nAPI> >
|
| + g_factory = LAZY_INSTANCE_INITIALIZER;
|
| +
|
| +// static
|
| +ProfileKeyedAPIFactory<I18nAPI>* I18nAPI::GetFactoryInstance() {
|
| + return &g_factory.Get();
|
| +}
|
| +
|
| +} // namespace extensions
|
|
|