| 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 22 matching lines...) Expand all Loading... |
| 33 InsertItemWithStringIdAt(0, IDC_CHROME_TO_MOBILE_PAGE, | 33 InsertItemWithStringIdAt(0, IDC_CHROME_TO_MOBILE_PAGE, |
| 34 IDS_CHROME_TO_MOBILE_BUBBLE_TOOLTIP); | 34 IDS_CHROME_TO_MOBILE_BUBBLE_TOOLTIP); |
| 35 SetIcon(0, *rb.GetImageSkiaNamed(IDR_MOBILE)); | 35 SetIcon(0, *rb.GetImageSkiaNamed(IDR_MOBILE)); |
| 36 InsertItemWithStringIdAt(1, IDC_BOOKMARK_PAGE, IDS_BOOKMARK_STAR); | 36 InsertItemWithStringIdAt(1, IDC_BOOKMARK_PAGE, IDS_BOOKMARK_STAR); |
| 37 SetIcon(1, *rb.GetImageSkiaNamed(IDR_STAR)); | 37 SetIcon(1, *rb.GetImageSkiaNamed(IDR_STAR)); |
| 38 | 38 |
| 39 // Adds extensions to the model. | 39 // Adds extensions to the model. |
| 40 int command_id = kFirstExtensionCommandId; | 40 int command_id = kFirstExtensionCommandId; |
| 41 const extensions::ExtensionList& action_box_items = action_box_menu_items(); | 41 const extensions::ExtensionList& action_box_items = action_box_menu_items(); |
| 42 if (!action_box_items.empty()) { | 42 if (!action_box_items.empty()) { |
| 43 AddSeparator(); | 43 AddSeparator(ui::NORMAL_SEPARATOR); |
| 44 for (size_t i = 0; i < action_box_items.size(); ++i) { | 44 for (size_t i = 0; i < action_box_items.size(); ++i) { |
| 45 const extensions::Extension* extension = action_box_items[i]; | 45 const extensions::Extension* extension = action_box_items[i]; |
| 46 AddItem(command_id, UTF8ToUTF16(extension->name())); | 46 AddItem(command_id, UTF8ToUTF16(extension->name())); |
| 47 id_to_extension_id_map_[command_id++] = extension->id(); | 47 id_to_extension_id_map_[command_id++] = extension->id(); |
| 48 } | 48 } |
| 49 } | 49 } |
| 50 } | 50 } |
| 51 | 51 |
| 52 ActionBoxMenuModel::~ActionBoxMenuModel() { | 52 ActionBoxMenuModel::~ActionBoxMenuModel() { |
| 53 // Ensures parent destructor does not use a partially destroyed delegate. | 53 // Ensures parent destructor does not use a partially destroyed delegate. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 70 | 70 |
| 71 void ActionBoxMenuModel::ExecuteCommand(int command_id) { | 71 void ActionBoxMenuModel::ExecuteCommand(int command_id) { |
| 72 if (command_id < kFirstExtensionCommandId) | 72 if (command_id < kFirstExtensionCommandId) |
| 73 chrome::ExecuteCommand(browser_, command_id); | 73 chrome::ExecuteCommand(browser_, command_id); |
| 74 } | 74 } |
| 75 | 75 |
| 76 void ActionBoxMenuModel::Observe(int type, | 76 void ActionBoxMenuModel::Observe(int type, |
| 77 const content::NotificationSource& source, | 77 const content::NotificationSource& source, |
| 78 const content::NotificationDetails& details) { | 78 const content::NotificationDetails& details) { |
| 79 } | 79 } |
| OLD | NEW |