| OLD | NEW |
| 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 if (native_wrapper_) | 134 if (native_wrapper_) |
| 135 return native_wrapper_->GetSelectedText(); | 135 return native_wrapper_->GetSelectedText(); |
| 136 return string16(); | 136 return string16(); |
| 137 } | 137 } |
| 138 | 138 |
| 139 void Textfield::ClearSelection() const { | 139 void Textfield::ClearSelection() const { |
| 140 if (native_wrapper_) | 140 if (native_wrapper_) |
| 141 native_wrapper_->ClearSelection(); | 141 native_wrapper_->ClearSelection(); |
| 142 } | 142 } |
| 143 | 143 |
| 144 bool Textfield::HasSelection() const { |
| 145 ui::Range range; |
| 146 if (native_wrapper_) |
| 147 native_wrapper_->GetSelectedRange(&range); |
| 148 return !range.is_empty(); |
| 149 } |
| 150 |
| 144 void Textfield::SetTextColor(SkColor color) { | 151 void Textfield::SetTextColor(SkColor color) { |
| 145 text_color_ = color; | 152 text_color_ = color; |
| 146 use_default_text_color_ = false; | 153 use_default_text_color_ = false; |
| 147 if (native_wrapper_) | 154 if (native_wrapper_) |
| 148 native_wrapper_->UpdateTextColor(); | 155 native_wrapper_->UpdateTextColor(); |
| 149 } | 156 } |
| 150 | 157 |
| 151 void Textfield::UseDefaultTextColor() { | 158 void Textfield::UseDefaultTextColor() { |
| 152 use_default_text_color_ = true; | 159 use_default_text_color_ = true; |
| 153 if (native_wrapper_) | 160 if (native_wrapper_) |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 } | 397 } |
| 391 #endif | 398 #endif |
| 392 } | 399 } |
| 393 } | 400 } |
| 394 | 401 |
| 395 std::string Textfield::GetClassName() const { | 402 std::string Textfield::GetClassName() const { |
| 396 return kViewClassName; | 403 return kViewClassName; |
| 397 } | 404 } |
| 398 | 405 |
| 399 } // namespace views | 406 } // namespace views |
| OLD | NEW |