| 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 "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
| 9 #include "extensions/browser/api/extensions_api_client.h" | 9 #include "extensions/browser/api/extensions_api_client.h" |
| 10 #include "extensions/browser/api/virtual_keyboard_private/virtual_keyboard_deleg
ate.h" | 10 #include "extensions/browser/api/virtual_keyboard_private/virtual_keyboard_deleg
ate.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 return delegate->ShowLanguageSettings(); | 129 return delegate->ShowLanguageSettings(); |
| 130 return false; | 130 return false; |
| 131 } | 131 } |
| 132 error_ = kNotYetImplementedError; | 132 error_ = kNotYetImplementedError; |
| 133 return false; | 133 return false; |
| 134 } | 134 } |
| 135 | 135 |
| 136 bool VirtualKeyboardPrivateSetModeFunction::RunSync() { | 136 bool VirtualKeyboardPrivateSetModeFunction::RunSync() { |
| 137 VirtualKeyboardDelegate* delegate = GetDelegate(this); | 137 VirtualKeyboardDelegate* delegate = GetDelegate(this); |
| 138 if (delegate) { | 138 if (delegate) { |
| 139 scoped_ptr<SetMode::Params> params = SetMode::Params::Create(*args_); | 139 std::unique_ptr<SetMode::Params> params = SetMode::Params::Create(*args_); |
| 140 EXTENSION_FUNCTION_VALIDATE(params); | 140 EXTENSION_FUNCTION_VALIDATE(params); |
| 141 if (!delegate->SetVirtualKeyboardMode(params->mode)) { | 141 if (!delegate->SetVirtualKeyboardMode(params->mode)) { |
| 142 error_ = kVirtualKeyboardNotEnabled; | 142 error_ = kVirtualKeyboardNotEnabled; |
| 143 return false; | 143 return false; |
| 144 } else { | 144 } else { |
| 145 return true; | 145 return true; |
| 146 } | 146 } |
| 147 } | 147 } |
| 148 error_ = kNotYetImplementedError; | 148 error_ = kNotYetImplementedError; |
| 149 return false; | 149 return false; |
| 150 } | 150 } |
| 151 | 151 |
| 152 bool VirtualKeyboardPrivateSetKeyboardStateFunction::RunSync() { | 152 bool VirtualKeyboardPrivateSetKeyboardStateFunction::RunSync() { |
| 153 VirtualKeyboardDelegate* delegate = GetDelegate(this); | 153 VirtualKeyboardDelegate* delegate = GetDelegate(this); |
| 154 if (delegate) { | 154 if (delegate) { |
| 155 scoped_ptr<SetRequestedKeyboardState::Params> params = | 155 std::unique_ptr<SetRequestedKeyboardState::Params> params = |
| 156 SetRequestedKeyboardState::Params::Create(*args_); | 156 SetRequestedKeyboardState::Params::Create(*args_); |
| 157 EXTENSION_FUNCTION_VALIDATE(params); | 157 EXTENSION_FUNCTION_VALIDATE(params); |
| 158 if (!delegate->SetRequestedKeyboardState(params->state)) { | 158 if (!delegate->SetRequestedKeyboardState(params->state)) { |
| 159 error_ = kVirtualKeyboardNotEnabled; | 159 error_ = kVirtualKeyboardNotEnabled; |
| 160 return false; | 160 return false; |
| 161 } else { | 161 } else { |
| 162 return true; | 162 return true; |
| 163 } | 163 } |
| 164 } | 164 } |
| 165 error_ = kNotYetImplementedError; | 165 error_ = kNotYetImplementedError; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 177 static base::LazyInstance<BrowserContextKeyedAPIFactory<VirtualKeyboardAPI>> | 177 static base::LazyInstance<BrowserContextKeyedAPIFactory<VirtualKeyboardAPI>> |
| 178 g_factory = LAZY_INSTANCE_INITIALIZER; | 178 g_factory = LAZY_INSTANCE_INITIALIZER; |
| 179 | 179 |
| 180 // static | 180 // static |
| 181 BrowserContextKeyedAPIFactory<VirtualKeyboardAPI>* | 181 BrowserContextKeyedAPIFactory<VirtualKeyboardAPI>* |
| 182 VirtualKeyboardAPI::GetFactoryInstance() { | 182 VirtualKeyboardAPI::GetFactoryInstance() { |
| 183 return g_factory.Pointer(); | 183 return g_factory.Pointer(); |
| 184 } | 184 } |
| 185 | 185 |
| 186 } // namespace extensions | 186 } // namespace extensions |
| OLD | NEW |