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

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

Issue 148083013: Move browser initiated navigation from RenderViewHost to RenderFrameHost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix ASAN builds. Try 2. Created 6 years, 10 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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 CHECK(0); 327 CHECK(0);
328 } 328 }
329 329
330 // Notify observers that we will navigate in this RenderFrame. 330 // Notify observers that we will navigate in this RenderFrame.
331 if (delegate_) 331 if (delegate_)
332 delegate_->AboutToNavigateRenderFrame(dest_render_frame_host); 332 delegate_->AboutToNavigateRenderFrame(dest_render_frame_host);
333 333
334 // Used for page load time metrics. 334 // Used for page load time metrics.
335 current_load_start_ = base::TimeTicks::Now(); 335 current_load_start_ = base::TimeTicks::Now();
336 336
337 // Navigate in the desired RenderViewHost. 337 // Navigate in the desired RenderViewHost.
Charlie Reis 2014/02/13 01:23:53 nit: RenderFrameHost.
nasko 2014/02/13 17:05:27 Done.
338 // TODO(creis): As a temporary hack, we currently do cross-process subframe 338 // TODO(creis): As a temporary hack, we currently do cross-process subframe
339 // navigations in a top-level frame of the new process. Thus, we don't yet 339 // navigations in a top-level frame of the new process. Thus, we don't yet
340 // need to store the correct frame ID in ViewMsg_Navigate_Params. 340 // need to store the correct frame ID in FrameMsg_Navigate_Params.
341 ViewMsg_Navigate_Params navigate_params; 341 FrameMsg_Navigate_Params navigate_params;
342 MakeNavigateParams(entry, *controller_, reload_type, &navigate_params); 342 MakeNavigateParams(entry, *controller_, reload_type, &navigate_params);
343 dest_render_frame_host->render_view_host()->Navigate(navigate_params); 343 dest_render_frame_host->Navigate(navigate_params);
344 344
345 if (entry.GetPageID() == -1) { 345 if (entry.GetPageID() == -1) {
346 // HACK!! This code suppresses javascript: URLs from being added to 346 // HACK!! This code suppresses javascript: URLs from being added to
347 // session history, which is what we want to do for javascript: URLs that 347 // session history, which is what we want to do for javascript: URLs that
348 // do not generate content. What we really need is a message from the 348 // do not generate content. What we really need is a message from the
349 // renderer telling us that a new page was not created. The same message 349 // renderer telling us that a new page was not created. The same message
350 // could be used for mailto: URLs and the like. 350 // could be used for mailto: URLs and the like.
351 if (entry.GetURL().SchemeIs(kJavaScriptScheme)) 351 if (entry.GetURL().SchemeIs(kJavaScriptScheme))
352 return false; 352 return false;
353 } 353 }
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 // still be used for a normal web site. 529 // still be used for a normal web site.
530 if (url == GURL(kAboutBlankURL)) 530 if (url == GURL(kAboutBlankURL))
531 return false; 531 return false;
532 532
533 // The embedder will then have the opportunity to determine if the URL 533 // The embedder will then have the opportunity to determine if the URL
534 // should "use up" the SiteInstance. 534 // should "use up" the SiteInstance.
535 return GetContentClient()->browser()->ShouldAssignSiteForURL(url); 535 return GetContentClient()->browser()->ShouldAssignSiteForURL(url);
536 } 536 }
537 537
538 } // namespace content 538 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698