| 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 "chrome/browser/views/wrench_menu.h" | 5 #include "chrome/browser/views/wrench_menu.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| (...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 NOTREACHED(); | 699 NOTREACHED(); |
| 700 type = MenuItemView::NORMAL; | 700 type = MenuItemView::NORMAL; |
| 701 break; | 701 break; |
| 702 } | 702 } |
| 703 | 703 |
| 704 id_to_entry_[id].first = model; | 704 id_to_entry_[id].first = model; |
| 705 id_to_entry_[id].second = index; | 705 id_to_entry_[id].second = index; |
| 706 | 706 |
| 707 MenuItemView* menu_item = parent->AppendMenuItemImpl(id, label, icon, type); | 707 MenuItemView* menu_item = parent->AppendMenuItemImpl(id, label, icon, type); |
| 708 | 708 |
| 709 if (menu_item) |
| 710 menu_item->SetVisible(model->IsVisibleAt(index)); |
| 711 |
| 709 if (menu_type == MenuModel::TYPE_COMMAND && model->HasIcons()) { | 712 if (menu_type == MenuModel::TYPE_COMMAND && model->HasIcons()) { |
| 710 SkBitmap icon; | 713 SkBitmap icon; |
| 711 if (model->GetIconAt(index, &icon)) | 714 if (model->GetIconAt(index, &icon)) |
| 712 menu_item->SetIcon(icon); | 715 menu_item->SetIcon(icon); |
| 713 } | 716 } |
| 714 | 717 |
| 715 return menu_item; | 718 return menu_item; |
| 716 } | 719 } |
| 717 | 720 |
| 718 void WrenchMenu::CancelAndEvaluate(MenuModel* model, int index) { | 721 void WrenchMenu::CancelAndEvaluate(MenuModel* model, int index) { |
| 719 selected_menu_model_ = model; | 722 selected_menu_model_ = model; |
| 720 selected_index_ = index; | 723 selected_index_ = index; |
| 721 root_->Cancel(); | 724 root_->Cancel(); |
| 722 } | 725 } |
| OLD | NEW |