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

Side by Side Diff: chrome/browser/chromeos/input_method/input_method_engine.cc

Issue 163023002: Use base::string16 for CompositionText.Text instead of converting to utf-8 and back unnecessarily. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix unit test compile Created 6 years, 10 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 | « no previous file | chrome/browser/chromeos/input_method/input_method_engine_browsertests.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 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 "chrome/browser/chromeos/input_method/input_method_engine.h" 5 #include "chrome/browser/chromeos/input_method/input_method_engine.h"
6 6
7 #define XK_MISCELLANY 7 #define XK_MISCELLANY
8 #include <X11/keysymdef.h> 8 #include <X11/keysymdef.h>
9 #include <X11/X.h> 9 #include <X11/X.h>
10 #include <X11/Xlib.h> 10 #include <X11/Xlib.h>
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 *error = kErrorNotActive; 137 *error = kErrorNotActive;
138 return false; 138 return false;
139 } 139 }
140 if (context_id != context_id_ || context_id_ == -1) { 140 if (context_id != context_id_ || context_id_ == -1) {
141 *error = kErrorWrongContext; 141 *error = kErrorWrongContext;
142 return false; 142 return false;
143 } 143 }
144 144
145 composition_cursor_ = cursor; 145 composition_cursor_ = cursor;
146 composition_text_.reset(new CompositionText()); 146 composition_text_.reset(new CompositionText());
147 composition_text_->set_text(text); 147 composition_text_->set_text(base::UTF8ToUTF16(text));
148 148
149 composition_text_->set_selection_start(selection_start); 149 composition_text_->set_selection_start(selection_start);
150 composition_text_->set_selection_end(selection_end); 150 composition_text_->set_selection_end(selection_end);
151 151
152 // TODO: Add support for displaying selected text in the composition string. 152 // TODO: Add support for displaying selected text in the composition string.
153 for (std::vector<SegmentInfo>::const_iterator segment = segments.begin(); 153 for (std::vector<SegmentInfo>::const_iterator segment = segments.begin();
154 segment != segments.end(); ++segment) { 154 segment != segments.end(); ++segment) {
155 CompositionText::UnderlineAttribute underline; 155 CompositionText::UnderlineAttribute underline;
156 156
157 switch (segment->style) { 157 switch (segment->style) {
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 // TODO(nona): Implement it. 618 // TODO(nona): Implement it.
619 break; 619 break;
620 } 620 }
621 } 621 }
622 } 622 }
623 623
624 // TODO(nona): Support item.children. 624 // TODO(nona): Support item.children.
625 } 625 }
626 626
627 } // namespace chromeos 627 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/input_method/input_method_engine_browsertests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698