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

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

Issue 8509034: Move views/ime/text_input_client.h to ui/base/ime/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more win_shared fix Created 9 years, 1 month 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/input_method_wayland.cc ('k') | views/ime/mock_input_method.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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 "views/ime/input_method_win.h" 5 #include "views/ime/input_method_win.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "ui/base/ime/composition_text.h"
11 #include "ui/base/ime/text_input_client.h"
10 #include "ui/base/keycodes/keyboard_codes.h" 12 #include "ui/base/keycodes/keyboard_codes.h"
11 #include "views/events/event.h" 13 #include "views/events/event.h"
12 14
13 // Extra number of chars before and after selection (or composition) range which 15 // Extra number of chars before and after selection (or composition) range which
14 // is returned to IME for improving conversion accuracy. 16 // is returned to IME for improving conversion accuracy.
15 static const size_t kExtraNumberOfChars = 20; 17 static const size_t kExtraNumberOfChars = 20;
16 18
17 namespace views { 19 namespace views {
18 20
19 InputMethodWin::InputMethodWin(internal::InputMethodDelegate* delegate) 21 InputMethodWin::InputMethodWin(internal::InputMethodDelegate* delegate)
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 ui::CompositionText composition; 280 ui::CompositionText composition;
279 composition.text.assign(1, static_cast<char16>(wparam)); 281 composition.text.assign(1, static_cast<char16>(wparam));
280 composition.selection = ui::Range(0, 1); 282 composition.selection = ui::Range(0, 1);
281 composition.underlines.push_back( 283 composition.underlines.push_back(
282 ui::CompositionUnderline(0, 1, SK_ColorBLACK, false)); 284 ui::CompositionUnderline(0, 1, SK_ColorBLACK, false));
283 GetTextInputClient()->SetCompositionText(composition); 285 GetTextInputClient()->SetCompositionText(composition);
284 return 0; 286 return 0;
285 } 287 }
286 288
287 LRESULT InputMethodWin::OnDocumentFeed(RECONVERTSTRING* reconv) { 289 LRESULT InputMethodWin::OnDocumentFeed(RECONVERTSTRING* reconv) {
288 TextInputClient* client = GetTextInputClient(); 290 ui::TextInputClient* client = GetTextInputClient();
289 if (!client) 291 if (!client)
290 return 0; 292 return 0;
291 293
292 ui::Range text_range; 294 ui::Range text_range;
293 if (!client->GetTextRange(&text_range) || text_range.is_empty()) 295 if (!client->GetTextRange(&text_range) || text_range.is_empty())
294 return 0; 296 return 0;
295 297
296 bool result = false; 298 bool result = false;
297 ui::Range target_range; 299 ui::Range target_range;
298 if (client->HasCompositionText()) 300 if (client->HasCompositionText())
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 memcpy((char*)reconv + sizeof(RECONVERTSTRING), 343 memcpy((char*)reconv + sizeof(RECONVERTSTRING),
342 text.c_str(), len * sizeof(WCHAR)); 344 text.c_str(), len * sizeof(WCHAR));
343 345
344 // According to Microsft API document, IMR_RECONVERTSTRING and 346 // According to Microsft API document, IMR_RECONVERTSTRING and
345 // IMR_DOCUMENTFEED should return reconv, but some applications return 347 // IMR_DOCUMENTFEED should return reconv, but some applications return
346 // need_size. 348 // need_size.
347 return reinterpret_cast<LRESULT>(reconv); 349 return reinterpret_cast<LRESULT>(reconv);
348 } 350 }
349 351
350 LRESULT InputMethodWin::OnReconvertString(RECONVERTSTRING* reconv) { 352 LRESULT InputMethodWin::OnReconvertString(RECONVERTSTRING* reconv) {
351 TextInputClient* client = GetTextInputClient(); 353 ui::TextInputClient* client = GetTextInputClient();
352 if (!client) 354 if (!client)
353 return 0; 355 return 0;
354 356
355 // If there is a composition string already, we don't allow reconversion. 357 // If there is a composition string already, we don't allow reconversion.
356 if (client->HasCompositionText()) 358 if (client->HasCompositionText())
357 return 0; 359 return 0;
358 360
359 ui::Range text_range; 361 ui::Range text_range;
360 if (!client->GetTextRange(&text_range) || text_range.is_empty()) 362 if (!client->GetTextRange(&text_range) || text_range.is_empty())
361 return 0; 363 return 0;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 case ui::TEXT_INPUT_TYPE_PASSWORD: 422 case ui::TEXT_INPUT_TYPE_PASSWORD:
421 ime_input_.DisableIME(hwnd()); 423 ime_input_.DisableIME(hwnd());
422 break; 424 break;
423 default: 425 default:
424 ime_input_.EnableIME(hwnd()); 426 ime_input_.EnableIME(hwnd());
425 break; 427 break;
426 } 428 }
427 } 429 }
428 430
429 } // namespace views 431 } // namespace views
OLDNEW
« no previous file with comments | « views/ime/input_method_wayland.cc ('k') | views/ime/mock_input_method.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698