Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / extensions / browser / api / virtual_keyboard_private / virtual_keyboard_delegate.h
blob4d1452e3ca7e3622d0e65020b4609fdd991e5454
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
3 // found in the LICENSE file.
5 #ifndef EXTENSIONS_BROWSER_API_VIRTUAL_KEYBOARD_VIRTUAL_KEYBOARD_DELEGATE_H_
6 #define EXTENSIONS_BROWSER_API_VIRTUAL_KEYBOARD_VIRTUAL_KEYBOARD_DELEGATE_H_
8 #include "base/macros.h"
9 #include "base/strings/string16.h"
10 #include "base/values.h"
11 #include "content/public/browser/browser_thread.h"
13 namespace extensions {
15 class VirtualKeyboardDelegate {
16 public:
17 virtual ~VirtualKeyboardDelegate() {}
19 // Fetch information about the preferred configuration of the keyboard. On
20 // exit, |settings| is populated with the keyboard configuration. Returns true
21 // if successful.
22 virtual bool GetKeyboardConfig(base::DictionaryValue* settings) = 0;
24 // Dismiss the virtual keyboard without changing input focus. Returns true if
25 // successful.
26 virtual bool HideKeyboard() = 0;
28 // Insert |text| verbatim into a text area. Returns true if successful.
29 virtual bool InsertText(const base::string16& text) = 0;
31 // Notifiy system that keyboard loading is complete. Used in UMA stats to
32 // track loading performance. Returns true if the notification was handled.
33 virtual bool OnKeyboardLoaded() = 0;
35 // Indicate if settings are accessible and enabled based on current state.
36 // For example, settings should be blocked when the session is locked.
37 virtual bool IsLanguageSettingsEnabled() = 0;
39 // Sets the state of the hotrod virtual keyboad.
40 virtual void SetHotrodKeyboard(bool enable) = 0;
42 // Activate and lock the virtual keyboad on screen or dismiss the keyboard
43 // regardless of the state of text focus. Used in a11y mode to allow typing
44 // hotkeys without the need for text focus. Returns true if successful.
45 virtual bool LockKeyboard(bool state) = 0;
47 // Dispatches a virtual key event. |type| indicates if the event is a keydown
48 // or keyup event. |char_value| is the unicode value for the key. |key_code|
49 // is the code assigned to the key, which is independent of the state of
50 // modifier keys. |key_name| is the standardized w3c name for the key.
51 // |modifiers| indicates which modifier keys are active. Returns true if
52 // successful.
53 virtual bool SendKeyEvent(const std::string& type,
54 int char_value,
55 int key_code,
56 const std::string& key_name,
57 int modifiers) = 0;
59 // Launches the settings app. Returns true if successful.
60 virtual bool ShowLanguageSettings() = 0;
62 // Sets virtual keyboard window mode.
63 virtual bool SetVirtualKeyboardMode(int mode_enum) = 0;
65 // Sets requested virtual keyboard state.
66 virtual bool SetRequestedKeyboardState(int state_enum) = 0;
69 } // namespace extensions
71 #endif // EXTENSIONS_BROWSER_API_VIRTUAL_KEYBOARD_VIRTUAL_KEYBOARD_DELEGATE_H_