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

Side by Side Diff: views/controls/textfield/textfield.cc

Issue 6675005: Integrate the new input method API for Views into Chromium. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: TouchUI: Always dispatch key events to the input method. Created 9 years, 9 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
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/controls/textfield/textfield.h" 5 #include "views/controls/textfield/textfield.h"
6 6
7 #if defined(OS_LINUX) 7 #if defined(OS_LINUX)
8 #include <gdk/gdkkeysyms.h> 8 #include <gdk/gdkkeysyms.h>
9 #endif 9 #endif
10 10
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 native_wrapper_->UpdateFont(); 237 native_wrapper_->UpdateFont();
238 native_wrapper_->UpdateEnabled(); 238 native_wrapper_->UpdateEnabled();
239 native_wrapper_->UpdateBorder(); 239 native_wrapper_->UpdateBorder();
240 native_wrapper_->UpdateIsPassword(); 240 native_wrapper_->UpdateIsPassword();
241 native_wrapper_->UpdateHorizontalMargins(); 241 native_wrapper_->UpdateHorizontalMargins();
242 native_wrapper_->UpdateVerticalMargins(); 242 native_wrapper_->UpdateVerticalMargins();
243 } 243 }
244 } 244 }
245 245
246 void Textfield::SyncText() { 246 void Textfield::SyncText() {
247 if (native_wrapper_) 247 if (native_wrapper_) {
248 text_ = native_wrapper_->GetText(); 248 string16 new_text = native_wrapper_->GetText();
249 if (new_text != text_) {
250 text_ = new_text;
251 if (controller_)
252 controller_->ContentsChanged(this, text_);
253 }
254 }
249 } 255 }
250 256
251 bool Textfield::IsIMEComposing() const { 257 bool Textfield::IsIMEComposing() const {
252 return native_wrapper_ && native_wrapper_->IsIMEComposing(); 258 return native_wrapper_ && native_wrapper_->IsIMEComposing();
253 } 259 }
254 260
255 void Textfield::GetSelectedRange(ui::Range* range) const { 261 void Textfield::GetSelectedRange(ui::Range* range) const {
256 DCHECK(native_wrapper_); 262 DCHECK(native_wrapper_);
257 native_wrapper_->GetSelectedRange(range); 263 native_wrapper_->GetSelectedRange(range);
258 } 264 }
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 state->state |= ui::AccessibilityTypes::STATE_PROTECTED; 366 state->state |= ui::AccessibilityTypes::STATE_PROTECTED;
361 state->value = text_; 367 state->value = text_;
362 368
363 DCHECK(native_wrapper_); 369 DCHECK(native_wrapper_);
364 ui::Range range; 370 ui::Range range;
365 native_wrapper_->GetSelectedRange(&range); 371 native_wrapper_->GetSelectedRange(&range);
366 state->selection_start = range.start(); 372 state->selection_start = range.start();
367 state->selection_end = range.end(); 373 state->selection_end = range.end();
368 } 374 }
369 375
376 TextInputClient* Textfield::GetTextInputClient() {
377 return native_wrapper_ ? native_wrapper_->GetTextInputClient() : NULL;
378 }
379
370 void Textfield::SetEnabled(bool enabled) { 380 void Textfield::SetEnabled(bool enabled) {
371 View::SetEnabled(enabled); 381 View::SetEnabled(enabled);
372 if (native_wrapper_) 382 if (native_wrapper_)
373 native_wrapper_->UpdateEnabled(); 383 native_wrapper_->UpdateEnabled();
374 } 384 }
375 385
376 void Textfield::ViewHierarchyChanged(bool is_add, View* parent, View* child) { 386 void Textfield::ViewHierarchyChanged(bool is_add, View* parent, View* child) {
377 if (is_add && !native_wrapper_ && GetWidget() && !initialized_) { 387 if (is_add && !native_wrapper_ && GetWidget() && !initialized_) {
378 initialized_ = true; 388 initialized_ = true;
379 389
(...skipping 17 matching lines...) Expand all
397 } 407 }
398 #endif 408 #endif
399 } 409 }
400 } 410 }
401 411
402 std::string Textfield::GetClassName() const { 412 std::string Textfield::GetClassName() const {
403 return kViewClassName; 413 return kViewClassName;
404 } 414 }
405 415
406 } // namespace views 416 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698