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

Side by Side Diff: Source/core/loader/FrameLoader.cpp

Issue 1152053006: Allow RemoteFrames to be navigated through targeted navigation. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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
« no previous file with comments | « no previous file | no next file » | 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) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
6 * Copyright (C) Research In Motion Limited 2009. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2009. All rights reserved.
7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> 7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com>
8 * Copyright (C) 2011 Google Inc. All rights reserved. 8 * Copyright (C) 2011 Google Inc. All rights reserved.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 #include "core/events/KeyboardEvent.h" 48 #include "core/events/KeyboardEvent.h"
49 #include "core/events/MouseEvent.h" 49 #include "core/events/MouseEvent.h"
50 #include "core/events/PageTransitionEvent.h" 50 #include "core/events/PageTransitionEvent.h"
51 #include "core/fetch/ResourceFetcher.h" 51 #include "core/fetch/ResourceFetcher.h"
52 #include "core/fetch/ResourceLoader.h" 52 #include "core/fetch/ResourceLoader.h"
53 #include "core/frame/LocalDOMWindow.h" 53 #include "core/frame/LocalDOMWindow.h"
54 #include "core/frame/FrameHost.h" 54 #include "core/frame/FrameHost.h"
55 #include "core/frame/FrameView.h" 55 #include "core/frame/FrameView.h"
56 #include "core/frame/LocalFrame.h" 56 #include "core/frame/LocalFrame.h"
57 #include "core/frame/PinchViewport.h" 57 #include "core/frame/PinchViewport.h"
58 #include "core/frame/RemoteFrame.h"
58 #include "core/frame/Settings.h" 59 #include "core/frame/Settings.h"
59 #include "core/frame/csp/ContentSecurityPolicy.h" 60 #include "core/frame/csp/ContentSecurityPolicy.h"
60 #include "core/html/HTMLFormElement.h" 61 #include "core/html/HTMLFormElement.h"
61 #include "core/html/HTMLFrameOwnerElement.h" 62 #include "core/html/HTMLFrameOwnerElement.h"
62 #include "core/html/parser/HTMLParserIdioms.h" 63 #include "core/html/parser/HTMLParserIdioms.h"
63 #include "core/input/EventHandler.h" 64 #include "core/input/EventHandler.h"
64 #include "core/inspector/ConsoleMessage.h" 65 #include "core/inspector/ConsoleMessage.h"
65 #include "core/inspector/InspectorInstrumentation.h" 66 #include "core/inspector/InspectorInstrumentation.h"
66 #include "core/loader/DocumentLoadTiming.h" 67 #include "core/loader/DocumentLoadTiming.h"
67 #include "core/loader/DocumentLoader.h" 68 #include "core/loader/DocumentLoader.h"
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 if (!request.originDocument()->securityOrigin()->canDisplay(url)) { 687 if (!request.originDocument()->securityOrigin()->canDisplay(url)) {
687 reportLocalLoadFailed(m_frame, url.elidedString()); 688 reportLocalLoadFailed(m_frame, url.elidedString());
688 return false; 689 return false;
689 } 690 }
690 691
691 if (!request.form() && request.frameName().isEmpty()) 692 if (!request.form() && request.frameName().isEmpty())
692 request.setFrameName(m_frame->document()->baseTarget()); 693 request.setFrameName(m_frame->document()->baseTarget());
693 return true; 694 return true;
694 } 695 }
695 696
696 static bool shouldOpenInNewWindow(LocalFrame* targetFrame, const FrameLoadReques t& request, NavigationPolicy policy) 697 static bool shouldOpenInNewWindow(Frame* targetFrame, const FrameLoadRequest& re quest, NavigationPolicy policy)
697 { 698 {
698 if (!targetFrame && !request.frameName().isEmpty()) 699 if (!targetFrame && !request.frameName().isEmpty())
699 return true; 700 return true;
700 // FIXME: This case is a workaround for the fact that ctrl+clicking a form s ubmission incorrectly 701 // FIXME: This case is a workaround for the fact that ctrl+clicking a form s ubmission incorrectly
701 // sends as a GET rather than a POST if it creates a new window in a differe nt process. 702 // sends as a GET rather than a POST if it creates a new window in a differe nt process.
702 return request.form() && policy != NavigationPolicyCurrentTab; 703 return request.form() && policy != NavigationPolicyCurrentTab;
703 } 704 }
704 705
705 static NavigationType determineNavigationType(FrameLoadType frameLoadType, bool isFormSubmission, bool haveEvent) 706 static NavigationType determineNavigationType(FrameLoadType frameLoadType, bool isFormSubmission, bool haveEvent)
706 { 707 {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 772
772 if (m_inStopAllLoaders) 773 if (m_inStopAllLoaders)
773 return; 774 return;
774 775
775 FrameLoadRequest request(passedRequest); 776 FrameLoadRequest request(passedRequest);
776 request.resourceRequest().setHasUserGesture(UserGestureIndicator::processing UserGesture()); 777 request.resourceRequest().setHasUserGesture(UserGestureIndicator::processing UserGesture());
777 778
778 if (!prepareRequestForThisFrame(request)) 779 if (!prepareRequestForThisFrame(request))
779 return; 780 return;
780 781
781 RefPtrWillBeRawPtr<LocalFrame> targetFrame = toLocalFrame(request.form() ? n ullptr : m_frame->findFrameForNavigation(AtomicString(request.frameName()), *m_f rame)); 782 RefPtrWillBeRawPtr<Frame> targetFrame = request.form() ? nullptr : m_frame-> findFrameForNavigation(AtomicString(request.frameName()), *m_frame);
782 if (targetFrame && targetFrame.get() != m_frame) { 783 if (targetFrame && targetFrame.get() != m_frame) {
783 bool wasInSamePage = targetFrame->page() == m_frame->page(); 784 bool wasInSamePage = targetFrame->page() == m_frame->page();
784 785
785 request.setFrameName("_self"); 786 request.setFrameName("_self");
786 targetFrame->loader().load(request); 787 if (targetFrame->isLocalFrame()) {
788 toLocalFrame(targetFrame.get())->loader().load(request);
Nate Chapin 2015/06/05 23:34:47 This feels like the wrong place for this logic. Co
nasko 2015/06/08 15:57:10 Done.
789 } else {
790 bool hasUserGesture = UserGestureIndicator::processingUserGesture();
791 toRemoteFrame(targetFrame.get())->navigate(
792 *passedRequest.originDocument(), passedRequest.resourceRequest() .url(),
793 false, hasUserGesture ? UserGestureStatus::Active : UserGestureS tatus::None);
794 }
795
787 Page* page = targetFrame->page(); 796 Page* page = targetFrame->page();
788 if (!wasInSamePage && page) 797 if (!wasInSamePage && page)
789 page->chromeClient().focus(); 798 page->chromeClient().focus();
790 return; 799 return;
791 } 800 }
792 801
793 setReferrerForFrameRequest(request.resourceRequest(), request.shouldSendRefe rrer(), request.originDocument()); 802 setReferrerForFrameRequest(request.resourceRequest(), request.shouldSendRefe rrer(), request.originDocument());
794 803
795 FrameLoadType newLoadType = determineFrameLoadType(request); 804 FrameLoadType newLoadType = determineFrameLoadType(request);
796 NavigationPolicy policy = navigationPolicyForRequest(request); 805 NavigationPolicy policy = navigationPolicyForRequest(request);
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
1444 // FIXME: We need a way to propagate insecure requests policy flags to 1453 // FIXME: We need a way to propagate insecure requests policy flags to
1445 // out-of-process frames. For now, we'll always use default behavior. 1454 // out-of-process frames. For now, we'll always use default behavior.
1446 if (!parentFrame->isLocalFrame()) 1455 if (!parentFrame->isLocalFrame())
1447 return nullptr; 1456 return nullptr;
1448 1457
1449 ASSERT(toLocalFrame(parentFrame)->document()); 1458 ASSERT(toLocalFrame(parentFrame)->document());
1450 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade() ; 1459 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade() ;
1451 } 1460 }
1452 1461
1453 } // namespace blink 1462 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698