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

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

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