| 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/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "ui/base/accessibility/accessible_view_state.h" | 9 #include "ui/base/accessibility/accessible_view_state.h" |
| 10 #include "ui/base/keycodes/keyboard_codes.h" | 10 #include "ui/base/keycodes/keyboard_codes.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 PreferredSizeChanged(); | 47 PreferredSizeChanged(); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void Combobox::SetSelectedIndex(int index) { | 50 void Combobox::SetSelectedIndex(int index) { |
| 51 selected_index_ = index; | 51 selected_index_ = index; |
| 52 if (native_wrapper_) | 52 if (native_wrapper_) |
| 53 native_wrapper_->UpdateSelectedIndex(); | 53 native_wrapper_->UpdateSelectedIndex(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 void Combobox::SelectionChanged() { | 56 void Combobox::SelectionChanged() { |
| 57 int prev_selected_index = selected_index_; | |
| 58 selected_index_ = native_wrapper_->GetSelectedIndex(); | 57 selected_index_ = native_wrapper_->GetSelectedIndex(); |
| 59 if (listener_) | 58 if (listener_) |
| 60 listener_->ItemChanged(this, prev_selected_index, selected_index_); | 59 listener_->OnSelectedIndexChanged(this); |
| 61 if (GetWidget()) { | 60 if (GetWidget()) { |
| 62 GetWidget()->NotifyAccessibilityEvent( | 61 GetWidget()->NotifyAccessibilityEvent( |
| 63 this, ui::AccessibilityTypes::EVENT_VALUE_CHANGED, false); | 62 this, ui::AccessibilityTypes::EVENT_VALUE_CHANGED, false); |
| 64 } | 63 } |
| 65 } | 64 } |
| 66 | 65 |
| 67 void Combobox::SetAccessibleName(const string16& name) { | 66 void Combobox::SetAccessibleName(const string16& name) { |
| 68 accessible_name_ = name; | 67 accessible_name_ = name; |
| 69 } | 68 } |
| 70 | 69 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 native_wrapper_->UpdateSelectedIndex(); | 147 native_wrapper_->UpdateSelectedIndex(); |
| 149 native_wrapper_->UpdateEnabled(); | 148 native_wrapper_->UpdateEnabled(); |
| 150 } | 149 } |
| 151 } | 150 } |
| 152 | 151 |
| 153 std::string Combobox::GetClassName() const { | 152 std::string Combobox::GetClassName() const { |
| 154 return kViewClassName; | 153 return kViewClassName; |
| 155 } | 154 } |
| 156 | 155 |
| 157 } // namespace views | 156 } // namespace views |
| OLD | NEW |