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" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 ComboboxMenuModelAdapter(Combobox* owner, ui::ComboboxModel* model) | 226 ComboboxMenuModelAdapter(Combobox* owner, ui::ComboboxModel* model) |
227 : owner_(owner), model_(model) { | 227 : owner_(owner), model_(model) { |
228 model_->AddObserver(this); | 228 model_->AddObserver(this); |
229 } | 229 } |
230 | 230 |
231 ~ComboboxMenuModelAdapter() override { model_->RemoveObserver(this); } | 231 ~ComboboxMenuModelAdapter() override { model_->RemoveObserver(this); } |
232 | 232 |
233 private: | 233 private: |
234 bool UseCheckmarks() const { | 234 bool UseCheckmarks() const { |
235 return owner_->style_ != STYLE_ACTION && | 235 return owner_->style_ != STYLE_ACTION && |
236 MenuConfig::instance(owner_->GetNativeTheme()) | 236 MenuConfig::instance().check_selected_combobox_item; |
237 .check_selected_combobox_item; | |
238 } | 237 } |
239 | 238 |
240 // Overridden from MenuModel: | 239 // Overridden from MenuModel: |
241 bool HasIcons() const override { return false; } | 240 bool HasIcons() const override { return false; } |
242 | 241 |
243 int GetItemCount() const override { return model_->GetItemCount(); } | 242 int GetItemCount() const override { return model_->GetItemCount(); } |
244 | 243 |
245 ItemType GetTypeAt(int index) const override { | 244 ItemType GetTypeAt(int index) const override { |
246 if (model_->IsItemSeparatorAt(index)) { | 245 if (model_->IsItemSeparatorAt(index)) { |
247 // In action menus, disallow <item>, <separator>, ... since that would put | 246 // In action menus, disallow <item>, <separator>, ... since that would put |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
921 return gfx::Size(width, font_list.GetHeight()); | 920 return gfx::Size(width, font_list.GetHeight()); |
922 } | 921 } |
923 | 922 |
924 PrefixSelector* Combobox::GetPrefixSelector() { | 923 PrefixSelector* Combobox::GetPrefixSelector() { |
925 if (!selector_) | 924 if (!selector_) |
926 selector_.reset(new PrefixSelector(this)); | 925 selector_.reset(new PrefixSelector(this)); |
927 return selector_.get(); | 926 return selector_.get(); |
928 } | 927 } |
929 | 928 |
930 } // namespace views | 929 } // namespace views |
OLD | NEW |