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

Side by Side Diff: trunk/src/content/browser/frame_host/navigator_impl.cc

Issue 181113009: Revert 253010 "Revert 251563 "Move browser initiated navigation ..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 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 | Annotate | Revision Log
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/navigator_impl.h" 5 #include "content/browser/frame_host/navigator_impl.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "content/browser/frame_host/frame_tree.h" 8 #include "content/browser/frame_host/frame_tree.h"
9 #include "content/browser/frame_host/frame_tree_node.h" 9 #include "content/browser/frame_host/frame_tree_node.h"
10 #include "content/browser/frame_host/navigation_controller_impl.h" 10 #include "content/browser/frame_host/navigation_controller_impl.h"
(...skipping 14 matching lines...) Expand all
25 #include "content/public/common/bindings_policy.h" 25 #include "content/public/common/bindings_policy.h"
26 #include "content/public/common/content_client.h" 26 #include "content/public/common/content_client.h"
27 #include "content/public/common/content_switches.h" 27 #include "content/public/common/content_switches.h"
28 #include "content/public/common/url_constants.h" 28 #include "content/public/common/url_constants.h"
29 #include "content/public/common/url_utils.h" 29 #include "content/public/common/url_utils.h"
30 30
31 namespace content { 31 namespace content {
32 32
33 namespace { 33 namespace {
34 34
35 ViewMsg_Navigate_Type::Value GetNavigationType( 35 FrameMsg_Navigate_Type::Value GetNavigationType(
36 BrowserContext* browser_context, const NavigationEntryImpl& entry, 36 BrowserContext* browser_context, const NavigationEntryImpl& entry,
37 NavigationController::ReloadType reload_type) { 37 NavigationController::ReloadType reload_type) {
38 switch (reload_type) { 38 switch (reload_type) {
39 case NavigationControllerImpl::RELOAD: 39 case NavigationControllerImpl::RELOAD:
40 return ViewMsg_Navigate_Type::RELOAD; 40 return FrameMsg_Navigate_Type::RELOAD;
41 case NavigationControllerImpl::RELOAD_IGNORING_CACHE: 41 case NavigationControllerImpl::RELOAD_IGNORING_CACHE:
42 return ViewMsg_Navigate_Type::RELOAD_IGNORING_CACHE; 42 return FrameMsg_Navigate_Type::RELOAD_IGNORING_CACHE;
43 case NavigationControllerImpl::RELOAD_ORIGINAL_REQUEST_URL: 43 case NavigationControllerImpl::RELOAD_ORIGINAL_REQUEST_URL:
44 return ViewMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL; 44 return FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL;
45 case NavigationControllerImpl::NO_RELOAD: 45 case NavigationControllerImpl::NO_RELOAD:
46 break; // Fall through to rest of function. 46 break; // Fall through to rest of function.
47 } 47 }
48 48
49 // |RenderViewImpl::PopulateStateFromPendingNavigationParams| differentiates 49 // |RenderViewImpl::PopulateStateFromPendingNavigationParams| differentiates
50 // between |RESTORE_WITH_POST| and |RESTORE|. 50 // between |RESTORE_WITH_POST| and |RESTORE|.
51 if (entry.restore_type() == 51 if (entry.restore_type() ==
52 NavigationEntryImpl::RESTORE_LAST_SESSION_EXITED_CLEANLY) { 52 NavigationEntryImpl::RESTORE_LAST_SESSION_EXITED_CLEANLY) {
53 if (entry.GetHasPostData()) 53 if (entry.GetHasPostData())
54 return ViewMsg_Navigate_Type::RESTORE_WITH_POST; 54 return FrameMsg_Navigate_Type::RESTORE_WITH_POST;
55 return ViewMsg_Navigate_Type::RESTORE; 55 return FrameMsg_Navigate_Type::RESTORE;
56 } 56 }
57 57
58 return ViewMsg_Navigate_Type::NORMAL; 58 return FrameMsg_Navigate_Type::NORMAL;
59 } 59 }
60 60
61 void MakeNavigateParams(const NavigationEntryImpl& entry, 61 void MakeNavigateParams(const NavigationEntryImpl& entry,
62 const NavigationControllerImpl& controller, 62 const NavigationControllerImpl& controller,
63 NavigationController::ReloadType reload_type, 63 NavigationController::ReloadType reload_type,
64 ViewMsg_Navigate_Params* params) { 64 FrameMsg_Navigate_Params* params) {
65 params->page_id = entry.GetPageID(); 65 params->page_id = entry.GetPageID();
66 params->should_clear_history_list = entry.should_clear_history_list(); 66 params->should_clear_history_list = entry.should_clear_history_list();
67 params->should_replace_current_entry = entry.should_replace_entry(); 67 params->should_replace_current_entry = entry.should_replace_entry();
68 if (entry.should_clear_history_list()) { 68 if (entry.should_clear_history_list()) {
69 // Set the history list related parameters to the same values a 69 // Set the history list related parameters to the same values a
70 // NavigationController would return before its first navigation. This will 70 // NavigationController would return before its first navigation. This will
71 // fully clear the RenderView's view of the session history. 71 // fully clear the RenderView's view of the session history.
72 params->pending_history_list_offset = -1; 72 params->pending_history_list_offset = -1;
73 params->current_history_list_offset = -1; 73 params->current_history_list_offset = -1;
74 params->current_history_list_length = 0; 74 params->current_history_list_length = 0;
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 CHECK(0); 325 CHECK(0);
326 } 326 }
327 327
328 // Notify observers that we will navigate in this RenderFrame. 328 // Notify observers that we will navigate in this RenderFrame.
329 if (delegate_) 329 if (delegate_)
330 delegate_->AboutToNavigateRenderFrame(dest_render_frame_host); 330 delegate_->AboutToNavigateRenderFrame(dest_render_frame_host);
331 331
332 // Used for page load time metrics. 332 // Used for page load time metrics.
333 current_load_start_ = base::TimeTicks::Now(); 333 current_load_start_ = base::TimeTicks::Now();
334 334
335 // Navigate in the desired RenderViewHost. 335 // Navigate in the desired RenderFrameHost.
336 // TODO(creis): As a temporary hack, we currently do cross-process subframe 336 // TODO(creis): As a temporary hack, we currently do cross-process subframe
337 // navigations in a top-level frame of the new process. Thus, we don't yet 337 // navigations in a top-level frame of the new process. Thus, we don't yet
338 // need to store the correct frame ID in ViewMsg_Navigate_Params. 338 // need to store the correct frame ID in FrameMsg_Navigate_Params.
339 ViewMsg_Navigate_Params navigate_params; 339 FrameMsg_Navigate_Params navigate_params;
340 MakeNavigateParams(entry, *controller_, reload_type, &navigate_params); 340 MakeNavigateParams(entry, *controller_, reload_type, &navigate_params);
341 dest_render_frame_host->render_view_host()->Navigate(navigate_params); 341 dest_render_frame_host->Navigate(navigate_params);
342 342
343 if (entry.GetPageID() == -1) { 343 if (entry.GetPageID() == -1) {
344 // HACK!! This code suppresses javascript: URLs from being added to 344 // HACK!! This code suppresses javascript: URLs from being added to
345 // session history, which is what we want to do for javascript: URLs that 345 // session history, which is what we want to do for javascript: URLs that
346 // do not generate content. What we really need is a message from the 346 // do not generate content. What we really need is a message from the
347 // renderer telling us that a new page was not created. The same message 347 // renderer telling us that a new page was not created. The same message
348 // could be used for mailto: URLs and the like. 348 // could be used for mailto: URLs and the like.
349 if (entry.GetURL().SchemeIs(kJavaScriptScheme)) 349 if (entry.GetURL().SchemeIs(kJavaScriptScheme))
350 return false; 350 return false;
351 } 351 }
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 // still be used for a normal web site. 520 // still be used for a normal web site.
521 if (url == GURL(kAboutBlankURL)) 521 if (url == GURL(kAboutBlankURL))
522 return false; 522 return false;
523 523
524 // The embedder will then have the opportunity to determine if the URL 524 // The embedder will then have the opportunity to determine if the URL
525 // should "use up" the SiteInstance. 525 // should "use up" the SiteInstance.
526 return GetContentClient()->browser()->ShouldAssignSiteForURL(url); 526 return GetContentClient()->browser()->ShouldAssignSiteForURL(url);
527 } 527 }
528 528
529 } // namespace content 529 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698