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