Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Side by Side Diff: views/ime/input_method.h

Issue 6688049: New InputMethod api for Views. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update. Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | views/ime/input_method_delegate.h » ('j') | views/ime/input_method_win.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 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.
4
5 #ifndef VIEWS_IME_INPUT_METHOD_H_
6 #define VIEWS_IME_INPUT_METHOD_H_
7 #pragma once
8
9 #include <string>
10
11 #include "base/basictypes.h"
12 #include "base/i18n/rtl.h"
13
14 namespace views {
15
16 namespace internal {
17 class InputMethodDelegate;
18 } // namespace internal
19
20 class KeyEvent;
21 class View;
22 class Widget;
23
24 // An interface implemented by an object that encapsulates a native input method
25 // service provided by the underlying operation system.
26 class InputMethod {
27 public:
28 virtual ~InputMethod() {}
29
30 // Sets the delegate used by this InputMethod instance. It should only be
31 // called by the internal NativeWidget or testing code.
32 virtual void set_delegate(internal::InputMethodDelegate* delegate) = 0;
33
34 // Initialize the InputMethod object and attach it to the given |widget|.
35 // The |widget| must already be initialized.
36 virtual void Init(Widget* widget) = 0;
37
38 // Dispatch a key event to the input method. The key event will be dispatched
39 // back to the caller via InputMethodDelegate::DispatchKeyEventPostIME(), once
40 // it's processed by the input method.
41 virtual void DispatchKeyEvent(const KeyEvent& key) = 0;
42
43 // Called by the focused |view| whenever its text input type is changed.
44 virtual void OnTextInputTypeChanged(View* view) = 0;
45
46 // Called by the focused |view| whenever its caret bounds is changed.
47 virtual void OnCaretBoundsChanged(View* view) = 0;
48
49 // Called by the focused |view| to ask the input method cancel the ongoing
50 // composition session.
51 virtual void CancelComposition(View* view) = 0;
52
53 // Returns the locale of current keyboard layout or input method, as a BCP-47
54 // tag, or an empty string if the input method cannot provide it.
55 virtual std::string GetInputLocale() = 0;
56
57 // Returns the text direction of current keyboard layout or input method, or
58 // base::i18n::UNKNOWN_DIRECTION if the input method cannot provide it.
59 virtual base::i18n::TextDirection GetInputTextDirection() = 0;
60
61 // Checks if the input method is active, i.e. if it's ready for processing
62 // keyboard event and generate composition or text result.
63 // If the input method is inactive, then it's not necessary to inform it the
64 // changes of caret bounds and text input type.
65 // Note: character results may still be generated and sent to the text input
66 // client by calling TextInputClient::InsertChar(), even if the input method
67 // is not active.
68 virtual bool IsActive() = 0;
69
70 // TODO(suzhe): Support mouse/touch event.
71 };
72
73 } // namespace views
74
75 #endif // VIEWS_IME_INPUT_METHOD_H_
OLDNEW
« no previous file with comments | « no previous file | views/ime/input_method_delegate.h » ('j') | views/ime/input_method_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698