OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/api/virtual_keyboard_private/virtual_keyboard_priva
te_api.h" | 5 #include "extensions/browser/api/virtual_keyboard_private/virtual_keyboard_priva
te_api.h" |
6 | 6 |
| 7 #include <memory> |
| 8 #include <utility> |
| 9 |
7 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
8 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
9 #include "extensions/browser/api/extensions_api_client.h" | 12 #include "extensions/browser/api/extensions_api_client.h" |
10 #include "extensions/browser/api/virtual_keyboard_private/virtual_keyboard_deleg
ate.h" | 13 #include "extensions/browser/api/virtual_keyboard_private/virtual_keyboard_deleg
ate.h" |
11 #include "extensions/browser/extension_function_registry.h" | 14 #include "extensions/browser/extension_function_registry.h" |
12 #include "extensions/common/api/virtual_keyboard_private.h" | 15 #include "extensions/common/api/virtual_keyboard_private.h" |
13 #include "ui/events/event.h" | 16 #include "ui/events/event.h" |
14 | 17 |
15 namespace SetMode = extensions::api::virtual_keyboard_private::SetMode; | 18 namespace SetMode = extensions::api::virtual_keyboard_private::SetMode; |
16 namespace SetRequestedKeyboardState = | 19 namespace SetRequestedKeyboardState = |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 VirtualKeyboardDelegate* delegate = GetDelegate(this); | 109 VirtualKeyboardDelegate* delegate = GetDelegate(this); |
107 if (delegate) | 110 if (delegate) |
108 return delegate->OnKeyboardLoaded(); | 111 return delegate->OnKeyboardLoaded(); |
109 error_ = kNotYetImplementedError; | 112 error_ = kNotYetImplementedError; |
110 return false; | 113 return false; |
111 } | 114 } |
112 | 115 |
113 bool VirtualKeyboardPrivateGetKeyboardConfigFunction::RunSync() { | 116 bool VirtualKeyboardPrivateGetKeyboardConfigFunction::RunSync() { |
114 VirtualKeyboardDelegate* delegate = GetDelegate(this); | 117 VirtualKeyboardDelegate* delegate = GetDelegate(this); |
115 if (delegate) { | 118 if (delegate) { |
116 base::DictionaryValue* results = new base::DictionaryValue(); | 119 std::unique_ptr<base::DictionaryValue> results(new base::DictionaryValue()); |
117 if (delegate->GetKeyboardConfig(results)) { | 120 if (delegate->GetKeyboardConfig(results.get())) { |
118 SetResult(results); | 121 SetResult(std::move(results)); |
119 return true; | 122 return true; |
120 } | 123 } |
121 } | 124 } |
122 return false; | 125 return false; |
123 } | 126 } |
124 | 127 |
125 bool VirtualKeyboardPrivateOpenSettingsFunction::RunSync() { | 128 bool VirtualKeyboardPrivateOpenSettingsFunction::RunSync() { |
126 VirtualKeyboardDelegate* delegate = GetDelegate(this); | 129 VirtualKeyboardDelegate* delegate = GetDelegate(this); |
127 if (delegate) { | 130 if (delegate) { |
128 if (delegate->IsLanguageSettingsEnabled()) | 131 if (delegate->IsLanguageSettingsEnabled()) |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 static base::LazyInstance<BrowserContextKeyedAPIFactory<VirtualKeyboardAPI>> | 180 static base::LazyInstance<BrowserContextKeyedAPIFactory<VirtualKeyboardAPI>> |
178 g_factory = LAZY_INSTANCE_INITIALIZER; | 181 g_factory = LAZY_INSTANCE_INITIALIZER; |
179 | 182 |
180 // static | 183 // static |
181 BrowserContextKeyedAPIFactory<VirtualKeyboardAPI>* | 184 BrowserContextKeyedAPIFactory<VirtualKeyboardAPI>* |
182 VirtualKeyboardAPI::GetFactoryInstance() { | 185 VirtualKeyboardAPI::GetFactoryInstance() { |
183 return g_factory.Pointer(); | 186 return g_factory.Pointer(); |
184 } | 187 } |
185 | 188 |
186 } // namespace extensions | 189 } // namespace extensions |
OLD | NEW |