| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ui/base/ime/win/imm32_manager.h" | 5 #include "ui/base/ime/win/imm32_manager.h" |
| 6 | 6 |
| 7 #include <atlbase.h> | 7 #include <atlbase.h> |
| 8 #include <atlcom.h> | 8 #include <atlcom.h> |
| 9 #include <msctf.h> | 9 #include <msctf.h> |
| 10 | 10 |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 underline.end_offset = length; | 361 underline.end_offset = length; |
| 362 underline.thick = false; | 362 underline.thick = false; |
| 363 composition->underlines.push_back(underline); | 363 composition->underlines.push_back(underline); |
| 364 } | 364 } |
| 365 } | 365 } |
| 366 } | 366 } |
| 367 | 367 |
| 368 bool IMM32Manager::GetString(HIMC imm_context, | 368 bool IMM32Manager::GetString(HIMC imm_context, |
| 369 WPARAM lparam, | 369 WPARAM lparam, |
| 370 int type, | 370 int type, |
| 371 string16* result) { | 371 base::string16* result) { |
| 372 if (!(lparam & type)) | 372 if (!(lparam & type)) |
| 373 return false; | 373 return false; |
| 374 LONG string_size = ::ImmGetCompositionString(imm_context, type, NULL, 0); | 374 LONG string_size = ::ImmGetCompositionString(imm_context, type, NULL, 0); |
| 375 if (string_size <= 0) | 375 if (string_size <= 0) |
| 376 return false; | 376 return false; |
| 377 DCHECK_EQ(0u, string_size % sizeof(wchar_t)); | 377 DCHECK_EQ(0u, string_size % sizeof(wchar_t)); |
| 378 ::ImmGetCompositionString(imm_context, type, | 378 ::ImmGetCompositionString(imm_context, type, |
| 379 WriteInto(result, (string_size / sizeof(wchar_t)) + 1), string_size); | 379 WriteInto(result, (string_size / sizeof(wchar_t)) + 1), string_size); |
| 380 return true; | 380 return true; |
| 381 } | 381 } |
| 382 | 382 |
| 383 bool IMM32Manager::GetResult( | 383 bool IMM32Manager::GetResult( |
| 384 HWND window_handle, LPARAM lparam, string16* result) { | 384 HWND window_handle, LPARAM lparam, base::string16* result) { |
| 385 bool ret = false; | 385 bool ret = false; |
| 386 HIMC imm_context = ::ImmGetContext(window_handle); | 386 HIMC imm_context = ::ImmGetContext(window_handle); |
| 387 if (imm_context) { | 387 if (imm_context) { |
| 388 ret = GetString(imm_context, lparam, GCS_RESULTSTR, result); | 388 ret = GetString(imm_context, lparam, GCS_RESULTSTR, result); |
| 389 ::ImmReleaseContext(window_handle, imm_context); | 389 ::ImmReleaseContext(window_handle, imm_context); |
| 390 } | 390 } |
| 391 return ret; | 391 return ret; |
| 392 } | 392 } |
| 393 | 393 |
| 394 bool IMM32Manager::GetComposition(HWND window_handle, LPARAM lparam, | 394 bool IMM32Manager::GetComposition(HWND window_handle, LPARAM lparam, |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 | IME_CMODE_KATAKANA | 638 | IME_CMODE_KATAKANA |
| 639 | IME_CMODE_FULLSHAPE); | 639 | IME_CMODE_FULLSHAPE); |
| 640 break; | 640 break; |
| 641 default: | 641 default: |
| 642 *open = FALSE; | 642 *open = FALSE; |
| 643 break; | 643 break; |
| 644 } | 644 } |
| 645 } | 645 } |
| 646 | 646 |
| 647 } // namespace ui | 647 } // namespace ui |
| OLD | NEW |