[email protected] | 54bf995 | 2013-07-17 06:43:20 | [diff] [blame] | 1 | // Copyright 2013 The Chromium Authors. All rights reserved. |
2 | // Use of this source code is governed by a BSD-style license that can be | ||||
3 | // found in the LICENSE file. | ||||
4 | |||||
5 | #include "content/renderer/menu_item_builder.h" | ||||
6 | |||||
avi | 1023d01 | 2015-12-25 02:39:14 | [diff] [blame] | 7 | #include <stddef.h> |
8 | |||||
[email protected] | 54bf995 | 2013-07-17 06:43:20 | [diff] [blame] | 9 | #include "content/public/common/menu_item.h" |
10 | |||||
11 | namespace content { | ||||
12 | |||||
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 13 | MenuItem MenuItemBuilder::Build(const blink::WebMenuItemInfo& item) { |
[email protected] | 54bf995 | 2013-07-17 06:43:20 | [diff] [blame] | 14 | MenuItem result; |
15 | |||||
Blink Reformat | 1c4d759e | 2017-04-09 16:34:54 | [diff] [blame] | 16 | result.label = item.label.Utf16(); |
Blink Reformat | 1c4d759e | 2017-04-09 16:34:54 | [diff] [blame] | 17 | result.tool_tip = item.tool_tip.Utf16(); |
[email protected] | 54bf995 | 2013-07-17 06:43:20 | [diff] [blame] | 18 | result.type = static_cast<MenuItem::Type>(item.type); |
19 | result.action = item.action; | ||||
Blink Reformat | 1c4d759e | 2017-04-09 16:34:54 | [diff] [blame] | 20 | result.rtl = (item.text_direction == blink::kWebTextDirectionRightToLeft); |
21 | result.has_directional_override = item.has_text_direction_override; | ||||
[email protected] | 54bf995 | 2013-07-17 06:43:20 | [diff] [blame] | 22 | result.enabled = item.enabled; |
23 | result.checked = item.checked; | ||||
Blink Reformat | 1c4d759e | 2017-04-09 16:34:54 | [diff] [blame] | 24 | for (size_t i = 0; i < item.sub_menu_items.size(); ++i) |
25 | result.submenu.push_back(MenuItemBuilder::Build(item.sub_menu_items[i])); | ||||
[email protected] | 54bf995 | 2013-07-17 06:43:20 | [diff] [blame] | 26 | |
27 | return result; | ||||
28 | } | ||||
29 | |||||
30 | } // namespace content |