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

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

Issue 1128933011: Start passing Title text with the context menu data. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Switch to using Title attribute first Created 5 years, 7 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 | « no previous file | public/web/WebContextMenuData.h » ('j') | 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 if (toLocalFrame(m_webView->focusedCoreFrame())->editor().canDelete()) 214 if (toLocalFrame(m_webView->focusedCoreFrame())->editor().canDelete())
215 data.editFlags |= WebContextMenuData::CanDelete; 215 data.editFlags |= WebContextMenuData::CanDelete;
216 // We can always select all... 216 // We can always select all...
217 data.editFlags |= WebContextMenuData::CanSelectAll; 217 data.editFlags |= WebContextMenuData::CanSelectAll;
218 data.editFlags |= WebContextMenuData::CanTranslate; 218 data.editFlags |= WebContextMenuData::CanTranslate;
219 219
220 // Links, Images, Media tags, and Image/Media-Links take preference over 220 // Links, Images, Media tags, and Image/Media-Links take preference over
221 // all else. 221 // all else.
222 data.linkURL = r.absoluteLinkURL(); 222 data.linkURL = r.absoluteLinkURL();
223 223
224 if (r.innerNode()->isHTMLElement()) {
225 HTMLElement* htmlElement = toHTMLElement(r.innerNode());
226 if (!htmlElement->title().isEmpty()) {
227 data.titleText = htmlElement->title();
228 } else {
229 data.titleText = htmlElement->altText();
230 }
231 }
232
224 if (isHTMLCanvasElement(r.innerNode())) { 233 if (isHTMLCanvasElement(r.innerNode())) {
225 data.mediaType = WebContextMenuData::MediaTypeCanvas; 234 data.mediaType = WebContextMenuData::MediaTypeCanvas;
226 data.hasImageContents = true; 235 data.hasImageContents = true;
227 } else if (!r.absoluteImageURL().isEmpty()) { 236 } else if (!r.absoluteImageURL().isEmpty()) {
228 data.srcURL = r.absoluteImageURL(); 237 data.srcURL = r.absoluteImageURL();
229 data.mediaType = WebContextMenuData::MediaTypeImage; 238 data.mediaType = WebContextMenuData::MediaTypeImage;
230 data.mediaFlags |= WebContextMenuData::MediaCanPrint; 239 data.mediaFlags |= WebContextMenuData::MediaCanPrint;
231 240
232 // An image can be null for many reasons, like being blocked, no image 241 // An image can be null for many reasons, like being blocked, no image
233 // data received from server yet. 242 // data received from server yet.
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 outputItems[i] = subItems[i]; 451 outputItems[i] = subItems[i];
443 subMenuItems.swap(outputItems); 452 subMenuItems.swap(outputItems);
444 } 453 }
445 454
446 void ContextMenuClientImpl::populateCustomMenuItems(const ContextMenu* defaultMe nu, WebContextMenuData* data) 455 void ContextMenuClientImpl::populateCustomMenuItems(const ContextMenu* defaultMe nu, WebContextMenuData* data)
447 { 456 {
448 populateSubMenuItems(defaultMenu->items(), data->customItems); 457 populateSubMenuItems(defaultMenu->items(), data->customItems);
449 } 458 }
450 459
451 } // namespace blink 460 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | public/web/WebContextMenuData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698