| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 gfx::Rect lb = GetLocalBounds(); | 354 gfx::Rect lb = GetLocalBounds(); |
| 355 gfx::Point menu_position(lb.origin()); | 355 gfx::Point menu_position(lb.origin()); |
| 356 View::ConvertPointToScreen(this, &menu_position); | 356 View::ConvertPointToScreen(this, &menu_position); |
| 357 if (menu_position.x() < 0) | 357 if (menu_position.x() < 0) |
| 358 menu_position.set_x(0); | 358 menu_position.set_x(0); |
| 359 | 359 |
| 360 gfx::Rect bounds(menu_position, lb.size()); | 360 gfx::Rect bounds(menu_position, lb.size()); |
| 361 | 361 |
| 362 dropdown_open_ = true; | 362 dropdown_open_ = true; |
| 363 if (dropdown_list_menu_runner_->RunMenuAt( | 363 if (dropdown_list_menu_runner_->RunMenuAt( |
| 364 NULL, NULL, bounds, MenuItemView::TOPLEFT, | 364 GetWidget(), NULL, bounds, MenuItemView::TOPLEFT, |
| 365 MenuRunner::HAS_MNEMONICS) == MenuRunner::MENU_DELETED) | 365 MenuRunner::HAS_MNEMONICS) == MenuRunner::MENU_DELETED) |
| 366 return; | 366 return; |
| 367 dropdown_open_ = false; | 367 dropdown_open_ = false; |
| 368 | 368 |
| 369 // Need to explicitly clear mouse handler so that events get sent | 369 // Need to explicitly clear mouse handler so that events get sent |
| 370 // properly after the menu finishes running. If we don't do this, then | 370 // properly after the menu finishes running. If we don't do this, then |
| 371 // the first click to other parts of the UI is eaten. | 371 // the first click to other parts of the UI is eaten. |
| 372 SetMouseHandler(NULL); | 372 SetMouseHandler(NULL); |
| 373 } | 373 } |
| 374 | 374 |
| 375 //////////////////////////////////////////////////////////////////////////////// | 375 //////////////////////////////////////////////////////////////////////////////// |
| 376 // NativeComboboxWrapper, public: | 376 // NativeComboboxWrapper, public: |
| 377 | 377 |
| 378 #if defined(USE_AURA) | 378 #if defined(USE_AURA) |
| 379 // static | 379 // static |
| 380 NativeComboboxWrapper* NativeComboboxWrapper::CreateWrapper( | 380 NativeComboboxWrapper* NativeComboboxWrapper::CreateWrapper( |
| 381 Combobox* combobox) { | 381 Combobox* combobox) { |
| 382 return new NativeComboboxViews(combobox); | 382 return new NativeComboboxViews(combobox); |
| 383 } | 383 } |
| 384 #endif | 384 #endif |
| 385 | 385 |
| 386 } // namespace views | 386 } // namespace views |
| OLD | NEW |