OLD | NEW |
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/views/controls/textfield/textfield.h" | 5 #include "ui/views/controls/textfield/textfield.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 } | 142 } |
143 | 143 |
144 void Textfield::SetTextInputType(ui::TextInputType type) { | 144 void Textfield::SetTextInputType(ui::TextInputType type) { |
145 text_input_type_ = type; | 145 text_input_type_ = type; |
146 bool should_be_obscured = type == ui::TEXT_INPUT_TYPE_PASSWORD; | 146 bool should_be_obscured = type == ui::TEXT_INPUT_TYPE_PASSWORD; |
147 if (IsObscured() != should_be_obscured) | 147 if (IsObscured() != should_be_obscured) |
148 SetObscured(should_be_obscured); | 148 SetObscured(should_be_obscured); |
149 } | 149 } |
150 | 150 |
151 void Textfield::SetText(const string16& text) { | 151 void Textfield::SetText(const string16& text) { |
| 152 if (text == text_) |
| 153 return; |
152 text_ = text; | 154 text_ = text; |
153 if (native_wrapper_) | 155 if (native_wrapper_) |
154 native_wrapper_->UpdateText(); | 156 native_wrapper_->UpdateText(); |
155 } | 157 } |
156 | 158 |
157 void Textfield::AppendText(const string16& text) { | 159 void Textfield::AppendText(const string16& text) { |
158 text_ += text; | 160 text_ += text; |
159 if (native_wrapper_) | 161 if (native_wrapper_) |
160 native_wrapper_->AppendText(text); | 162 native_wrapper_->AppendText(text); |
161 } | 163 } |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( | 488 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( |
487 Textfield* field) { | 489 Textfield* field) { |
488 #if defined(OS_WIN) && !defined(USE_AURA) | 490 #if defined(OS_WIN) && !defined(USE_AURA) |
489 if (!UseNativeTextfieldViews()) | 491 if (!UseNativeTextfieldViews()) |
490 return new NativeTextfieldWin(field); | 492 return new NativeTextfieldWin(field); |
491 #endif | 493 #endif |
492 return new NativeTextfieldViews(field); | 494 return new NativeTextfieldViews(field); |
493 } | 495 } |
494 | 496 |
495 } // namespace views | 497 } // namespace views |
OLD | NEW |