| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 #include "web/ContextMenuAllowedScope.h" | 79 #include "web/ContextMenuAllowedScope.h" |
| 80 #include "web/WebDataSourceImpl.h" | 80 #include "web/WebDataSourceImpl.h" |
| 81 #include "web/WebLocalFrameImpl.h" | 81 #include "web/WebLocalFrameImpl.h" |
| 82 #include "web/WebPluginContainerImpl.h" | 82 #include "web/WebPluginContainerImpl.h" |
| 83 #include "web/WebViewImpl.h" | 83 #include "web/WebViewImpl.h" |
| 84 #include "wtf/text/WTFString.h" | 84 #include "wtf/text/WTFString.h" |
| 85 | 85 |
| 86 namespace blink { | 86 namespace blink { |
| 87 | 87 |
| 88 // Figure out the URL of a page or subframe. Returns |page_type| as the type, | 88 // Figure out the URL of a page or subframe. Returns |page_type| as the type, |
| 89 // which indicates page or subframe, or ContextNodeType::kNone if the URL could
not | 89 // which indicates page or subframe, or ContextNodeType::kNone if the URL could |
| 90 // be determined for some reason. | 90 // not be determined for some reason. |
| 91 static WebURL urlFromFrame(LocalFrame* frame) { | 91 static WebURL urlFromFrame(LocalFrame* frame) { |
| 92 if (frame) { | 92 if (frame) { |
| 93 DocumentLoader* dl = frame->loader().documentLoader(); | 93 DocumentLoader* dl = frame->loader().documentLoader(); |
| 94 if (dl) { | 94 if (dl) { |
| 95 WebDataSource* ds = WebDataSourceImpl::fromDocumentLoader(dl); | 95 WebDataSource* ds = WebDataSourceImpl::fromDocumentLoader(dl); |
| 96 if (ds) | 96 if (ds) |
| 97 return ds->hasUnreachableURL() ? ds->unreachableURL() | 97 return ds->hasUnreachableURL() ? ds->unreachableURL() |
| 98 : ds->request().url(); | 98 : ds->request().url(); |
| 99 } | 99 } |
| 100 } | 100 } |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 | 355 |
| 356 // Filter out custom menu elements and add them into the data. | 356 // Filter out custom menu elements and add them into the data. |
| 357 populateCustomMenuItems(defaultMenu, &data); | 357 populateCustomMenuItems(defaultMenu, &data); |
| 358 | 358 |
| 359 if (isHTMLAnchorElement(r.URLElement())) { | 359 if (isHTMLAnchorElement(r.URLElement())) { |
| 360 HTMLAnchorElement* anchor = toHTMLAnchorElement(r.URLElement()); | 360 HTMLAnchorElement* anchor = toHTMLAnchorElement(r.URLElement()); |
| 361 | 361 |
| 362 // Extract suggested filename for saving file. | 362 // Extract suggested filename for saving file. |
| 363 data.suggestedFilename = anchor->fastGetAttribute(HTMLNames::downloadAttr); | 363 data.suggestedFilename = anchor->fastGetAttribute(HTMLNames::downloadAttr); |
| 364 | 364 |
| 365 // If the anchor wants to suppress the referrer, update the referrerPolicy a
ccordingly. | 365 // If the anchor wants to suppress the referrer, update the referrerPolicy |
| 366 // accordingly. |
| 366 if (anchor->hasRel(RelationNoReferrer)) | 367 if (anchor->hasRel(RelationNoReferrer)) |
| 367 data.referrerPolicy = WebReferrerPolicyNever; | 368 data.referrerPolicy = WebReferrerPolicyNever; |
| 368 | 369 |
| 369 data.linkText = anchor->innerText(); | 370 data.linkText = anchor->innerText(); |
| 370 } | 371 } |
| 371 | 372 |
| 372 // Find the input field type. | 373 // Find the input field type. |
| 373 if (isHTMLInputElement(r.innerNode())) { | 374 if (isHTMLInputElement(r.innerNode())) { |
| 374 HTMLInputElement* element = toHTMLInputElement(r.innerNode()); | 375 HTMLInputElement* element = toHTMLInputElement(r.innerNode()); |
| 375 if (element->type() == InputTypeNames::password) | 376 if (element->type() == InputTypeNames::password) |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 subMenuItems.swap(outputItems); | 448 subMenuItems.swap(outputItems); |
| 448 } | 449 } |
| 449 | 450 |
| 450 void ContextMenuClientImpl::populateCustomMenuItems( | 451 void ContextMenuClientImpl::populateCustomMenuItems( |
| 451 const ContextMenu* defaultMenu, | 452 const ContextMenu* defaultMenu, |
| 452 WebContextMenuData* data) { | 453 WebContextMenuData* data) { |
| 453 populateSubMenuItems(defaultMenu->items(), data->customItems); | 454 populateSubMenuItems(defaultMenu->items(), data->customItems); |
| 454 } | 455 } |
| 455 | 456 |
| 456 } // namespace blink | 457 } // namespace blink |
| OLD | NEW |