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

Side by Side Diff: content/browser/frame_host/navigation_controller_impl.cc

Issue 1002953004: Ensure we properly set PageTransition for iframes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/frame_host/navigation_controller_impl.h" 5 #include "content/browser/frame_host/navigation_controller_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 898
899 NavigationType NavigationControllerImpl::ClassifyNavigation( 899 NavigationType NavigationControllerImpl::ClassifyNavigation(
900 RenderFrameHostImpl* rfh, 900 RenderFrameHostImpl* rfh,
901 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) const { 901 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) const {
902 if (params.page_id == -1) { 902 if (params.page_id == -1) {
903 // TODO(nasko, creis): An out-of-process child frame has no way of 903 // TODO(nasko, creis): An out-of-process child frame has no way of
904 // knowing the page_id of its parent, so it is passing back -1. The 904 // knowing the page_id of its parent, so it is passing back -1. The
905 // semantics here should be re-evaluated during session history refactor 905 // semantics here should be re-evaluated during session history refactor
906 // (see http://crbug.com/236848). For now, we assume this means the 906 // (see http://crbug.com/236848). For now, we assume this means the
907 // child frame loaded and proceed. Note that this may do the wrong thing 907 // child frame loaded and proceed. Note that this may do the wrong thing
908 // for cross-process AUTO_SUBFRAME navigations. 908 // for cross-process AUTO_SUBFRAME navigations.
Avi (use Gerrit) 2015/03/12 20:40:28 This comment seems out-of-date with this change.
Nate Chapin 2015/03/12 20:51:12 Removed.
909 if (rfh->IsCrossProcessSubframe()) 909 if (rfh->IsCrossProcessSubframe()) {
910 return NAVIGATION_TYPE_NEW_SUBFRAME; 910 CHECK(!ui::PageTransitionIsMainFrame(params.transition));
911 if (ui::PageTransitionCoreTypeIs(params.transition,
912 ui::PAGE_TRANSITION_MANUAL_SUBFRAME)) {
913 return NAVIGATION_TYPE_NEW_SUBFRAME;
914 } else {
915 return NAVIGATION_TYPE_AUTO_SUBFRAME;
916 }
917 }
911 918
912 // The renderer generates the page IDs, and so if it gives us the invalid 919 // The renderer generates the page IDs, and so if it gives us the invalid
913 // page ID (-1) we know it didn't actually navigate. This happens in a few 920 // page ID (-1) we know it didn't actually navigate. This happens in a few
914 // cases: 921 // cases:
915 // 922 //
916 // - If a page makes a popup navigated to about blank, and then writes 923 // - If a page makes a popup navigated to about blank, and then writes
917 // stuff like a subframe navigated to a real page. We'll get the commit 924 // stuff like a subframe navigated to a real page. We'll get the commit
918 // for the subframe, but there won't be any commit for the outer page. 925 // for the subframe, but there won't be any commit for the outer page.
919 // 926 //
920 // - We were also getting these for failed loads (for example, bug 21849). 927 // - We were also getting these for failed loads (for example, bug 21849).
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
1236 ui::PAGE_TRANSITION_MANUAL_SUBFRAME)) { 1243 ui::PAGE_TRANSITION_MANUAL_SUBFRAME)) {
1237 // There was a comment here that said, "This is not user-initiated. Ignore." 1244 // There was a comment here that said, "This is not user-initiated. Ignore."
1238 // But this makes no sense; non-user-initiated navigations should be 1245 // But this makes no sense; non-user-initiated navigations should be
1239 // determined to be of type NAVIGATION_TYPE_AUTO_SUBFRAME and sent to 1246 // determined to be of type NAVIGATION_TYPE_AUTO_SUBFRAME and sent to
1240 // RendererDidNavigateAutoSubframe below. 1247 // RendererDidNavigateAutoSubframe below.
1241 // 1248 //
1242 // This if clause dates back to https://codereview.chromium.org/115919 and 1249 // This if clause dates back to https://codereview.chromium.org/115919 and
1243 // the handling of immediate redirects. TODO(avi): Is this still valid? I'm 1250 // the handling of immediate redirects. TODO(avi): Is this still valid? I'm
1244 // pretty sure that's there's nothing left of that code and that we should 1251 // pretty sure that's there's nothing left of that code and that we should
1245 // take this out. 1252 // take this out.
1246 //
1247 // Except for cross-process iframes; this doesn't work yet for them.
1248 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
1249 switches::kSitePerProcess)) {
1250 NOTREACHED();
1251 }
1252
1253 DiscardNonCommittedEntriesInternal(); 1253 DiscardNonCommittedEntriesInternal();
1254 return; 1254 return;
Avi (use Gerrit) 2015/03/12 20:40:28 This is the wrong fix; this would always ignore a
Nate Chapin 2015/03/12 20:51:12 Done.
1255 } 1255 }
1256 1256
1257 // Manual subframe navigations just get the current entry cloned so the user 1257 // Manual subframe navigations just get the current entry cloned so the user
1258 // can go back or forward to it. The actual subframe information will be 1258 // can go back or forward to it. The actual subframe information will be
1259 // stored in the page state for each of those entries. This happens out of 1259 // stored in the page state for each of those entries. This happens out of
1260 // band with the actual navigations. 1260 // band with the actual navigations.
1261 DCHECK(GetLastCommittedEntry()) << "ClassifyNavigation should guarantee " 1261 DCHECK(GetLastCommittedEntry()) << "ClassifyNavigation should guarantee "
1262 << "that a last committed entry exists."; 1262 << "that a last committed entry exists.";
1263 NavigationEntryImpl* new_entry = 1263 NavigationEntryImpl* new_entry =
1264 new NavigationEntryImpl(*GetLastCommittedEntry()); 1264 new NavigationEntryImpl(*GetLastCommittedEntry());
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
1814 } 1814 }
1815 } 1815 }
1816 } 1816 }
1817 1817
1818 void NavigationControllerImpl::SetGetTimestampCallbackForTest( 1818 void NavigationControllerImpl::SetGetTimestampCallbackForTest(
1819 const base::Callback<base::Time()>& get_timestamp_callback) { 1819 const base::Callback<base::Time()>& get_timestamp_callback) {
1820 get_timestamp_callback_ = get_timestamp_callback; 1820 get_timestamp_callback_ = get_timestamp_callback;
1821 } 1821 }
1822 1822
1823 } // namespace content 1823 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/render_frame_impl.cc » ('j') | content/renderer/render_frame_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698