| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/extensions/api/input/input.h" | 5 #include "chrome/browser/extensions/api/input/input.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 } | 51 } |
| 52 | 52 |
| 53 int swipe_direction; | 53 int swipe_direction; |
| 54 int modifier_flags; | 54 int modifier_flags; |
| 55 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &swipe_direction)); | 55 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &swipe_direction)); |
| 56 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(1, &modifier_flags)); | 56 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(1, &modifier_flags)); |
| 57 | 57 |
| 58 return keyboard::MoveCursor( | 58 return keyboard::MoveCursor( |
| 59 swipe_direction, | 59 swipe_direction, |
| 60 modifier_flags, | 60 modifier_flags, |
| 61 ash::Shell::GetPrimaryRootWindow()->GetDispatcher()); | 61 ash::Shell::GetPrimaryRootWindow()->GetHost()->dispatcher()); |
| 62 #endif | 62 #endif |
| 63 error_ = kNotYetImplementedError; | 63 error_ = kNotYetImplementedError; |
| 64 return false; | 64 return false; |
| 65 } | 65 } |
| 66 | 66 |
| 67 bool VirtualKeyboardPrivateSendKeyEventFunction::RunImpl() { | 67 bool VirtualKeyboardPrivateSendKeyEventFunction::RunImpl() { |
| 68 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 68 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 69 #if defined(USE_ASH) | 69 #if defined(USE_ASH) |
| 70 base::Value* options_value = NULL; | 70 base::Value* options_value = NULL; |
| 71 base::DictionaryValue* params = NULL; | 71 base::DictionaryValue* params = NULL; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 82 EXTENSION_FUNCTION_VALIDATE(params->GetInteger("keyCode", &key_code)); | 82 EXTENSION_FUNCTION_VALIDATE(params->GetInteger("keyCode", &key_code)); |
| 83 EXTENSION_FUNCTION_VALIDATE(params->GetString("keyName", &key_name)); | 83 EXTENSION_FUNCTION_VALIDATE(params->GetString("keyName", &key_name)); |
| 84 EXTENSION_FUNCTION_VALIDATE(params->GetInteger("modifiers", &modifiers)); | 84 EXTENSION_FUNCTION_VALIDATE(params->GetInteger("modifiers", &modifiers)); |
| 85 | 85 |
| 86 return keyboard::SendKeyEvent( | 86 return keyboard::SendKeyEvent( |
| 87 type, | 87 type, |
| 88 char_value, | 88 char_value, |
| 89 key_code, | 89 key_code, |
| 90 key_name, | 90 key_name, |
| 91 modifiers, | 91 modifiers, |
| 92 ash::Shell::GetPrimaryRootWindow()->GetDispatcher()); | 92 ash::Shell::GetPrimaryRootWindow()->GetHost()->dispatcher()); |
| 93 #endif | 93 #endif |
| 94 error_ = kNotYetImplementedError; | 94 error_ = kNotYetImplementedError; |
| 95 return false; | 95 return false; |
| 96 } | 96 } |
| 97 | 97 |
| 98 bool VirtualKeyboardPrivateHideKeyboardFunction::RunImpl() { | 98 bool VirtualKeyboardPrivateHideKeyboardFunction::RunImpl() { |
| 99 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 99 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 100 #if defined(USE_ASH) | 100 #if defined(USE_ASH) |
| 101 UMA_HISTOGRAM_ENUMERATION( | 101 UMA_HISTOGRAM_ENUMERATION( |
| 102 "VirtualKeyboard.KeyboardControlEvent", | 102 "VirtualKeyboard.KeyboardControlEvent", |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 | 161 |
| 162 static base::LazyInstance<ProfileKeyedAPIFactory<InputAPI> > | 162 static base::LazyInstance<ProfileKeyedAPIFactory<InputAPI> > |
| 163 g_factory = LAZY_INSTANCE_INITIALIZER; | 163 g_factory = LAZY_INSTANCE_INITIALIZER; |
| 164 | 164 |
| 165 // static | 165 // static |
| 166 ProfileKeyedAPIFactory<InputAPI>* InputAPI::GetFactoryInstance() { | 166 ProfileKeyedAPIFactory<InputAPI>* InputAPI::GetFactoryInstance() { |
| 167 return g_factory.Pointer(); | 167 return g_factory.Pointer(); |
| 168 } | 168 } |
| 169 | 169 |
| 170 } // namespace extensions | 170 } // namespace extensions |
| OLD | NEW |