OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "webkit/plugins/npapi/webplugin_ime_win.h" | 5 #include "webkit/plugins/npapi/webplugin_ime_win.h" |
6 | 6 |
7 #include <cstring> | 7 #include <cstring> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... |
33 composing_text_(false), | 33 composing_text_(false), |
34 support_ime_messages_(false), | 34 support_ime_messages_(false), |
35 status_updated_(false), | 35 status_updated_(false), |
36 input_type_(1) { | 36 input_type_(1) { |
37 memset(result_clauses_, 0, sizeof(result_clauses_)); | 37 memset(result_clauses_, 0, sizeof(result_clauses_)); |
38 } | 38 } |
39 | 39 |
40 WebPluginIMEWin::~WebPluginIMEWin() { | 40 WebPluginIMEWin::~WebPluginIMEWin() { |
41 } | 41 } |
42 | 42 |
43 void WebPluginIMEWin::CompositionUpdated(const string16& text, | 43 void WebPluginIMEWin::CompositionUpdated(const base::string16& text, |
44 std::vector<int> clauses, | 44 std::vector<int> clauses, |
45 std::vector<int> target, | 45 std::vector<int> target, |
46 int cursor_position) { | 46 int cursor_position) { |
47 // Send a WM_IME_STARTCOMPOSITION message when a user starts a composition. | 47 // Send a WM_IME_STARTCOMPOSITION message when a user starts a composition. |
48 NPEvent np_event; | 48 NPEvent np_event; |
49 if (!composing_text_) { | 49 if (!composing_text_) { |
50 composing_text_ = true; | 50 composing_text_ = true; |
51 result_text_.clear(); | 51 result_text_.clear(); |
52 | 52 |
53 np_event.event = WM_IME_STARTCOMPOSITION; | 53 np_event.event = WM_IME_STARTCOMPOSITION; |
(...skipping 27 matching lines...) Expand all Loading... |
81 for (int i = target[0]; i < target[1]; ++i) | 81 for (int i = target[0]; i < target[1]; ++i) |
82 composition_attributes_[i] = ATTR_TARGET_CONVERTED; | 82 composition_attributes_[i] = ATTR_TARGET_CONVERTED; |
83 } else { | 83 } else { |
84 composition_attributes_.assign(text.length(), ATTR_INPUT); | 84 composition_attributes_.assign(text.length(), ATTR_INPUT); |
85 } | 85 } |
86 | 86 |
87 cursor_position_ = cursor_position; | 87 cursor_position_ = cursor_position; |
88 delta_start_ = cursor_position; | 88 delta_start_ = cursor_position; |
89 } | 89 } |
90 | 90 |
91 void WebPluginIMEWin::CompositionCompleted(const string16& text) { | 91 void WebPluginIMEWin::CompositionCompleted(const base::string16& text) { |
92 composing_text_ = false; | 92 composing_text_ = false; |
93 | 93 |
94 // We should update the following values when we finish a composition: | 94 // We should update the following values when we finish a composition: |
95 // GCS_RESULTSTR, GCS_RESULTCLAUSE, GCS_CURSORPOS, and GCS_DELTASTART. We | 95 // GCS_RESULTSTR, GCS_RESULTCLAUSE, GCS_CURSORPOS, and GCS_DELTASTART. We |
96 // send a WM_IME_COMPOSITION message to notify the list of updated values. | 96 // send a WM_IME_COMPOSITION message to notify the list of updated values. |
97 NPEvent np_event; | 97 NPEvent np_event; |
98 np_event.event = WM_IME_COMPOSITION; | 98 np_event.event = WM_IME_COMPOSITION; |
99 np_event.wParam = 0; | 99 np_event.wParam = 0; |
100 np_event.lParam = GCS_CURSORPOS | GCS_DELTASTART | GCS_RESULTSTR | | 100 np_event.lParam = GCS_CURSORPOS | GCS_DELTASTART | GCS_RESULTSTR | |
101 GCS_RESULTCLAUSE; | 101 GCS_RESULTCLAUSE; |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 if (instance->input_type_ != input_type) { | 316 if (instance->input_type_ != input_type) { |
317 instance->input_type_ = input_type; | 317 instance->input_type_ = input_type; |
318 instance->status_updated_ = true; | 318 instance->status_updated_ = true; |
319 } | 319 } |
320 | 320 |
321 return TRUE; | 321 return TRUE; |
322 } | 322 } |
323 | 323 |
324 } // namespace npapi | 324 } // namespace npapi |
325 } // namespace webkit | 325 } // namespace webkit |
OLD | NEW |