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/combobox/combobox.h" | 5 #include "ui/views/controls/combobox/combobox.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "grit/ui_resources.h" | 9 #include "grit/ui_resources.h" |
10 #include "ui/base/accessibility/accessible_view_state.h" | 10 #include "ui/base/accessibility/accessible_view_state.h" |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 continue; | 342 continue; |
343 } | 343 } |
344 | 344 |
345 string16 text = model()->GetItemAt(i); | 345 string16 text = model()->GetItemAt(i); |
346 | 346 |
347 // Inserting the Unicode formatting characters if necessary so that the | 347 // Inserting the Unicode formatting characters if necessary so that the |
348 // text is displayed correctly in right-to-left UIs. | 348 // text is displayed correctly in right-to-left UIs. |
349 base::i18n::AdjustStringForLocaleDirection(&text); | 349 base::i18n::AdjustStringForLocaleDirection(&text); |
350 | 350 |
351 menu->AppendMenuItem(i + kFirstMenuItemId, text, MenuItemView::NORMAL); | 351 menu->AppendMenuItem(i + kFirstMenuItemId, text, MenuItemView::NORMAL); |
352 max_width = std::max(max_width, font.GetStringWidth(text)); | 352 max_width = std::max<int>(max_width, font.GetStringWidth(text)); |
353 } | 353 } |
354 | 354 |
355 content_size_.SetSize(max_width, font.GetHeight()); | 355 content_size_.SetSize(max_width, font.GetHeight()); |
356 } | 356 } |
357 | 357 |
358 void Combobox::AdjustBoundsForRTLUI(gfx::Rect* rect) const { | 358 void Combobox::AdjustBoundsForRTLUI(gfx::Rect* rect) const { |
359 rect->set_x(GetMirroredXForRect(*rect)); | 359 rect->set_x(GetMirroredXForRect(*rect)); |
360 } | 360 } |
361 | 361 |
362 void Combobox::PaintText(gfx::Canvas* canvas) { | 362 void Combobox::PaintText(gfx::Canvas* canvas) { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 } | 446 } |
447 | 447 |
448 void Combobox::OnSelectionChanged() { | 448 void Combobox::OnSelectionChanged() { |
449 if (listener_) | 449 if (listener_) |
450 listener_->OnSelectedIndexChanged(this); | 450 listener_->OnSelectedIndexChanged(this); |
451 NotifyAccessibilityEvent(ui::AccessibilityTypes::EVENT_VALUE_CHANGED, false); | 451 NotifyAccessibilityEvent(ui::AccessibilityTypes::EVENT_VALUE_CHANGED, false); |
452 SchedulePaint(); | 452 SchedulePaint(); |
453 } | 453 } |
454 | 454 |
455 } // namespace views | 455 } // namespace views |
OLD | NEW |