Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / content / renderer / menu_item_builder.cc
blob7db359296367b524458039cc1b28e0ee5aeffebe
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.
5 #include "content/renderer/menu_item_builder.h"
7 #include "content/public/common/menu_item.h"
9 namespace content {
11 MenuItem MenuItemBuilder::Build(const blink::WebMenuItemInfo& item) {
12 MenuItem result;
14 result.label = item.label;
15 result.icon = item.icon;
16 result.tool_tip = item.toolTip;
17 result.type = static_cast<MenuItem::Type>(item.type);
18 result.action = item.action;
19 result.rtl = (item.textDirection == blink::WebTextDirectionRightToLeft);
20 result.has_directional_override = item.hasTextDirectionOverride;
21 result.enabled = item.enabled;
22 result.checked = item.checked;
23 for (size_t i = 0; i < item.subMenuItems.size(); ++i)
24 result.submenu.push_back(MenuItemBuilder::Build(item.subMenuItems[i]));
26 return result;
29 } // namespace content