| 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 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 dropdown_open_ = false; | 453 dropdown_open_ = false; |
| 454 closed_time_ = base::Time::Now(); | 454 closed_time_ = base::Time::Now(); |
| 455 | 455 |
| 456 // Need to explicitly clear mouse handler so that events get sent | 456 // Need to explicitly clear mouse handler so that events get sent |
| 457 // properly after the menu finishes running. If we don't do this, then | 457 // properly after the menu finishes running. If we don't do this, then |
| 458 // the first click to other parts of the UI is eaten. | 458 // the first click to other parts of the UI is eaten. |
| 459 SetMouseHandler(NULL); | 459 SetMouseHandler(NULL); |
| 460 } | 460 } |
| 461 | 461 |
| 462 void Combobox::OnSelectionChanged() { | 462 void Combobox::OnSelectionChanged() { |
| 463 NotifyAccessibilityEvent(ui::AccessibilityTypes::EVENT_VALUE_CHANGED, false); |
| 464 SchedulePaint(); |
| 463 if (listener_) | 465 if (listener_) |
| 464 listener_->OnSelectedIndexChanged(this); | 466 listener_->OnSelectedIndexChanged(this); |
| 465 NotifyAccessibilityEvent(ui::AccessibilityTypes::EVENT_VALUE_CHANGED, false); | |
| 466 SchedulePaint(); | |
| 467 } | 467 } |
| 468 | 468 |
| 469 int Combobox::MenuCommandToIndex(int menu_command_id) const { | 469 int Combobox::MenuCommandToIndex(int menu_command_id) const { |
| 470 // (note that the id received is offset by kFirstMenuItemId) | 470 // (note that the id received is offset by kFirstMenuItemId) |
| 471 // Revert menu ID offset to map back to combobox model. | 471 // Revert menu ID offset to map back to combobox model. |
| 472 int index = menu_command_id - kFirstMenuItemId; | 472 int index = menu_command_id - kFirstMenuItemId; |
| 473 DCHECK_LT(index, model()->GetItemCount()); | 473 DCHECK_LT(index, model()->GetItemCount()); |
| 474 return index; | 474 return index; |
| 475 } | 475 } |
| 476 | 476 |
| 477 } // namespace views | 477 } // namespace views |
| OLD | NEW |