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 <string> | 8 #include <string> |
8 #include <vector> | 9 #include <vector> |
9 | 10 |
10 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
11 #include "base/logging.h" | 12 #include "base/logging.h" |
12 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
13 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
14 #include "webkit/plugins/npapi/plugin_constants_win.h" | 15 #include "webkit/plugins/npapi/plugin_constants_win.h" |
15 #include "webkit/plugins/npapi/plugin_instance.h" | 16 #include "webkit/plugins/npapi/plugin_instance.h" |
16 | 17 |
17 #pragma comment(lib, "imm32.lib") | 18 #pragma comment(lib, "imm32.lib") |
18 | 19 |
19 namespace webkit { | 20 namespace webkit { |
20 namespace npapi { | 21 namespace npapi { |
21 | 22 |
22 // A critical section that prevents two or more plug-ins from accessing a | 23 // A critical section that prevents two or more plug-ins from accessing a |
23 // WebPluginIMEWin instance through our patch function. | 24 // WebPluginIMEWin instance through our patch function. |
24 base::LazyInstance<base::Lock>::Leaky | 25 base::LazyInstance<base::Lock>::Leaky |
25 g_webplugin_ime_lock = LAZY_INSTANCE_INITIALIZER; | 26 g_webplugin_ime_lock = LAZY_INSTANCE_INITIALIZER; |
26 | 27 |
27 WebPluginIMEWin* WebPluginIMEWin::instance_ = NULL; | 28 WebPluginIMEWin* WebPluginIMEWin::instance_ = NULL; |
28 | 29 |
29 WebPluginIMEWin::WebPluginIMEWin() | 30 WebPluginIMEWin::WebPluginIMEWin() |
30 : cursor_position_(0), | 31 : cursor_position_(0), |
31 delta_start_(0), | 32 delta_start_(0), |
32 composing_text_(false), | 33 composing_text_(false), |
33 support_ime_messages_(false), | 34 support_ime_messages_(false), |
34 status_updated_(false), | 35 status_updated_(false), |
35 input_type_(1) { | 36 input_type_(1) { |
| 37 memset(result_clauses_, 0, sizeof(result_clauses_)); |
36 } | 38 } |
37 | 39 |
38 WebPluginIMEWin::~WebPluginIMEWin() { | 40 WebPluginIMEWin::~WebPluginIMEWin() { |
39 } | 41 } |
40 | 42 |
41 void WebPluginIMEWin::CompositionUpdated(const string16& text, | 43 void WebPluginIMEWin::CompositionUpdated(const string16& text, |
42 std::vector<int> clauses, | 44 std::vector<int> clauses, |
43 std::vector<int> target, | 45 std::vector<int> target, |
44 int cursor_position) { | 46 int cursor_position) { |
45 // 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. |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 if (instance->input_type_ != input_type) { | 316 if (instance->input_type_ != input_type) { |
315 instance->input_type_ = input_type; | 317 instance->input_type_ = input_type; |
316 instance->status_updated_ = true; | 318 instance->status_updated_ = true; |
317 } | 319 } |
318 | 320 |
319 return TRUE; | 321 return TRUE; |
320 } | 322 } |
321 | 323 |
322 } // namespace npapi | 324 } // namespace npapi |
323 } // namespace webkit | 325 } // namespace webkit |
OLD | NEW |