| 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 "ui/accessibility/ax_view_state.h" | 8 #include "ui/accessibility/ax_view_state.h" |
| 9 #include "ui/base/ime/input_method.h" | 9 #include "ui/base/ime/input_method.h" |
| 10 #include "ui/base/models/combobox_model.h" | 10 #include "ui/base/models/combobox_model.h" |
| 11 #include "ui/base/models/combobox_model_observer.h" | 11 #include "ui/base/models/combobox_model_observer.h" |
| 12 #include "ui/base/resource/resource_bundle.h" | 12 #include "ui/base/resource/resource_bundle.h" |
| 13 #include "ui/events/event.h" | 13 #include "ui/events/event.h" |
| 14 #include "ui/gfx/animation/throb_animation.h" | 14 #include "ui/gfx/animation/throb_animation.h" |
| 15 #include "ui/gfx/canvas.h" | 15 #include "ui/gfx/canvas.h" |
| 16 #include "ui/gfx/color_palette.h" | 16 #include "ui/gfx/color_palette.h" |
| 17 #include "ui/gfx/scoped_canvas.h" | 17 #include "ui/gfx/scoped_canvas.h" |
| 18 #include "ui/gfx/text_utils.h" | 18 #include "ui/gfx/text_utils.h" |
| 19 #include "ui/native_theme/common_theme.h" | 19 #include "ui/native_theme/common_theme.h" |
| 20 #include "ui/native_theme/native_theme.h" | 20 #include "ui/native_theme/native_theme.h" |
| 21 #include "ui/native_theme/native_theme_aura.h" |
| 21 #include "ui/resources/grit/ui_resources.h" | 22 #include "ui/resources/grit/ui_resources.h" |
| 22 #include "ui/views/controls/button/custom_button.h" | 23 #include "ui/views/controls/button/custom_button.h" |
| 23 #include "ui/views/controls/button/label_button.h" | 24 #include "ui/views/controls/button/label_button.h" |
| 24 #include "ui/views/controls/combobox/combobox_listener.h" | 25 #include "ui/views/controls/combobox/combobox_listener.h" |
| 25 #include "ui/views/controls/focusable_border.h" | 26 #include "ui/views/controls/focusable_border.h" |
| 26 #include "ui/views/controls/menu/menu_config.h" | 27 #include "ui/views/controls/menu/menu_config.h" |
| 27 #include "ui/views/controls/menu/menu_runner.h" | 28 #include "ui/views/controls/menu/menu_runner.h" |
| 28 #include "ui/views/controls/prefix_selector.h" | 29 #include "ui/views/controls/prefix_selector.h" |
| 29 #include "ui/views/controls/textfield/textfield.h" | 30 #include "ui/views/controls/textfield/textfield.h" |
| 30 #include "ui/views/mouse_constants.h" | 31 #include "ui/views/mouse_constants.h" |
| (...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 883 } | 884 } |
| 884 NOTREACHED(); | 885 NOTREACHED(); |
| 885 return 0; | 886 return 0; |
| 886 } | 887 } |
| 887 | 888 |
| 888 gfx::Size Combobox::ArrowSize() const { | 889 gfx::Size Combobox::ArrowSize() const { |
| 889 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 890 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 890 // TODO(estade): hack alert! This should always use GetNativeTheme(). For now | 891 // TODO(estade): hack alert! This should always use GetNativeTheme(). For now |
| 891 // STYLE_ACTION isn't properly themed so we have to override the NativeTheme | 892 // STYLE_ACTION isn't properly themed so we have to override the NativeTheme |
| 892 // behavior. See crbug.com/384071 | 893 // behavior. See crbug.com/384071 |
| 893 const ui::NativeTheme* native_theme_for_arrow = style_ == STYLE_ACTION ? | 894 const ui::NativeTheme* native_theme_for_arrow = |
| 894 ui::NativeTheme::instance() : | 895 style_ == STYLE_ACTION ? ui::NativeThemeAura::instance() |
| 895 GetNativeTheme(); | 896 : GetNativeTheme(); |
| 896 #else | 897 #else |
| 897 const ui::NativeTheme* native_theme_for_arrow = GetNativeTheme(); | 898 const ui::NativeTheme* native_theme_for_arrow = GetNativeTheme(); |
| 898 #endif | 899 #endif |
| 899 | 900 |
| 900 ui::NativeTheme::ExtraParams ignored; | 901 ui::NativeTheme::ExtraParams ignored; |
| 901 return native_theme_for_arrow->GetPartSize(ui::NativeTheme::kComboboxArrow, | 902 return native_theme_for_arrow->GetPartSize(ui::NativeTheme::kComboboxArrow, |
| 902 ui::NativeTheme::kNormal, | 903 ui::NativeTheme::kNormal, |
| 903 ignored); | 904 ignored); |
| 904 } | 905 } |
| 905 | 906 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 920 return gfx::Size(width, font_list.GetHeight()); | 921 return gfx::Size(width, font_list.GetHeight()); |
| 921 } | 922 } |
| 922 | 923 |
| 923 PrefixSelector* Combobox::GetPrefixSelector() { | 924 PrefixSelector* Combobox::GetPrefixSelector() { |
| 924 if (!selector_) | 925 if (!selector_) |
| 925 selector_.reset(new PrefixSelector(this)); | 926 selector_.reset(new PrefixSelector(this)); |
| 926 return selector_.get(); | 927 return selector_.get(); |
| 927 } | 928 } |
| 928 | 929 |
| 929 } // namespace views | 930 } // namespace views |
| OLD | NEW |