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

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

Issue 1137733004: Add an "input field type" entry to WebContextMenuData. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 HTMLAnchorElement* anchor = toHTMLAnchorElement(r.URLElement()); 388 HTMLAnchorElement* anchor = toHTMLAnchorElement(r.URLElement());
389 389
390 // Extract suggested filename for saving file. 390 // Extract suggested filename for saving file.
391 data.suggestedFilename = anchor->fastGetAttribute(HTMLNames::downloadAtt r); 391 data.suggestedFilename = anchor->fastGetAttribute(HTMLNames::downloadAtt r);
392 392
393 // If the anchor wants to suppress the referrer, update the referrerPoli cy accordingly. 393 // If the anchor wants to suppress the referrer, update the referrerPoli cy accordingly.
394 if (anchor->hasRel(RelationNoReferrer)) 394 if (anchor->hasRel(RelationNoReferrer))
395 data.referrerPolicy = WebReferrerPolicyNever; 395 data.referrerPolicy = WebReferrerPolicyNever;
396 } 396 }
397 397
398 // Find the input field type.
399 if (isHTMLInputElement(r.innerNode())) {
400 HTMLInputElement* element = toHTMLInputElement(r.innerNode());
401 if (element->type() == InputTypeNames::password)
Mike West 2015/05/19 12:58:35 Should we also take the `autocomplete` attribute i
msramek 2015/05/19 15:42:44 I thought about it a bit, and I would say that not
402 data.inputFieldType = WebContextMenuData::InputFieldTypePassword;
403 else if (element->isTextField())
404 data.inputFieldType = WebContextMenuData::InputFieldTypePlainText;
405 else
406 data.inputFieldType = WebContextMenuData::InputFieldTypeOther;
407 } else {
408 data.inputFieldType = WebContextMenuData::InputFieldTypeNone;
409 }
410
398 data.node = r.innerNodeOrImageMapImage(); 411 data.node = r.innerNodeOrImageMapImage();
399 412
400 WebLocalFrameImpl* selectedWebFrame = WebLocalFrameImpl::fromFrame(selectedF rame); 413 WebLocalFrameImpl* selectedWebFrame = WebLocalFrameImpl::fromFrame(selectedF rame);
401 if (selectedWebFrame->client()) 414 if (selectedWebFrame->client())
402 selectedWebFrame->client()->showContextMenu(data); 415 selectedWebFrame->client()->showContextMenu(data);
403 } 416 }
404 417
405 void ContextMenuClientImpl::clearContextMenu() 418 void ContextMenuClientImpl::clearContextMenu()
406 { 419 {
407 HitTestResult r = m_webView->page()->contextMenuController().hitTestResult() ; 420 HitTestResult r = m_webView->page()->contextMenuController().hitTestResult() ;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 outputItems[i] = subItems[i]; 464 outputItems[i] = subItems[i];
452 subMenuItems.swap(outputItems); 465 subMenuItems.swap(outputItems);
453 } 466 }
454 467
455 void ContextMenuClientImpl::populateCustomMenuItems(const ContextMenu* defaultMe nu, WebContextMenuData* data) 468 void ContextMenuClientImpl::populateCustomMenuItems(const ContextMenu* defaultMe nu, WebContextMenuData* data)
456 { 469 {
457 populateSubMenuItems(defaultMenu->items(), data->customItems); 470 populateSubMenuItems(defaultMenu->items(), data->customItems);
458 } 471 }
459 472
460 } // namespace blink 473 } // 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