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

Side by Side Diff: chrome/browser/ui/webui/options/chromeos/cros_language_options_handler.cc

Issue 349073004: Cleanup: Remove deprecated Profile::GetExtensionService(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix typo Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/panels/base_panel_browser_test.cc ('k') | chrome/test/base/testing_profile.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/ui/webui/options/chromeos/cros_language_options_handler .h" 5 #include "chrome/browser/ui/webui/options/chromeos/cros_language_options_handler .h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/bind_helpers.h" 14 #include "base/bind_helpers.h"
15 #include "base/i18n/rtl.h" 15 #include "base/i18n/rtl.h"
16 #include "base/strings/stringprintf.h" 16 #include "base/strings/stringprintf.h"
17 #include "base/strings/utf_string_conversions.h" 17 #include "base/strings/utf_string_conversions.h"
18 #include "base/values.h" 18 #include "base/values.h"
19 #include "chrome/app/chrome_command_ids.h" 19 #include "chrome/app/chrome_command_ids.h"
20 #include "chrome/browser/browser_process.h" 20 #include "chrome/browser/browser_process.h"
21 #include "chrome/browser/chromeos/customization_document.h" 21 #include "chrome/browser/chromeos/customization_document.h"
22 #include "chrome/browser/chromeos/input_method/input_method_util.h" 22 #include "chrome/browser/chromeos/input_method/input_method_util.h"
23 #include "chrome/browser/chromeos/login/users/user_manager.h" 23 #include "chrome/browser/chromeos/login/users/user_manager.h"
24 #include "chrome/browser/extensions/extension_service.h"
25 #include "chrome/browser/extensions/extension_tab_util.h" 24 #include "chrome/browser/extensions/extension_tab_util.h"
26 #include "chrome/browser/lifetime/application_lifetime.h" 25 #include "chrome/browser/lifetime/application_lifetime.h"
27 #include "chrome/browser/profiles/profile.h" 26 #include "chrome/browser/profiles/profile.h"
28 #include "chrome/browser/ui/browser.h" 27 #include "chrome/browser/ui/browser.h"
29 #include "chrome/browser/ui/browser_finder.h" 28 #include "chrome/browser/ui/browser_finder.h"
30 #include "chrome/browser/ui/browser_window.h" 29 #include "chrome/browser/ui/browser_window.h"
31 #include "chrome/browser/ui/tabs/tab_strip_model.h" 30 #include "chrome/browser/ui/tabs/tab_strip_model.h"
32 #include "chrome/common/extensions/manifest_url_handler.h" 31 #include "chrome/common/extensions/manifest_url_handler.h"
33 #include "chromeos/ime/component_extension_ime_manager.h" 32 #include "chromeos/ime/component_extension_ime_manager.h"
34 #include "chromeos/ime/extension_ime_util.h" 33 #include "chromeos/ime/extension_ime_util.h"
35 #include "chromeos/ime/input_method_manager.h" 34 #include "chromeos/ime/input_method_manager.h"
36 #include "content/public/browser/navigation_controller.h" 35 #include "content/public/browser/navigation_controller.h"
37 #include "content/public/browser/user_metrics.h" 36 #include "content/public/browser/user_metrics.h"
38 #include "content/public/browser/web_contents.h" 37 #include "content/public/browser/web_contents.h"
39 #include "extensions/browser/extension_system.h" 38 #include "extensions/browser/extension_registry.h"
40 #include "extensions/common/extension.h" 39 #include "extensions/common/extension.h"
41 #include "grit/chromium_strings.h" 40 #include "grit/chromium_strings.h"
42 #include "grit/generated_resources.h" 41 #include "grit/generated_resources.h"
43 #include "ui/base/l10n/l10n_util.h" 42 #include "ui/base/l10n/l10n_util.h"
44 43
45 using base::UserMetricsAction; 44 using base::UserMetricsAction;
46 45
47 namespace { 46 namespace {
48 // TODO(zork): Remove this blacklist when fonts are added to Chrome OS. 47 // TODO(zork): Remove this blacklist when fonts are added to Chrome OS.
49 // see: crbug.com/240586 48 // see: crbug.com/240586
50 49
51 bool IsBlacklisted(const std::string& language_code) { 50 bool IsBlacklisted(const std::string& language_code) {
52 return language_code == "si"; // Sinhala 51 return language_code == "si"; // Sinhala
53 } 52 }
54 53
55 } // namespace 54 } // namespace
56 55
57 namespace chromeos { 56 namespace chromeos {
58 namespace options { 57 namespace options {
59 58
60 const char kVendorOtherLanguagesListDivider[] = 59 const char kVendorOtherLanguagesListDivider[] =
61 "VENDOR_OTHER_LANGUAGES_LIST_DIVIDER"; 60 "VENDOR_OTHER_LANGUAGES_LIST_DIVIDER";
62 61
63 CrosLanguageOptionsHandler::CrosLanguageOptionsHandler() 62 CrosLanguageOptionsHandler::CrosLanguageOptionsHandler()
64 : composition_extension_appended_(false), 63 : composition_extension_appended_(false),
65 is_page_initialized_(false) { 64 is_page_initialized_(false) {
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 ConvertInputMethodDescriptorsToIMEList( 547 ConvertInputMethodDescriptorsToIMEList(
549 component_extension_manager->GetAllIMEAsInputMethodDescriptor())); 548 component_extension_manager->GetAllIMEAsInputMethodDescriptor()));
550 web_ui()->CallJavascriptFunction( 549 web_ui()->CallJavascriptFunction(
551 "options.LanguageOptions.onComponentManagerInitialized", 550 "options.LanguageOptions.onComponentManagerInitialized",
552 *ime_list); 551 *ime_list);
553 composition_extension_appended_ = true; 552 composition_extension_appended_ = true;
554 } 553 }
555 554
556 void CrosLanguageOptionsHandler::AddImeProvider(base::ListValue* list) { 555 void CrosLanguageOptionsHandler::AddImeProvider(base::ListValue* list) {
557 Profile* profile = Profile::FromWebUI(web_ui()); 556 Profile* profile = Profile::FromWebUI(web_ui());
558 ExtensionService* extension_service = profile->GetExtensionService(); 557 const extensions::ExtensionSet& enabled_extensions =
559 for (size_t i = 0; i < list->GetSize(); i++) { 558 extensions::ExtensionRegistry::Get(profile)->enabled_extensions();
559 for (size_t i = 0; i < list->GetSize(); ++i) {
560 base::DictionaryValue* entry; 560 base::DictionaryValue* entry;
561 list->GetDictionary(i, &entry); 561 list->GetDictionary(i, &entry);
562 562
563 std::string input_method_id; 563 std::string input_method_id;
564 entry->GetString("id", &input_method_id); 564 entry->GetString("id", &input_method_id);
565 565
566 std::string extension_id = 566 std::string extension_id =
567 extension_ime_util::GetExtensionIDFromInputMethodID(input_method_id); 567 extension_ime_util::GetExtensionIDFromInputMethodID(input_method_id);
568 const extensions::Extension* extension = 568 const extensions::Extension* extension =
569 extension_service->GetExtensionById(extension_id, false); 569 enabled_extensions.GetByID(extension_id);
570 if (extension) 570 if (extension)
571 entry->SetString("extensionName", extension->name()); 571 entry->SetString("extensionName", extension->name());
572 } 572 }
573 } 573 }
574 574
575 } // namespace options 575 } // namespace options
576 } // namespace chromeos 576 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/base_panel_browser_test.cc ('k') | chrome/test/base/testing_profile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698