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

Side by Side Diff: Source/WebCore/page/ContextMenuController.cpp

Issue 14264012: Create errors (especially cancellation errors) internally to WebCore, rather (Closed) Base URL: svn://svn.chromium.org/blink/trunk/
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Igalia S.L 3 * Copyright (C) 2010 Igalia S.L
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 if (!node) 539 if (!node)
540 return; 540 return;
541 Frame* frame = node->document()->frame(); 541 Frame* frame = node->document()->frame();
542 if (!frame) 542 if (!frame)
543 return; 543 return;
544 544
545 if (!m_hitTestResult.isContentEditable()) { 545 if (!m_hitTestResult.isContentEditable()) {
546 FrameLoader* loader = frame->loader(); 546 FrameLoader* loader = frame->loader();
547 KURL linkURL = m_hitTestResult.absoluteLinkURL(); 547 KURL linkURL = m_hitTestResult.absoluteLinkURL();
548 if (!linkURL.isEmpty()) { 548 if (!linkURL.isEmpty()) {
549 if (loader->client()->canHandleRequest(ResourceRequest(linkURL))) { 549 appendItem(OpenLinkItem, m_contextMenu.get());
550 appendItem(OpenLinkItem, m_contextMenu.get()); 550 appendItem(OpenLinkInNewWindowItem, m_contextMenu.get());
551 appendItem(OpenLinkInNewWindowItem, m_contextMenu.get()); 551 appendItem(DownloadFileItem, m_contextMenu.get());
552 appendItem(DownloadFileItem, m_contextMenu.get());
553 }
554 appendItem(CopyLinkItem, m_contextMenu.get()); 552 appendItem(CopyLinkItem, m_contextMenu.get());
555 } 553 }
556 554
557 KURL imageURL = m_hitTestResult.absoluteImageURL(); 555 KURL imageURL = m_hitTestResult.absoluteImageURL();
558 if (!imageURL.isEmpty()) { 556 if (!imageURL.isEmpty()) {
559 if (!linkURL.isEmpty()) 557 if (!linkURL.isEmpty())
560 appendItem(*separatorItem(), m_contextMenu.get()); 558 appendItem(*separatorItem(), m_contextMenu.get());
561 559
562 appendItem(OpenImageInNewWindowItem, m_contextMenu.get()); 560 appendItem(OpenImageInNewWindowItem, m_contextMenu.get());
563 appendItem(DownloadImageItem, m_contextMenu.get()); 561 appendItem(DownloadImageItem, m_contextMenu.get());
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 if (!dictationAlternatives.isEmpty()) { 654 if (!dictationAlternatives.isEmpty()) {
657 for (size_t i = 0; i < dictationAlternatives.size(); ++i) { 655 for (size_t i = 0; i < dictationAlternatives.size(); ++i) {
658 ContextMenuItem item(ActionType, ContextMenuItemTagDicta tionAlternative, dictationAlternatives[i]); 656 ContextMenuItem item(ActionType, ContextMenuItemTagDicta tionAlternative, dictationAlternatives[i]);
659 appendItem(item, m_contextMenu.get()); 657 appendItem(item, m_contextMenu.get());
660 } 658 }
661 appendItem(*separatorItem(), m_contextMenu.get()); 659 appendItem(*separatorItem(), m_contextMenu.get());
662 } 660 }
663 } 661 }
664 } 662 }
665 663
666 FrameLoader* loader = frame->loader();
667 KURL linkURL = m_hitTestResult.absoluteLinkURL(); 664 KURL linkURL = m_hitTestResult.absoluteLinkURL();
668 if (!linkURL.isEmpty()) { 665 if (!linkURL.isEmpty()) {
669 if (loader->client()->canHandleRequest(ResourceRequest(linkURL))) { 666 appendItem(OpenLinkItem, m_contextMenu.get());
670 appendItem(OpenLinkItem, m_contextMenu.get()); 667 appendItem(OpenLinkInNewWindowItem, m_contextMenu.get());
671 appendItem(OpenLinkInNewWindowItem, m_contextMenu.get()); 668 appendItem(DownloadFileItem, m_contextMenu.get());
672 appendItem(DownloadFileItem, m_contextMenu.get());
673 }
674 appendItem(CopyLinkItem, m_contextMenu.get()); 669 appendItem(CopyLinkItem, m_contextMenu.get());
675 appendItem(*separatorItem(), m_contextMenu.get()); 670 appendItem(*separatorItem(), m_contextMenu.get());
676 } 671 }
677 672
678 if (m_hitTestResult.isSelected() && !inPasswordField && selectionContain sPossibleWord(frame)) { 673 if (m_hitTestResult.isSelected() && !inPasswordField && selectionContain sPossibleWord(frame)) {
679 appendItem(SearchWebItem, m_contextMenu.get()); 674 appendItem(SearchWebItem, m_contextMenu.get());
680 appendItem(*separatorItem(), m_contextMenu.get()); 675 appendItem(*separatorItem(), m_contextMenu.get());
681 } 676 }
682 677
683 appendItem(CutItem, m_contextMenu.get()); 678 appendItem(CutItem, m_contextMenu.get());
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 PlatformMouseEvent mouseEvent(clickPoint, clickPoint, RightButton, PlatformE vent::MousePressed, 1, false, false, false, false, currentTime()); 930 PlatformMouseEvent mouseEvent(clickPoint, clickPoint, RightButton, PlatformE vent::MousePressed, 1, false, false, false, false, currentTime());
936 bool handled = frame->eventHandler()->sendContextMenuEvent(mouseEvent); 931 bool handled = frame->eventHandler()->sendContextMenuEvent(mouseEvent);
937 if (handled && client()) 932 if (handled && client())
938 client()->showContextMenu(); 933 client()->showContextMenu();
939 } 934 }
940 #endif 935 #endif
941 936
942 } // namespace WebCore 937 } // namespace WebCore
943 938
944 #endif // ENABLE(CONTEXT_MENUS) 939 #endif // ENABLE(CONTEXT_MENUS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698