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

Side by Side Diff: ui/base/win/ime_input.cc

Issue 11878022: ui: Convert scoped_arrays to the new scoped_ptr style. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 months 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 | « ui/base/gestures/velocity_calculator.h ('k') | ui/base/x/x11_atom_cache.cc » ('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) 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 "ui/base/win/ime_input.h" 5 #include "ui/base/win/ime_input.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/string16.h" 9 #include "base/string16.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 24 matching lines...) Expand all
35 35
36 // Helper function for ImeInput::GetCompositionInfo() method, to get the target 36 // Helper function for ImeInput::GetCompositionInfo() method, to get the target
37 // range that's selected by the user in the current composition string. 37 // range that's selected by the user in the current composition string.
38 void GetCompositionTargetRange(HIMC imm_context, int* target_start, 38 void GetCompositionTargetRange(HIMC imm_context, int* target_start,
39 int* target_end) { 39 int* target_end) {
40 int attribute_size = ::ImmGetCompositionString(imm_context, GCS_COMPATTR, 40 int attribute_size = ::ImmGetCompositionString(imm_context, GCS_COMPATTR,
41 NULL, 0); 41 NULL, 0);
42 if (attribute_size > 0) { 42 if (attribute_size > 0) {
43 int start = 0; 43 int start = 0;
44 int end = 0; 44 int end = 0;
45 scoped_array<char> attribute_data(new char[attribute_size]); 45 scoped_ptr<char[]> attribute_data(new char[attribute_size]);
46 if (attribute_data.get()) { 46 if (attribute_data.get()) {
47 ::ImmGetCompositionString(imm_context, GCS_COMPATTR, 47 ::ImmGetCompositionString(imm_context, GCS_COMPATTR,
48 attribute_data.get(), attribute_size); 48 attribute_data.get(), attribute_size);
49 for (start = 0; start < attribute_size; ++start) { 49 for (start = 0; start < attribute_size; ++start) {
50 if (IsTargetAttribute(attribute_data[start])) 50 if (IsTargetAttribute(attribute_data[start]))
51 break; 51 break;
52 } 52 }
53 for (end = start; end < attribute_size; ++end) { 53 for (end = start; end < attribute_size; ++end) {
54 if (!IsTargetAttribute(attribute_data[end])) 54 if (!IsTargetAttribute(attribute_data[end]))
55 break; 55 break;
(...skipping 14 matching lines...) Expand all
70 // Helper function for ImeInput::GetCompositionInfo() method, to get underlines 70 // Helper function for ImeInput::GetCompositionInfo() method, to get underlines
71 // information of the current composition string. 71 // information of the current composition string.
72 void GetCompositionUnderlines(HIMC imm_context, 72 void GetCompositionUnderlines(HIMC imm_context,
73 int target_start, 73 int target_start,
74 int target_end, 74 int target_end,
75 ui::CompositionUnderlines* underlines) { 75 ui::CompositionUnderlines* underlines) {
76 int clause_size = ::ImmGetCompositionString(imm_context, GCS_COMPCLAUSE, 76 int clause_size = ::ImmGetCompositionString(imm_context, GCS_COMPCLAUSE,
77 NULL, 0); 77 NULL, 0);
78 int clause_length = clause_size / sizeof(uint32); 78 int clause_length = clause_size / sizeof(uint32);
79 if (clause_length) { 79 if (clause_length) {
80 scoped_array<uint32> clause_data(new uint32[clause_length]); 80 scoped_ptr<uint32[]> clause_data(new uint32[clause_length]);
81 if (clause_data.get()) { 81 if (clause_data.get()) {
82 ::ImmGetCompositionString(imm_context, GCS_COMPCLAUSE, 82 ::ImmGetCompositionString(imm_context, GCS_COMPCLAUSE,
83 clause_data.get(), clause_size); 83 clause_data.get(), clause_size);
84 for (int i = 0; i < clause_length - 1; ++i) { 84 for (int i = 0; i < clause_length - 1; ++i) {
85 ui::CompositionUnderline underline; 85 ui::CompositionUnderline underline;
86 underline.start_offset = clause_data[i]; 86 underline.start_offset = clause_data[i];
87 underline.end_offset = clause_data[i+1]; 87 underline.end_offset = clause_data[i+1];
88 underline.color = SK_ColorBLACK; 88 underline.color = SK_ColorBLACK;
89 underline.thick = false; 89 underline.thick = false;
90 90
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 508
509 // Retrieve the number of layouts installed in this system. 509 // Retrieve the number of layouts installed in this system.
510 int size = GetKeyboardLayoutList(0, NULL); 510 int size = GetKeyboardLayoutList(0, NULL);
511 if (size <= 0) { 511 if (size <= 0) {
512 layout = RTL_KEYBOARD_LAYOUT_ERROR; 512 layout = RTL_KEYBOARD_LAYOUT_ERROR;
513 return false; 513 return false;
514 } 514 }
515 515
516 // Retrieve the keyboard layouts in an array and check if there is an RTL 516 // Retrieve the keyboard layouts in an array and check if there is an RTL
517 // layout in it. 517 // layout in it.
518 scoped_array<HKL> layouts(new HKL[size]); 518 scoped_ptr<HKL[]> layouts(new HKL[size]);
519 ::GetKeyboardLayoutList(size, layouts.get()); 519 ::GetKeyboardLayoutList(size, layouts.get());
520 for (int i = 0; i < size; ++i) { 520 for (int i = 0; i < size; ++i) {
521 if (IsRTLPrimaryLangID(PRIMARYLANGID(layouts[i]))) { 521 if (IsRTLPrimaryLangID(PRIMARYLANGID(layouts[i]))) {
522 layout = RTL_KEYBOARD_LAYOUT_INSTALLED; 522 layout = RTL_KEYBOARD_LAYOUT_INSTALLED;
523 return true; 523 return true;
524 } 524 }
525 } 525 }
526 526
527 layout = RTL_KEYBOARD_LAYOUT_NOT_INSTALLED; 527 layout = RTL_KEYBOARD_LAYOUT_NOT_INSTALLED;
528 return false; 528 return false;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 keystate[VK_RCONTROL] = 0; 566 keystate[VK_RCONTROL] = 0;
567 keystate[VK_LCONTROL] = 0; 567 keystate[VK_LCONTROL] = 0;
568 for (int i = 0; i <= VK_PACKET; ++i) { 568 for (int i = 0; i <= VK_PACKET; ++i) {
569 if (keystate[i] & kKeyDownMask) 569 if (keystate[i] & kKeyDownMask)
570 return false; 570 return false;
571 } 571 }
572 return true; 572 return true;
573 } 573 }
574 574
575 } // namespace ui 575 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/gestures/velocity_calculator.h ('k') | ui/base/x/x11_atom_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698