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

Side by Side Diff: views/ime/ime_context.cc

Issue 6480036: Add input method support for views and integrate ibus input framework (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 10 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 | « views/ime/ime_context.h ('k') | views/views.gyp » ('j') | no next file with comments »
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 #include "views/ime/ime_context.h"
6
7 namespace {
8
9 #ifdef USE_DUMMY_IME_CONTEXT
10 class DummyIMEContext : public views::IMEContext {
11 public:
12 explicit DummyIMEContext(views::View* view)
13 : views::IMEContext(view) {}
14 virtual ~DummyIMEContext() {}
15
16 // views::IMEContext implementations:
17 virtual void Focus() {}
18 virtual void Blur() {}
19 virtual void Reset() {}
20 virtual bool FilterKeyEvent(const views::KeyEvent& event) {
21 return false;
22 }
23 virtual void SetCursorLocation(const gfx::Rect& caret_rect) {}
24 virtual void SetSurrounding(const string16& text, int cursor_pos) {}
25
26 private:
27 DISALLOW_COPY_AND_ASSIGN(DummyIMEContext);
28 };
29 #endif // USE_DUMMY_IME_CONTEXT
30
31 } // namespace
32
33 namespace views {
34
35 IMEContext::IMEContext(View* view)
36 : view_(view) ,
37 commit_text_listener_(NULL),
38 composition_listener_(NULL),
39 forward_key_event_listener_(NULL),
40 surrounding_listener_(NULL) {
41 }
42
43 void IMEContext::CommitText(const string16& text) {
44 if (commit_text_listener_)
45 commit_text_listener_->OnCommitText(this, text);
46 }
47
48 void IMEContext::StartComposition() {
49 if (composition_listener_)
50 composition_listener_->OnStartComposition(this);
51 }
52
53 void IMEContext::EndComposition() {
54 if (composition_listener_)
55 composition_listener_->OnEndComposition(this);
56 }
57
58 void IMEContext::SetComposition(const string16& text,
59 const CompositionAttributeList& attributes,
60 uint32 cursor_pos) {
61 if (composition_listener_)
62 composition_listener_->OnSetComposition(this, text, attributes, cursor_pos);
63 }
64
65 void IMEContext::ForwardKeyEvent(const KeyEvent& event) {
66 if (forward_key_event_listener_)
67 forward_key_event_listener_->OnForwardKeyEvent(this, event);
68 }
69
70 bool IMEContext::SetSurroundingActive(bool active) {
71 if (surrounding_listener_)
72 return surrounding_listener_->OnSetSurroundingActive(this, active);
73 return false;
74 }
75
76 bool IMEContext::DeleteSurrounding(int offset, int nchars) {
77 if (surrounding_listener_)
78 return surrounding_listener_->OnDeleteSurrounding(this, offset, nchars);
79 return false;
80 }
81
82 #ifdef USE_DUMMY_IME_CONTEXT
83 IMEContext* IMEContext::Create(View* view) {
84 return new DummyIMEContext(view);
85 }
86 #endif // USE_DUMMY_IME_CONTEXT
87
88 } // namespace views
OLDNEW
« no previous file with comments | « views/ime/ime_context.h ('k') | views/views.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698