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

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 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 if (!node) 544 if (!node)
545 return; 545 return;
546 Frame* frame = node->document()->frame(); 546 Frame* frame = node->document()->frame();
547 if (!frame) 547 if (!frame)
548 return; 548 return;
549 549
550 if (!m_hitTestResult.isContentEditable()) { 550 if (!m_hitTestResult.isContentEditable()) {
551 FrameLoader* loader = frame->loader(); 551 FrameLoader* loader = frame->loader();
552 KURL linkURL = m_hitTestResult.absoluteLinkURL(); 552 KURL linkURL = m_hitTestResult.absoluteLinkURL();
553 if (!linkURL.isEmpty()) { 553 if (!linkURL.isEmpty()) {
554 if (loader->client()->canHandleRequest(ResourceRequest(linkURL))) { 554 appendItem(OpenLinkItem, m_contextMenu.get());
555 appendItem(OpenLinkItem, m_contextMenu.get()); 555 appendItem(OpenLinkInNewWindowItem, m_contextMenu.get());
556 appendItem(OpenLinkInNewWindowItem, m_contextMenu.get()); 556 appendItem(DownloadFileItem, m_contextMenu.get());
557 appendItem(DownloadFileItem, m_contextMenu.get());
558 }
559 appendItem(CopyLinkItem, m_contextMenu.get()); 557 appendItem(CopyLinkItem, m_contextMenu.get());
560 } 558 }
561 559
562 KURL imageURL = m_hitTestResult.absoluteImageURL(); 560 KURL imageURL = m_hitTestResult.absoluteImageURL();
563 if (!imageURL.isEmpty()) { 561 if (!imageURL.isEmpty()) {
564 if (!linkURL.isEmpty()) 562 if (!linkURL.isEmpty())
565 appendItem(*separatorItem(), m_contextMenu.get()); 563 appendItem(*separatorItem(), m_contextMenu.get());
566 564
567 appendItem(OpenImageInNewWindowItem, m_contextMenu.get()); 565 appendItem(OpenImageInNewWindowItem, m_contextMenu.get());
568 appendItem(DownloadImageItem, m_contextMenu.get()); 566 appendItem(DownloadImageItem, m_contextMenu.get());
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 if (!dictationAlternatives.isEmpty()) { 659 if (!dictationAlternatives.isEmpty()) {
662 for (size_t i = 0; i < dictationAlternatives.size(); ++i) { 660 for (size_t i = 0; i < dictationAlternatives.size(); ++i) {
663 ContextMenuItem item(ActionType, ContextMenuItemTagDicta tionAlternative, dictationAlternatives[i]); 661 ContextMenuItem item(ActionType, ContextMenuItemTagDicta tionAlternative, dictationAlternatives[i]);
664 appendItem(item, m_contextMenu.get()); 662 appendItem(item, m_contextMenu.get());
665 } 663 }
666 appendItem(*separatorItem(), m_contextMenu.get()); 664 appendItem(*separatorItem(), m_contextMenu.get());
667 } 665 }
668 } 666 }
669 } 667 }
670 668
671 FrameLoader* loader = frame->loader();
672 KURL linkURL = m_hitTestResult.absoluteLinkURL(); 669 KURL linkURL = m_hitTestResult.absoluteLinkURL();
673 if (!linkURL.isEmpty()) { 670 if (!linkURL.isEmpty()) {
674 if (loader->client()->canHandleRequest(ResourceRequest(linkURL))) { 671 appendItem(OpenLinkItem, m_contextMenu.get());
675 appendItem(OpenLinkItem, m_contextMenu.get()); 672 appendItem(OpenLinkInNewWindowItem, m_contextMenu.get());
676 appendItem(OpenLinkInNewWindowItem, m_contextMenu.get()); 673 appendItem(DownloadFileItem, m_contextMenu.get());
677 appendItem(DownloadFileItem, m_contextMenu.get());
678 }
679 appendItem(CopyLinkItem, m_contextMenu.get()); 674 appendItem(CopyLinkItem, m_contextMenu.get());
680 appendItem(*separatorItem(), m_contextMenu.get()); 675 appendItem(*separatorItem(), m_contextMenu.get());
681 } 676 }
682 677
683 if (m_hitTestResult.isSelected() && !inPasswordField && selectionContain sPossibleWord(frame)) { 678 if (m_hitTestResult.isSelected() && !inPasswordField && selectionContain sPossibleWord(frame)) {
684 appendItem(SearchWebItem, m_contextMenu.get()); 679 appendItem(SearchWebItem, m_contextMenu.get());
685 appendItem(*separatorItem(), m_contextMenu.get()); 680 appendItem(*separatorItem(), m_contextMenu.get());
686 } 681 }
687 682
688 appendItem(CutItem, m_contextMenu.get()); 683 appendItem(CutItem, m_contextMenu.get());
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 PlatformMouseEvent mouseEvent(clickPoint, clickPoint, RightButton, PlatformE vent::MousePressed, 1, false, false, false, false, currentTime()); 939 PlatformMouseEvent mouseEvent(clickPoint, clickPoint, RightButton, PlatformE vent::MousePressed, 1, false, false, false, false, currentTime());
945 bool handled = frame->eventHandler()->sendContextMenuEvent(mouseEvent); 940 bool handled = frame->eventHandler()->sendContextMenuEvent(mouseEvent);
946 if (handled && client()) 941 if (handled && client())
947 client()->showContextMenu(); 942 client()->showContextMenu();
948 } 943 }
949 #endif 944 #endif
950 945
951 } // namespace WebCore 946 } // namespace WebCore
952 947
953 #endif // ENABLE(CONTEXT_MENUS) 948 #endif // ENABLE(CONTEXT_MENUS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698