| 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/menu/menu_model_adapter.h" | 5 #include "ui/views/controls/menu/menu_model_adapter.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ui/base/models/menu_model.h" | 8 #include "ui/base/models/menu_model.h" |
| 9 #include "ui/gfx/image/image.h" | 9 #include "ui/gfx/image/image.h" |
| 10 #include "ui/views/controls/menu/menu_item_view.h" | 10 #include "ui/views/controls/menu/menu_item_view.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 int item_id) { | 59 int item_id) { |
| 60 gfx::Image icon; | 60 gfx::Image icon; |
| 61 model->GetIconAt(model_index, &icon); | 61 model->GetIconAt(model_index, &icon); |
| 62 base::string16 label, sublabel, minor_text; | 62 base::string16 label, sublabel, minor_text; |
| 63 ui::MenuSeparatorType separator_style = ui::NORMAL_SEPARATOR; | 63 ui::MenuSeparatorType separator_style = ui::NORMAL_SEPARATOR; |
| 64 MenuItemView::Type type; | 64 MenuItemView::Type type; |
| 65 ui::MenuModel::ItemType menu_type = model->GetTypeAt(model_index); | 65 ui::MenuModel::ItemType menu_type = model->GetTypeAt(model_index); |
| 66 | 66 |
| 67 switch (menu_type) { | 67 switch (menu_type) { |
| 68 case ui::MenuModel::TYPE_COMMAND: | 68 case ui::MenuModel::TYPE_COMMAND: |
| 69 case ui::MenuModel::TYPE_BUTTON_ITEM: |
| 69 type = MenuItemView::NORMAL; | 70 type = MenuItemView::NORMAL; |
| 70 label = model->GetLabelAt(model_index); | 71 label = model->GetLabelAt(model_index); |
| 71 sublabel = model->GetSublabelAt(model_index); | 72 sublabel = model->GetSublabelAt(model_index); |
| 72 minor_text = model->GetMinorTextAt(model_index); | 73 minor_text = model->GetMinorTextAt(model_index); |
| 73 break; | 74 break; |
| 74 case ui::MenuModel::TYPE_CHECK: | 75 case ui::MenuModel::TYPE_CHECK: |
| 75 type = MenuItemView::CHECKBOX; | 76 type = MenuItemView::CHECKBOX; |
| 76 label = model->GetLabelAt(model_index); | 77 label = model->GetLabelAt(model_index); |
| 77 sublabel = model->GetSublabelAt(model_index); | 78 sublabel = model->GetSublabelAt(model_index); |
| 78 minor_text = model->GetMinorTextAt(model_index); | 79 minor_text = model->GetMinorTextAt(model_index); |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 has_icons = has_icons || item->has_icons(); | 284 has_icons = has_icons || item->has_icons(); |
| 284 | 285 |
| 285 menu_map_[item] = submodel; | 286 menu_map_[item] = submodel; |
| 286 } | 287 } |
| 287 } | 288 } |
| 288 | 289 |
| 289 menu->set_has_icons(has_icons); | 290 menu->set_has_icons(has_icons); |
| 290 } | 291 } |
| 291 | 292 |
| 292 } // namespace views | 293 } // namespace views |
| OLD | NEW |