OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "views/controls/combobox/combobox.h" | 5 #include "views/controls/combobox/combobox.h" |
6 | 6 |
7 #include "app/combobox_model.h" | 7 #include "app/combobox_model.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "ui/base/keycodes/keyboard_codes.h" | 10 #include "ui/base/keycodes/keyboard_codes.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 84 |
85 void Combobox::PaintFocusBorder(gfx::Canvas* canvas) { | 85 void Combobox::PaintFocusBorder(gfx::Canvas* canvas) { |
86 if (NativeViewHost::kRenderNativeControlFocus) | 86 if (NativeViewHost::kRenderNativeControlFocus) |
87 View::PaintFocusBorder(canvas); | 87 View::PaintFocusBorder(canvas); |
88 } | 88 } |
89 | 89 |
90 AccessibilityTypes::Role Combobox::GetAccessibleRole() { | 90 AccessibilityTypes::Role Combobox::GetAccessibleRole() { |
91 return AccessibilityTypes::ROLE_COMBOBOX; | 91 return AccessibilityTypes::ROLE_COMBOBOX; |
92 } | 92 } |
93 | 93 |
94 std::wstring Combobox::GetAccessibleValue() { | 94 string16 Combobox::GetAccessibleValue() { |
95 return UTF16ToWideHack(model_->GetItemAt(selected_item_)); | 95 return model_->GetItemAt(selected_item_); |
96 } | 96 } |
97 | 97 |
98 void Combobox::Focus() { | 98 void Combobox::Focus() { |
99 // Forward the focus to the wrapper. | 99 // Forward the focus to the wrapper. |
100 if (native_wrapper_) | 100 if (native_wrapper_) |
101 native_wrapper_->SetFocus(); | 101 native_wrapper_->SetFocus(); |
102 else | 102 else |
103 View::Focus(); // Will focus the RootView window (so we still get | 103 View::Focus(); // Will focus the RootView window (so we still get |
104 // keyboard messages). | 104 // keyboard messages). |
105 } | 105 } |
106 | 106 |
107 void Combobox::ViewHierarchyChanged(bool is_add, View* parent, | 107 void Combobox::ViewHierarchyChanged(bool is_add, View* parent, |
108 View* child) { | 108 View* child) { |
109 if (is_add && !native_wrapper_ && GetWidget()) { | 109 if (is_add && !native_wrapper_ && GetWidget()) { |
110 native_wrapper_ = NativeComboboxWrapper::CreateWrapper(this); | 110 native_wrapper_ = NativeComboboxWrapper::CreateWrapper(this); |
111 AddChildView(native_wrapper_->GetView()); | 111 AddChildView(native_wrapper_->GetView()); |
112 } | 112 } |
113 } | 113 } |
114 | 114 |
115 std::string Combobox::GetClassName() const { | 115 std::string Combobox::GetClassName() const { |
116 return kViewClassName; | 116 return kViewClassName; |
117 } | 117 } |
118 | 118 |
119 } // namespace views | 119 } // namespace views |
OLD | NEW |