Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: ui/views/controls/combobox/combobox.cc

Issue 250943008: Move enum MenuAnchorPosition to reduce deps on menu_item_view.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop_proxy.h" 9 #include "base/message_loop/message_loop_proxy.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "grit/ui_resources.h" 11 #include "grit/ui_resources.h"
12 #include "ui/accessibility/ax_view_state.h" 12 #include "ui/accessibility/ax_view_state.h"
13 #include "ui/base/models/combobox_model.h" 13 #include "ui/base/models/combobox_model.h"
14 #include "ui/base/resource/resource_bundle.h" 14 #include "ui/base/resource/resource_bundle.h"
15 #include "ui/events/event.h" 15 #include "ui/events/event.h"
16 #include "ui/events/keycodes/keyboard_codes.h" 16 #include "ui/events/keycodes/keyboard_codes.h"
17 #include "ui/gfx/animation/throb_animation.h" 17 #include "ui/gfx/animation/throb_animation.h"
18 #include "ui/gfx/canvas.h" 18 #include "ui/gfx/canvas.h"
19 #include "ui/gfx/image/image.h" 19 #include "ui/gfx/image/image.h"
20 #include "ui/gfx/scoped_canvas.h" 20 #include "ui/gfx/scoped_canvas.h"
21 #include "ui/gfx/text_utils.h" 21 #include "ui/gfx/text_utils.h"
22 #include "ui/native_theme/native_theme.h" 22 #include "ui/native_theme/native_theme.h"
23 #include "ui/views/background.h" 23 #include "ui/views/background.h"
24 #include "ui/views/color_constants.h" 24 #include "ui/views/color_constants.h"
25 #include "ui/views/controls/button/custom_button.h" 25 #include "ui/views/controls/button/custom_button.h"
26 #include "ui/views/controls/button/label_button.h" 26 #include "ui/views/controls/button/label_button.h"
27 #include "ui/views/controls/combobox/combobox_listener.h" 27 #include "ui/views/controls/combobox/combobox_listener.h"
28 #include "ui/views/controls/focusable_border.h" 28 #include "ui/views/controls/focusable_border.h"
29 #include "ui/views/controls/menu/menu_item_view.h"
29 #include "ui/views/controls/menu/menu_runner.h" 30 #include "ui/views/controls/menu/menu_runner.h"
30 #include "ui/views/controls/menu/menu_runner_handler.h" 31 #include "ui/views/controls/menu/menu_runner_handler.h"
31 #include "ui/views/controls/menu/submenu_view.h" 32 #include "ui/views/controls/menu/submenu_view.h"
32 #include "ui/views/controls/prefix_selector.h" 33 #include "ui/views/controls/prefix_selector.h"
33 #include "ui/views/ime/input_method.h" 34 #include "ui/views/ime/input_method.h"
34 #include "ui/views/mouse_constants.h" 35 #include "ui/views/mouse_constants.h"
35 #include "ui/views/painter.h" 36 #include "ui/views/painter.h"
36 #include "ui/views/widget/widget.h" 37 #include "ui/views/widget/widget.h"
37 38
38 namespace views { 39 namespace views {
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 menu_position.set_x(0); 763 menu_position.set_x(0);
763 764
764 gfx::Rect bounds(menu_position, lb.size()); 765 gfx::Rect bounds(menu_position, lb.size());
765 766
766 Button::ButtonState original_state = Button::STATE_NORMAL; 767 Button::ButtonState original_state = Button::STATE_NORMAL;
767 if (arrow_button_) { 768 if (arrow_button_) {
768 original_state = arrow_button_->state(); 769 original_state = arrow_button_->state();
769 arrow_button_->SetState(Button::STATE_PRESSED); 770 arrow_button_->SetState(Button::STATE_PRESSED);
770 } 771 }
771 dropdown_open_ = true; 772 dropdown_open_ = true;
772 MenuItemView::AnchorPosition anchor_position = 773 ui::MenuAnchorPosition anchor_position = style_ == STYLE_ACTION
773 style_ == STYLE_ACTION ? MenuItemView::TOPRIGHT : MenuItemView::TOPLEFT; 774 ? ui::MENU_ANCHOR_TOPRIGHT
775 : ui::MENU_ANCHOR_TOPLEFT;
774 if (dropdown_list_menu_runner_->RunMenuAt(GetWidget(), NULL, bounds, 776 if (dropdown_list_menu_runner_->RunMenuAt(GetWidget(), NULL, bounds,
775 anchor_position, source_type, 777 anchor_position, source_type,
776 MenuRunner::COMBOBOX) == 778 MenuRunner::COMBOBOX) ==
777 MenuRunner::MENU_DELETED) { 779 MenuRunner::MENU_DELETED) {
778 return; 780 return;
779 } 781 }
780 dropdown_open_ = false; 782 dropdown_open_ = false;
781 if (arrow_button_) 783 if (arrow_button_)
782 arrow_button_->SetState(original_state); 784 arrow_button_->SetState(original_state);
783 closed_time_ = base::Time::Now(); 785 closed_time_ = base::Time::Now();
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 case STYLE_NORMAL: 827 case STYLE_NORMAL:
826 return kDisclosureArrowRightPadding; 828 return kDisclosureArrowRightPadding;
827 case STYLE_ACTION: 829 case STYLE_ACTION:
828 return kDisclosureArrowButtonRightPadding; 830 return kDisclosureArrowButtonRightPadding;
829 } 831 }
830 NOTREACHED(); 832 NOTREACHED();
831 return 0; 833 return 0;
832 } 834 }
833 835
834 } // namespace views 836 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698