Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2048)

Side by Side Diff: Source/web/ContextMenuClientImpl.cpp

Issue 802233004: Implement icon attribute for menuitem (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: LayoutTest rebase Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/platform/ContextMenuItem.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « Source/platform/ContextMenuItem.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698