| 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/native_combobox_views.h" | 5 #include "ui/views/controls/combobox/native_combobox_views.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "grit/ui_resources.h" | 9 #include "grit/ui_resources.h" |
| 10 #include "ui/base/events/event.h" | 10 #include "ui/base/events/event.h" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 NOTREACHED(); | 154 NOTREACHED(); |
| 155 } | 155 } |
| 156 | 156 |
| 157 void NativeComboboxViews::OnBlur() { | 157 void NativeComboboxViews::OnBlur() { |
| 158 NOTREACHED(); | 158 NOTREACHED(); |
| 159 } | 159 } |
| 160 | 160 |
| 161 ///////////////////////////////////////////////////////////////// | 161 ///////////////////////////////////////////////////////////////// |
| 162 // NativeComboboxViews, ui::EventHandler overrides: | 162 // NativeComboboxViews, ui::EventHandler overrides: |
| 163 | 163 |
| 164 ui::EventResult NativeComboboxViews::OnGestureEvent(ui::GestureEvent* gesture) { | 164 void NativeComboboxViews::OnGestureEvent(ui::GestureEvent* gesture) { |
| 165 if (gesture->type() == ui::ET_GESTURE_TAP) { | 165 if (gesture->type() == ui::ET_GESTURE_TAP) { |
| 166 UpdateFromModel(); | 166 UpdateFromModel(); |
| 167 ShowDropDownMenu(); | 167 ShowDropDownMenu(); |
| 168 return ui::ER_CONSUMED; | 168 gesture->StopPropagation(); |
| 169 return; |
| 169 } | 170 } |
| 170 return View::OnGestureEvent(gesture); | 171 View::OnGestureEvent(gesture); |
| 171 } | 172 } |
| 172 | 173 |
| 173 ///////////////////////////////////////////////////////////////// | 174 ///////////////////////////////////////////////////////////////// |
| 174 // NativeComboboxViews, NativeComboboxWrapper overrides: | 175 // NativeComboboxViews, NativeComboboxWrapper overrides: |
| 175 | 176 |
| 176 void NativeComboboxViews::UpdateFromModel() { | 177 void NativeComboboxViews::UpdateFromModel() { |
| 177 int max_width = 0; | 178 int max_width = 0; |
| 178 const gfx::Font& font = Combobox::GetFont(); | 179 const gfx::Font& font = Combobox::GetFont(); |
| 179 | 180 |
| 180 MenuItemView* menu = new MenuItemView(this); | 181 MenuItemView* menu = new MenuItemView(this); |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 | 370 |
| 370 #if defined(USE_AURA) | 371 #if defined(USE_AURA) |
| 371 // static | 372 // static |
| 372 NativeComboboxWrapper* NativeComboboxWrapper::CreateWrapper( | 373 NativeComboboxWrapper* NativeComboboxWrapper::CreateWrapper( |
| 373 Combobox* combobox) { | 374 Combobox* combobox) { |
| 374 return new NativeComboboxViews(combobox); | 375 return new NativeComboboxViews(combobox); |
| 375 } | 376 } |
| 376 #endif | 377 #endif |
| 377 | 378 |
| 378 } // namespace views | 379 } // namespace views |
| OLD | NEW |