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 25 matching lines...) Expand all Loading... | |
36 #include "bindings/v8/ExceptionStatePlaceholder.h" | 36 #include "bindings/v8/ExceptionStatePlaceholder.h" |
37 #include "core/css/CSSStyleDeclaration.h" | 37 #include "core/css/CSSStyleDeclaration.h" |
38 #include "core/dom/Document.h" | 38 #include "core/dom/Document.h" |
39 #include "core/dom/DocumentMarkerController.h" | 39 #include "core/dom/DocumentMarkerController.h" |
40 #include "core/editing/Editor.h" | 40 #include "core/editing/Editor.h" |
41 #include "core/editing/SpellChecker.h" | 41 #include "core/editing/SpellChecker.h" |
42 #include "core/frame/FrameHost.h" | 42 #include "core/frame/FrameHost.h" |
43 #include "core/frame/FrameView.h" | 43 #include "core/frame/FrameView.h" |
44 #include "core/frame/PinchViewport.h" | 44 #include "core/frame/PinchViewport.h" |
45 #include "core/frame/Settings.h" | 45 #include "core/frame/Settings.h" |
46 #include "core/html/HTMLAnchorElement.h" | |
46 #include "core/html/HTMLFormElement.h" | 47 #include "core/html/HTMLFormElement.h" |
47 #include "core/html/HTMLInputElement.h" | 48 #include "core/html/HTMLInputElement.h" |
48 #include "core/html/HTMLMediaElement.h" | 49 #include "core/html/HTMLMediaElement.h" |
49 #include "core/html/HTMLPlugInElement.h" | 50 #include "core/html/HTMLPlugInElement.h" |
50 #include "core/html/MediaError.h" | 51 #include "core/html/MediaError.h" |
51 #include "core/loader/DocumentLoader.h" | 52 #include "core/loader/DocumentLoader.h" |
52 #include "core/loader/FrameLoader.h" | 53 #include "core/loader/FrameLoader.h" |
53 #include "core/loader/HistoryItem.h" | 54 #include "core/loader/HistoryItem.h" |
54 #include "core/page/ContextMenuController.h" | 55 #include "core/page/ContextMenuController.h" |
55 #include "core/page/EventHandler.h" | 56 #include "core/page/EventHandler.h" |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
364 DocumentLoader* dl = selectedFrame->loader().documentLoader(); | 365 DocumentLoader* dl = selectedFrame->loader().documentLoader(); |
365 WebDataSource* ds = WebDataSourceImpl::fromDocumentLoader(dl); | 366 WebDataSource* ds = WebDataSourceImpl::fromDocumentLoader(dl); |
366 if (ds) | 367 if (ds) |
367 data.securityInfo = ds->response().securityInfo(); | 368 data.securityInfo = ds->response().securityInfo(); |
368 | 369 |
369 data.referrerPolicy = static_cast<WebReferrerPolicy>(selectedFrame->document ()->referrerPolicy()); | 370 data.referrerPolicy = static_cast<WebReferrerPolicy>(selectedFrame->document ()->referrerPolicy()); |
370 | 371 |
371 // Filter out custom menu elements and add them into the data. | 372 // Filter out custom menu elements and add them into the data. |
372 populateCustomMenuItems(defaultMenu, &data); | 373 populateCustomMenuItems(defaultMenu, &data); |
373 | 374 |
375 // Extract suggested filename for saving file. | |
376 if (isHTMLAnchorElement(r.URLElement())) { | |
377 HTMLAnchorElement* anchor = toHTMLAnchorElement(r.URLElement()); | |
378 data.suggestedFilename = anchor->fastGetAttribute(HTMLNames::downloadAtt r); | |
379 } | |
abarth-chromium
2014/06/18 23:38:48
Why not put this information in WebCore::ContextMe
asanka
2014/06/19 21:22:19
As in, eliminate WebContextMenuData?
| |
380 | |
374 data.node = r.innerNonSharedNode(); | 381 data.node = r.innerNonSharedNode(); |
375 | 382 |
376 WebLocalFrameImpl* selectedWebFrame = WebLocalFrameImpl::fromFrame(selectedF rame); | 383 WebLocalFrameImpl* selectedWebFrame = WebLocalFrameImpl::fromFrame(selectedF rame); |
377 if (selectedWebFrame->client()) | 384 if (selectedWebFrame->client()) |
378 selectedWebFrame->client()->showContextMenu(data); | 385 selectedWebFrame->client()->showContextMenu(data); |
379 } | 386 } |
380 | 387 |
381 void ContextMenuClientImpl::clearContextMenu() | 388 void ContextMenuClientImpl::clearContextMenu() |
382 { | 389 { |
383 HitTestResult r = m_webView->page()->contextMenuController().hitTestResult() ; | 390 HitTestResult r = m_webView->page()->contextMenuController().hitTestResult() ; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
426 outputItems[i] = subItems[i]; | 433 outputItems[i] = subItems[i]; |
427 subMenuItems.swap(outputItems); | 434 subMenuItems.swap(outputItems); |
428 } | 435 } |
429 | 436 |
430 void ContextMenuClientImpl::populateCustomMenuItems(const WebCore::ContextMenu* defaultMenu, WebContextMenuData* data) | 437 void ContextMenuClientImpl::populateCustomMenuItems(const WebCore::ContextMenu* defaultMenu, WebContextMenuData* data) |
431 { | 438 { |
432 populateSubMenuItems(defaultMenu->items(), data->customItems); | 439 populateSubMenuItems(defaultMenu->items(), data->customItems); |
433 } | 440 } |
434 | 441 |
435 } // namespace blink | 442 } // namespace blink |
OLD | NEW |