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

Side by Side Diff: chrome/browser/extensions/api/i18n/i18n_api.cc

Issue 12253022: Manifest handler for all keys background-related. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include "chrome/browser/extensions/api/i18n/i18n_api.h" 5 #include "chrome/browser/extensions/api/i18n/i18n_api.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/lazy_instance.h" 11 #include "base/lazy_instance.h"
12 #include "base/prefs/pref_service.h" 12 #include "base/prefs/pref_service.h"
13 #include "base/string_piece.h" 13 #include "base/string_piece.h"
14 #include "base/string_split.h" 14 #include "base/string_split.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/common/extensions/api/i18n.h" 16 #include "chrome/common/extensions/api/i18n.h"
17 #include "chrome/common/extensions/api/i18n/default_locale_handler.h" 17 #include "chrome/common/extensions/api/i18n/default_locale_handler.h"
18 #include "chrome/common/extensions/extension_manifest_constants.h"
19 #include "chrome/common/extensions/manifest_handler.h"
20 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
21 19
22 namespace GetAcceptLanguages = extensions::api::i18n::GetAcceptLanguages; 20 namespace GetAcceptLanguages = extensions::api::i18n::GetAcceptLanguages;
23 21
24 namespace extensions { 22 namespace extensions {
25 23
26 namespace { 24 namespace {
27 25
28 // Errors. 26 // Errors.
29 static const char kEmptyAcceptLanguagesError[] = "accept-languages is empty."; 27 static const char kEmptyAcceptLanguagesError[] = "accept-languages is empty.";
(...skipping 26 matching lines...) Expand all
56 if (languages.empty()) { 54 if (languages.empty()) {
57 error_ = kEmptyAcceptLanguagesError; 55 error_ = kEmptyAcceptLanguagesError;
58 return false; 56 return false;
59 } 57 }
60 58
61 results_ = GetAcceptLanguages::Results::Create(languages); 59 results_ = GetAcceptLanguages::Results::Create(languages);
62 return true; 60 return true;
63 } 61 }
64 62
65 I18nAPI::I18nAPI(Profile* profile) { 63 I18nAPI::I18nAPI(Profile* profile) {
66 ManifestHandler::Register(extension_manifest_keys::kDefaultLocale, 64 (new DefaultLocaleHandler)->Register();
67 make_linked_ptr(new DefaultLocaleHandler));
68 } 65 }
69 66
70 I18nAPI::~I18nAPI() { 67 I18nAPI::~I18nAPI() {
71 } 68 }
72 69
73 static base::LazyInstance<ProfileKeyedAPIFactory<I18nAPI> > 70 static base::LazyInstance<ProfileKeyedAPIFactory<I18nAPI> >
74 g_factory = LAZY_INSTANCE_INITIALIZER; 71 g_factory = LAZY_INSTANCE_INITIALIZER;
75 72
76 // static 73 // static
77 ProfileKeyedAPIFactory<I18nAPI>* I18nAPI::GetFactoryInstance() { 74 ProfileKeyedAPIFactory<I18nAPI>* I18nAPI::GetFactoryInstance() {
78 return &g_factory.Get(); 75 return &g_factory.Get();
79 } 76 }
80 77
81 } // namespace extensions 78 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/file_handlers/file_handlers_api.cc ('k') | chrome/browser/extensions/api/icons/icons_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698