| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 static void populateSubMenuItems(const Vector<ContextMenuItem>& inputMenu, WebVe
ctor<WebMenuItemInfo>& subMenuItems) | 405 static void populateSubMenuItems(const Vector<ContextMenuItem>& inputMenu, WebVe
ctor<WebMenuItemInfo>& subMenuItems) |
| 406 { | 406 { |
| 407 Vector<WebMenuItemInfo> subItems; | 407 Vector<WebMenuItemInfo> subItems; |
| 408 for (size_t i = 0; i < inputMenu.size(); ++i) { | 408 for (size_t i = 0; i < inputMenu.size(); ++i) { |
| 409 const ContextMenuItem* inputItem = &inputMenu.at(i); | 409 const ContextMenuItem* inputItem = &inputMenu.at(i); |
| 410 if (inputItem->action() < ContextMenuItemBaseCustomTag || inputItem->act
ion() > ContextMenuItemLastCustomTag) | 410 if (inputItem->action() < ContextMenuItemBaseCustomTag || inputItem->act
ion() > ContextMenuItemLastCustomTag) |
| 411 continue; | 411 continue; |
| 412 | 412 |
| 413 WebMenuItemInfo outputItem; | 413 WebMenuItemInfo outputItem; |
| 414 outputItem.label = inputItem->title(); | 414 outputItem.label = inputItem->title(); |
| 415 outputItem.icon = inputItem->icon(); |
| 415 outputItem.enabled = inputItem->enabled(); | 416 outputItem.enabled = inputItem->enabled(); |
| 416 outputItem.checked = inputItem->checked(); | 417 outputItem.checked = inputItem->checked(); |
| 417 outputItem.action = static_cast<unsigned>(inputItem->action() - ContextM
enuItemBaseCustomTag); | 418 outputItem.action = static_cast<unsigned>(inputItem->action() - ContextM
enuItemBaseCustomTag); |
| 418 switch (inputItem->type()) { | 419 switch (inputItem->type()) { |
| 419 case ActionType: | 420 case ActionType: |
| 420 outputItem.type = WebMenuItemInfo::Option; | 421 outputItem.type = WebMenuItemInfo::Option; |
| 421 break; | 422 break; |
| 422 case CheckableActionType: | 423 case CheckableActionType: |
| 423 outputItem.type = WebMenuItemInfo::CheckableOption; | 424 outputItem.type = WebMenuItemInfo::CheckableOption; |
| 424 break; | 425 break; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 438 outputItems[i] = subItems[i]; | 439 outputItems[i] = subItems[i]; |
| 439 subMenuItems.swap(outputItems); | 440 subMenuItems.swap(outputItems); |
| 440 } | 441 } |
| 441 | 442 |
| 442 void ContextMenuClientImpl::populateCustomMenuItems(const ContextMenu* defaultMe
nu, WebContextMenuData* data) | 443 void ContextMenuClientImpl::populateCustomMenuItems(const ContextMenu* defaultMe
nu, WebContextMenuData* data) |
| 443 { | 444 { |
| 444 populateSubMenuItems(defaultMenu->items(), data->customItems); | 445 populateSubMenuItems(defaultMenu->items(), data->customItems); |
| 445 } | 446 } |
| 446 | 447 |
| 447 } // namespace blink | 448 } // namespace blink |
| OLD | NEW |