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/chromeos/extensions/input_method_api.h" | 5 #include "chrome/browser/chromeos/extensions/input_method_api.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <memory> |
8 #include <set> | 9 #include <set> |
9 #include <string> | 10 #include <string> |
10 #include <utility> | 11 #include <utility> |
11 | 12 |
12 #include "ash/shell.h" | 13 #include "ash/shell.h" |
13 #include "base/command_line.h" | 14 #include "base/command_line.h" |
14 #include "base/lazy_instance.h" | 15 #include "base/lazy_instance.h" |
15 #include "base/memory/ptr_util.h" | 16 #include "base/memory/ptr_util.h" |
16 #include "base/values.h" | 17 #include "base/values.h" |
17 #include "build/build_config.h" | 18 #include "build/build_config.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 chromeos::input_method::InputMethodManager* manager = | 136 chromeos::input_method::InputMethodManager* manager = |
136 chromeos::input_method::InputMethodManager::Get(); | 137 chromeos::input_method::InputMethodManager::Get(); |
137 chromeos::input_method::InputMethodUtil* util = manager->GetInputMethodUtil(); | 138 chromeos::input_method::InputMethodUtil* util = manager->GetInputMethodUtil(); |
138 scoped_refptr<chromeos::input_method::InputMethodManager::State> ime_state = | 139 scoped_refptr<chromeos::input_method::InputMethodManager::State> ime_state = |
139 manager->GetActiveIMEState(); | 140 manager->GetActiveIMEState(); |
140 std::unique_ptr<chromeos::input_method::InputMethodDescriptors> | 141 std::unique_ptr<chromeos::input_method::InputMethodDescriptors> |
141 input_methods = ime_state->GetActiveInputMethods(); | 142 input_methods = ime_state->GetActiveInputMethods(); |
142 for (size_t i = 0; i < input_methods->size(); ++i) { | 143 for (size_t i = 0; i < input_methods->size(); ++i) { |
143 const chromeos::input_method::InputMethodDescriptor& input_method = | 144 const chromeos::input_method::InputMethodDescriptor& input_method = |
144 (*input_methods)[i]; | 145 (*input_methods)[i]; |
145 base::DictionaryValue* val = new base::DictionaryValue(); | 146 auto val = base::MakeUnique<base::DictionaryValue>(); |
146 val->SetString("id", input_method.id()); | 147 val->SetString("id", input_method.id()); |
147 val->SetString("name", util->GetInputMethodLongName(input_method)); | 148 val->SetString("name", util->GetInputMethodLongName(input_method)); |
148 val->SetString("indicator", util->GetInputMethodShortName(input_method)); | 149 val->SetString("indicator", util->GetInputMethodShortName(input_method)); |
149 output->Append(val); | 150 output->Append(std::move(val)); |
150 } | 151 } |
151 return RespondNow(OneArgument(std::move(output))); | 152 return RespondNow(OneArgument(std::move(output))); |
152 #endif | 153 #endif |
153 } | 154 } |
154 | 155 |
155 ExtensionFunction::ResponseAction | 156 ExtensionFunction::ResponseAction |
156 InputMethodPrivateFetchAllDictionaryWordsFunction::Run() { | 157 InputMethodPrivateFetchAllDictionaryWordsFunction::Run() { |
157 #if !defined(OS_CHROMEOS) | 158 #if !defined(OS_CHROMEOS) |
158 EXTENSION_FUNCTION_VALIDATE(false); | 159 EXTENSION_FUNCTION_VALIDATE(false); |
159 #else | 160 #else |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 static base::LazyInstance<BrowserContextKeyedAPIFactory<InputMethodAPI> > | 370 static base::LazyInstance<BrowserContextKeyedAPIFactory<InputMethodAPI> > |
370 g_factory = LAZY_INSTANCE_INITIALIZER; | 371 g_factory = LAZY_INSTANCE_INITIALIZER; |
371 | 372 |
372 // static | 373 // static |
373 BrowserContextKeyedAPIFactory<InputMethodAPI>* | 374 BrowserContextKeyedAPIFactory<InputMethodAPI>* |
374 InputMethodAPI::GetFactoryInstance() { | 375 InputMethodAPI::GetFactoryInstance() { |
375 return g_factory.Pointer(); | 376 return g_factory.Pointer(); |
376 } | 377 } |
377 | 378 |
378 } // namespace extensions | 379 } // namespace extensions |
OLD | NEW |