| 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 "chrome/browser/ui/toolbar/action_box_menu_model.h" | 5 #include "chrome/browser/ui/toolbar/action_box_menu_model.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
| 9 #include "chrome/browser/extensions/extension_toolbar_model.h" | 9 #include "chrome/browser/extensions/extension_toolbar_model.h" |
| 10 #include "grit/generated_resources.h" | 10 #include "grit/generated_resources.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 ActionBoxMenuModel::ActionBoxMenuModel(Browser* browser, | 27 ActionBoxMenuModel::ActionBoxMenuModel(Browser* browser, |
| 28 ExtensionService* extension_service, | 28 ExtensionService* extension_service, |
| 29 bool starred) | 29 bool starred) |
| 30 : ALLOW_THIS_IN_INITIALIZER_LIST(ui::SimpleMenuModel(this)), | 30 : ALLOW_THIS_IN_INITIALIZER_LIST(ui::SimpleMenuModel(this)), |
| 31 browser_(browser), | 31 browser_(browser), |
| 32 extension_service_(extension_service) { | 32 extension_service_(extension_service) { |
| 33 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 33 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 34 InsertItemWithStringIdAt(0, IDC_CHROME_TO_MOBILE_PAGE, | 34 InsertItemWithStringIdAt(0, IDC_CHROME_TO_MOBILE_PAGE, |
| 35 IDS_CHROME_TO_MOBILE_BUBBLE_TOOLTIP); | 35 IDS_CHROME_TO_MOBILE_BUBBLE_TOOLTIP); |
| 36 SetIcon(0, *rb.GetImageSkiaNamed(IDR_MOBILE)); | 36 SetIcon(0, rb.GetNativeImageNamed(IDR_MOBILE)); |
| 37 InsertItemWithStringIdAt(1, IDC_BOOKMARK_PAGE, | 37 InsertItemWithStringIdAt(1, IDC_BOOKMARK_PAGE, |
| 38 starred ? IDS_TOOLTIP_STARRED : IDS_TOOLTIP_STAR); | 38 starred ? IDS_TOOLTIP_STARRED : IDS_TOOLTIP_STAR); |
| 39 SetIcon(1, *rb.GetImageSkiaNamed(starred ? IDR_STAR_LIT : IDR_STAR)); | 39 SetIcon(1, rb.GetNativeImageNamed(starred ? IDR_STAR_LIT : IDR_STAR)); |
| 40 | 40 |
| 41 // Adds extensions to the model. | 41 // Adds extensions to the model. |
| 42 int command_id = kFirstExtensionCommandId; | 42 int command_id = kFirstExtensionCommandId; |
| 43 const extensions::ExtensionList& action_box_items = action_box_menu_items(); | 43 const extensions::ExtensionList& action_box_items = action_box_menu_items(); |
| 44 if (!action_box_items.empty()) { | 44 if (!action_box_items.empty()) { |
| 45 AddSeparator(); | 45 AddSeparator(); |
| 46 for (size_t i = 0; i < action_box_items.size(); ++i) { | 46 for (size_t i = 0; i < action_box_items.size(); ++i) { |
| 47 const extensions::Extension* extension = action_box_items[i]; | 47 const extensions::Extension* extension = action_box_items[i]; |
| 48 AddItem(command_id, UTF8ToUTF16(extension->name())); | 48 AddItem(command_id, UTF8ToUTF16(extension->name())); |
| 49 id_to_extension_id_map_[command_id++] = extension->id(); | 49 id_to_extension_id_map_[command_id++] = extension->id(); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 | 90 |
| 91 void ActionBoxMenuModel::ExecuteCommand(int command_id) { | 91 void ActionBoxMenuModel::ExecuteCommand(int command_id) { |
| 92 if (command_id < kFirstExtensionCommandId) | 92 if (command_id < kFirstExtensionCommandId) |
| 93 chrome::ExecuteCommand(browser_, command_id); | 93 chrome::ExecuteCommand(browser_, command_id); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void ActionBoxMenuModel::Observe(int type, | 96 void ActionBoxMenuModel::Observe(int type, |
| 97 const content::NotificationSource& source, | 97 const content::NotificationSource& source, |
| 98 const content::NotificationDetails& details) { | 98 const content::NotificationDetails& details) { |
| 99 } | 99 } |
| OLD | NEW |