| OLD | NEW |
| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 | 237 |
| 238 const input_method::InputMethodDescriptor* ime = | 238 const input_method::InputMethodDescriptor* ime = |
| 239 input_method::InputMethodManager::Get() | 239 input_method::InputMethodManager::Get() |
| 240 ->GetActiveIMEState() | 240 ->GetActiveIMEState() |
| 241 ->GetInputMethodFromId(input_method_id); | 241 ->GetInputMethodFromId(input_method_id); |
| 242 if (!ime) | 242 if (!ime) |
| 243 return; | 243 return; |
| 244 | 244 |
| 245 Browser* browser = chrome::FindBrowserWithWebContents( | 245 Browser* browser = chrome::FindBrowserWithWebContents( |
| 246 web_ui()->GetWebContents()); | 246 web_ui()->GetWebContents()); |
| 247 content::OpenURLParams params(ime->options_page_url(), | 247 content::OpenURLParams params(ime->options_page_url(), content::Referrer(), |
| 248 content::Referrer(), | 248 WindowOpenDisposition::SINGLETON_TAB, |
| 249 SINGLETON_TAB, | 249 ui::PAGE_TRANSITION_LINK, false); |
| 250 ui::PAGE_TRANSITION_LINK, | |
| 251 false); | |
| 252 browser->OpenURL(params); | 250 browser->OpenURL(params); |
| 253 } | 251 } |
| 254 | 252 |
| 255 void CrosLanguageOptionsHandler::AddImeProvider(base::ListValue* list) { | 253 void CrosLanguageOptionsHandler::AddImeProvider(base::ListValue* list) { |
| 256 Profile* profile = Profile::FromWebUI(web_ui()); | 254 Profile* profile = Profile::FromWebUI(web_ui()); |
| 257 const extensions::ExtensionSet& enabled_extensions = | 255 const extensions::ExtensionSet& enabled_extensions = |
| 258 extensions::ExtensionRegistry::Get(profile)->enabled_extensions(); | 256 extensions::ExtensionRegistry::Get(profile)->enabled_extensions(); |
| 259 for (size_t i = 0; i < list->GetSize(); ++i) { | 257 for (size_t i = 0; i < list->GetSize(); ++i) { |
| 260 base::DictionaryValue* entry; | 258 base::DictionaryValue* entry; |
| 261 list->GetDictionary(i, &entry); | 259 list->GetDictionary(i, &entry); |
| 262 | 260 |
| 263 std::string input_method_id; | 261 std::string input_method_id; |
| 264 entry->GetString("id", &input_method_id); | 262 entry->GetString("id", &input_method_id); |
| 265 | 263 |
| 266 std::string extension_id = | 264 std::string extension_id = |
| 267 extension_ime_util::GetExtensionIDFromInputMethodID(input_method_id); | 265 extension_ime_util::GetExtensionIDFromInputMethodID(input_method_id); |
| 268 const extensions::Extension* extension = | 266 const extensions::Extension* extension = |
| 269 enabled_extensions.GetByID(extension_id); | 267 enabled_extensions.GetByID(extension_id); |
| 270 if (extension) | 268 if (extension) |
| 271 entry->SetString("extensionName", extension->name()); | 269 entry->SetString("extensionName", extension->name()); |
| 272 } | 270 } |
| 273 } | 271 } |
| 274 | 272 |
| 275 } // namespace options | 273 } // namespace options |
| 276 } // namespace chromeos | 274 } // namespace chromeos |
| OLD | NEW |