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

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

Issue 12025010: Move default_locale out of Extension class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: extension_service_unittest fixed Created 7 years, 11 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/i18n/i18n_api.h ('k') | chrome/browser/extensions/api/tabs/tabs_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.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
« no previous file with comments | « chrome/browser/extensions/api/i18n/i18n_api.h ('k') | chrome/browser/extensions/api/tabs/tabs_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698