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

Side by Side Diff: ui/base/ime/win/tsf_text_store.cc

Issue 117983002: Prefix string16 with base:: in ui/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 7 years 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/ime/win/tsf_text_store.h ('k') | ui/base/ime/win/tsf_text_store_unittest.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 #define INITGUID // required for GUID_PROP_INPUTSCOPE 5 #define INITGUID // required for GUID_PROP_INPUTSCOPE
6 #include "ui/base/ime/win/tsf_text_store.h" 6 #include "ui/base/ime/win/tsf_text_store.h"
7 7
8 #include <InputScope.h> 8 #include <InputScope.h>
9 #include <OleCtl.h> 9 #include <OleCtl.h>
10 10
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 if (acp_end == -1) 246 if (acp_end == -1)
247 acp_end = string_buffer_size; 247 acp_end = string_buffer_size;
248 if (!((0 <= acp_start) && 248 if (!((0 <= acp_start) &&
249 (acp_start <= acp_end) && 249 (acp_start <= acp_end) &&
250 (acp_end <= string_buffer_size))) { 250 (acp_end <= string_buffer_size))) {
251 return TF_E_INVALIDPOS; 251 return TF_E_INVALIDPOS;
252 } 252 }
253 acp_end = std::min(acp_end, acp_start + static_cast<LONG>(text_buffer_size)); 253 acp_end = std::min(acp_end, acp_start + static_cast<LONG>(text_buffer_size));
254 *text_buffer_copied = acp_end - acp_start; 254 *text_buffer_copied = acp_end - acp_start;
255 255
256 const string16& result = 256 const base::string16& result =
257 string_buffer_.substr(acp_start, *text_buffer_copied); 257 string_buffer_.substr(acp_start, *text_buffer_copied);
258 for (size_t i = 0; i < result.size(); ++i) { 258 for (size_t i = 0; i < result.size(); ++i) {
259 text_buffer[i] = result[i]; 259 text_buffer[i] = result[i];
260 } 260 }
261 261
262 if (run_info_buffer_size) { 262 if (run_info_buffer_size) {
263 run_info_buffer[0].uCount = *text_buffer_copied; 263 run_info_buffer[0].uCount = *text_buffer_copied;
264 run_info_buffer[0].type = TS_RT_PLAIN; 264 run_info_buffer[0].type = TS_RT_PLAIN;
265 *run_info_buffer_copied = 1; 265 *run_info_buffer_copied = 1;
266 } 266 }
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 return S_OK; 405 return S_OK;
406 } 406 }
407 407
408 if (!HasReadWriteLock()) 408 if (!HasReadWriteLock())
409 return TS_E_NOLOCK; 409 return TS_E_NOLOCK;
410 if (!text_buffer) 410 if (!text_buffer)
411 return E_INVALIDARG; 411 return E_INVALIDARG;
412 412
413 DCHECK_LE(start_pos, end_pos); 413 DCHECK_LE(start_pos, end_pos);
414 string_buffer_ = string_buffer_.substr(0, start_pos) + 414 string_buffer_ = string_buffer_.substr(0, start_pos) +
415 string16(text_buffer, text_buffer + text_buffer_size) + 415 base::string16(text_buffer, text_buffer + text_buffer_size) +
416 string_buffer_.substr(end_pos); 416 string_buffer_.substr(end_pos);
417 if (acp_start) 417 if (acp_start)
418 *acp_start = start_pos; 418 *acp_start = start_pos;
419 if (acp_end) 419 if (acp_end)
420 *acp_end = new_end_pos; 420 *acp_end = new_end_pos;
421 if (text_change) { 421 if (text_change) {
422 text_change->acpStart = start_pos; 422 text_change->acpStart = start_pos;
423 text_change->acpOldEnd = end_pos; 423 text_change->acpOldEnd = end_pos;
424 text_change->acpNewEnd = new_end_pos; 424 text_change->acpNewEnd = new_end_pos;
425 } 425 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 current_lock_type_ = 0; 516 current_lock_type_ = 0;
517 } 517 }
518 518
519 if (!edit_flag_) { 519 if (!edit_flag_) {
520 return S_OK; 520 return S_OK;
521 } 521 }
522 522
523 // If the text store is edited in OnLockGranted(), we may need to call 523 // If the text store is edited in OnLockGranted(), we may need to call
524 // TextInputClient::InsertText() or TextInputClient::SetCompositionText(). 524 // TextInputClient::InsertText() or TextInputClient::SetCompositionText().
525 const size_t new_committed_size = committed_size_; 525 const size_t new_committed_size = committed_size_;
526 const string16& new_committed_string = 526 const base::string16& new_committed_string =
527 string_buffer_.substr(last_committed_size, 527 string_buffer_.substr(last_committed_size,
528 new_committed_size - last_committed_size); 528 new_committed_size - last_committed_size);
529 const string16& composition_string = 529 const base::string16& composition_string =
530 string_buffer_.substr(new_committed_size); 530 string_buffer_.substr(new_committed_size);
531 531
532 // If there is new committed string, calls TextInputClient::InsertText(). 532 // If there is new committed string, calls TextInputClient::InsertText().
533 if ((!new_committed_string.empty()) && text_input_client_) { 533 if ((!new_committed_string.empty()) && text_input_client_) {
534 text_input_client_->InsertText(new_committed_string); 534 text_input_client_->InsertText(new_committed_string);
535 } 535 }
536 536
537 // Calls TextInputClient::SetCompositionText(). 537 // Calls TextInputClient::SetCompositionText().
538 CompositionText composition_text; 538 CompositionText composition_text;
539 composition_text.text = composition_string; 539 composition_text.text = composition_string;
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 if (edit_flag_) 877 if (edit_flag_)
878 return false; 878 return false;
879 879
880 if (string_buffer_.empty()) 880 if (string_buffer_.empty())
881 return true; 881 return true;
882 882
883 // See the comment in TSFTextStore::CancelComposition. 883 // See the comment in TSFTextStore::CancelComposition.
884 // This logic is based on the observation about how to emulate 884 // This logic is based on the observation about how to emulate
885 // ImmNotifyIME(NI_COMPOSITIONSTR, CPS_COMPLETE, 0) by CUAS. 885 // ImmNotifyIME(NI_COMPOSITIONSTR, CPS_COMPLETE, 0) by CUAS.
886 886
887 const string16& composition_text = string_buffer_.substr(committed_size_); 887 const base::string16& composition_text =
888 string_buffer_.substr(committed_size_);
888 if (!composition_text.empty()) 889 if (!composition_text.empty())
889 text_input_client_->InsertText(composition_text); 890 text_input_client_->InsertText(composition_text);
890 891
891 const size_t previous_buffer_size = string_buffer_.size(); 892 const size_t previous_buffer_size = string_buffer_.size();
892 string_buffer_.clear(); 893 string_buffer_.clear();
893 committed_size_ = 0; 894 committed_size_ = 0;
894 selection_.set_start(0); 895 selection_.set_start(0);
895 selection_.set_end(0); 896 selection_.set_end(0);
896 if (text_store_acp_sink_mask_ & TS_AS_SEL_CHANGE) 897 if (text_store_acp_sink_mask_ & TS_AS_SEL_CHANGE)
897 text_store_acp_sink_->OnSelectionChange(); 898 text_store_acp_sink_->OnSelectionChange();
(...skipping 16 matching lines...) Expand all
914 915
915 bool TSFTextStore::HasReadLock() const { 916 bool TSFTextStore::HasReadLock() const {
916 return (current_lock_type_ & TS_LF_READ) == TS_LF_READ; 917 return (current_lock_type_ & TS_LF_READ) == TS_LF_READ;
917 } 918 }
918 919
919 bool TSFTextStore::HasReadWriteLock() const { 920 bool TSFTextStore::HasReadWriteLock() const {
920 return (current_lock_type_ & TS_LF_READWRITE) == TS_LF_READWRITE; 921 return (current_lock_type_ & TS_LF_READWRITE) == TS_LF_READWRITE;
921 } 922 }
922 923
923 } // namespace ui 924 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/ime/win/tsf_text_store.h ('k') | ui/base/ime/win/tsf_text_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698