| OLD | NEW |
| 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 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 // (see http://code.google.com/p/chromium/issues/detail?id=2929 ) | 457 // (see http://code.google.com/p/chromium/issues/detail?id=2929 ) |
| 458 // TODO(jungshik): Add a test for the encoding menu to avoid | 458 // TODO(jungshik): Add a test for the encoding menu to avoid |
| 459 // regressing it again. | 459 // regressing it again. |
| 460 // TODO(nasko): Verify the correctness of the above comment, since some of the | 460 // TODO(nasko): Verify the correctness of the above comment, since some of the |
| 461 // code doesn't exist anymore. Also, move this code in the | 461 // code doesn't exist anymore. Also, move this code in the |
| 462 // PageTransitionIsMainFrame code block above. | 462 // PageTransitionIsMainFrame code block above. |
| 463 if (PageTransitionIsMainFrame(params.transition) && delegate_) | 463 if (PageTransitionIsMainFrame(params.transition) && delegate_) |
| 464 delegate_->SetMainFrameMimeType(params.contents_mime_type); | 464 delegate_->SetMainFrameMimeType(params.contents_mime_type); |
| 465 | 465 |
| 466 LoadCommittedDetails details; | 466 LoadCommittedDetails details; |
| 467 bool did_navigate = controller_->RendererDidNavigate(rvh, params, &details); | 467 bool did_navigate = controller_->RendererDidNavigate(render_frame_host, |
| 468 params, &details); |
| 468 | 469 |
| 469 // For now, keep track of each frame's URL in its FrameTreeNode. This lets | 470 // For now, keep track of each frame's URL in its FrameTreeNode. This lets |
| 470 // us estimate our process count for implementing OOP iframes. | 471 // us estimate our process count for implementing OOP iframes. |
| 471 // TODO(creis): Remove this when we track which pages commit in each frame. | 472 // TODO(creis): Remove this when we track which pages commit in each frame. |
| 472 FrameTreeNode* node = | 473 render_frame_host->frame_tree_node()->set_current_url(params.url); |
| 473 frame_tree->FindByRoutingID(params.frame_id, | |
| 474 render_frame_host->GetProcess()->GetID()); | |
| 475 if (node) | |
| 476 node->set_current_url(params.url); | |
| 477 | 474 |
| 478 // Send notification about committed provisional loads. This notification is | 475 // Send notification about committed provisional loads. This notification is |
| 479 // different from the NAV_ENTRY_COMMITTED notification which doesn't include | 476 // different from the NAV_ENTRY_COMMITTED notification which doesn't include |
| 480 // the actual URL navigated to and isn't sent for AUTO_SUBFRAME navigations. | 477 // the actual URL navigated to and isn't sent for AUTO_SUBFRAME navigations. |
| 481 if (details.type != NAVIGATION_TYPE_NAV_IGNORE && delegate_) { | 478 if (details.type != NAVIGATION_TYPE_NAV_IGNORE && delegate_) { |
| 482 // For AUTO_SUBFRAME navigations, an event for the main frame is generated | 479 // For AUTO_SUBFRAME navigations, an event for the main frame is generated |
| 483 // that is not recorded in the navigation history. For the purpose of | 480 // that is not recorded in the navigation history. For the purpose of |
| 484 // tracking navigation events, we treat this event as a sub frame navigation | 481 // tracking navigation events, we treat this event as a sub frame navigation |
| 485 // event. | 482 // event. |
| 486 bool is_main_frame = did_navigate ? details.is_main_frame : false; | 483 bool is_main_frame = did_navigate ? details.is_main_frame : false; |
| 487 PageTransition transition_type = params.transition; | 484 PageTransition transition_type = params.transition; |
| 488 // Whether or not a page transition was triggered by going backward or | 485 // Whether or not a page transition was triggered by going backward or |
| 489 // forward in the history is only stored in the navigation controller's | 486 // forward in the history is only stored in the navigation controller's |
| 490 // entry list. | 487 // entry list. |
| 491 if (did_navigate && | 488 if (did_navigate && |
| 492 (controller_->GetLastCommittedEntry()->GetTransitionType() & | 489 (controller_->GetLastCommittedEntry()->GetTransitionType() & |
| 493 PAGE_TRANSITION_FORWARD_BACK)) { | 490 PAGE_TRANSITION_FORWARD_BACK)) { |
| 494 transition_type = PageTransitionFromInt( | 491 transition_type = PageTransitionFromInt( |
| 495 params.transition | PAGE_TRANSITION_FORWARD_BACK); | 492 params.transition | PAGE_TRANSITION_FORWARD_BACK); |
| 496 } | 493 } |
| 497 | 494 |
| 498 delegate_->DidCommitProvisionalLoad(params.frame_id, | 495 delegate_->DidCommitProvisionalLoad(render_frame_host, |
| 499 params.frame_unique_name, | 496 params.frame_unique_name, |
| 500 is_main_frame, | 497 is_main_frame, |
| 501 params.url, | 498 params.url, |
| 502 transition_type, | 499 transition_type); |
| 503 render_frame_host); | |
| 504 } | 500 } |
| 505 | 501 |
| 506 if (!did_navigate) | 502 if (!did_navigate) |
| 507 return; // No navigation happened. | 503 return; // No navigation happened. |
| 508 | 504 |
| 509 // DO NOT ADD MORE STUFF TO THIS FUNCTION! Your component should either listen | 505 // DO NOT ADD MORE STUFF TO THIS FUNCTION! Your component should either listen |
| 510 // for the appropriate notification (best) or you can add it to | 506 // for the appropriate notification (best) or you can add it to |
| 511 // DidNavigateMainFramePostCommit / DidNavigateAnyFramePostCommit (only if | 507 // DidNavigateMainFramePostCommit / DidNavigateAnyFramePostCommit (only if |
| 512 // necessary, please). | 508 // necessary, please). |
| 513 | 509 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 526 // still be used for a normal web site. | 522 // still be used for a normal web site. |
| 527 if (url == GURL(kAboutBlankURL)) | 523 if (url == GURL(kAboutBlankURL)) |
| 528 return false; | 524 return false; |
| 529 | 525 |
| 530 // The embedder will then have the opportunity to determine if the URL | 526 // The embedder will then have the opportunity to determine if the URL |
| 531 // should "use up" the SiteInstance. | 527 // should "use up" the SiteInstance. |
| 532 return GetContentClient()->browser()->ShouldAssignSiteForURL(url); | 528 return GetContentClient()->browser()->ShouldAssignSiteForURL(url); |
| 533 } | 529 } |
| 534 | 530 |
| 535 } // namespace content | 531 } // namespace content |
| OLD | NEW |