| 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/render_frame_host_impl.h" | 5 #include "content/browser/frame_host/render_frame_host_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/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
| 10 #include "base/debug/crash_logging.h" | |
| 11 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| 12 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 13 #include "base/metrics/user_metrics_action.h" | 12 #include "base/metrics/user_metrics_action.h" |
| 14 #include "base/strings/string_number_conversions.h" | |
| 15 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 16 #include "content/browser/accessibility/accessibility_mode_helper.h" | 14 #include "content/browser/accessibility/accessibility_mode_helper.h" |
| 17 #include "content/browser/accessibility/browser_accessibility_manager.h" | 15 #include "content/browser/accessibility/browser_accessibility_manager.h" |
| 18 #include "content/browser/accessibility/browser_accessibility_state_impl.h" | 16 #include "content/browser/accessibility/browser_accessibility_state_impl.h" |
| 19 #include "content/browser/child_process_security_policy_impl.h" | 17 #include "content/browser/child_process_security_policy_impl.h" |
| 20 #include "content/browser/frame_host/cross_process_frame_connector.h" | 18 #include "content/browser/frame_host/cross_process_frame_connector.h" |
| 21 #include "content/browser/frame_host/cross_site_transferring_request.h" | 19 #include "content/browser/frame_host/cross_site_transferring_request.h" |
| 22 #include "content/browser/frame_host/frame_tree.h" | 20 #include "content/browser/frame_host/frame_tree.h" |
| 23 #include "content/browser/frame_host/frame_tree_node.h" | 21 #include "content/browser/frame_host/frame_tree_node.h" |
| 24 #include "content/browser/frame_host/navigator.h" | 22 #include "content/browser/frame_host/navigator.h" |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 GetProcess()->FilterURL(false, &validated_url); | 603 GetProcess()->FilterURL(false, &validated_url); |
| 606 | 604 |
| 607 frame_tree_node_->navigator()->DidFailLoadWithError( | 605 frame_tree_node_->navigator()->DidFailLoadWithError( |
| 608 this, validated_url, error_code, error_description); | 606 this, validated_url, error_code, error_description); |
| 609 } | 607 } |
| 610 | 608 |
| 611 void RenderFrameHostImpl::OnDidRedirectProvisionalLoad( | 609 void RenderFrameHostImpl::OnDidRedirectProvisionalLoad( |
| 612 int32 page_id, | 610 int32 page_id, |
| 613 const GURL& source_url, | 611 const GURL& source_url, |
| 614 const GURL& target_url) { | 612 const GURL& target_url) { |
| 615 if (render_view_host_->page_id_ != page_id) { | |
| 616 base::debug::SetCrashKeyValue("url1", | |
| 617 source_url.possibly_invalid_spec()); | |
| 618 base::debug::SetCrashKeyValue("url2", | |
| 619 target_url.possibly_invalid_spec()); | |
| 620 base::debug::SetCrashKeyValue( | |
| 621 "id1", base::IntToString(render_view_host_->page_id_)); | |
| 622 base::debug::SetCrashKeyValue("id2", | |
| 623 base::IntToString(page_id)); | |
| 624 CHECK(false); | |
| 625 } | |
| 626 frame_tree_node_->navigator()->DidRedirectProvisionalLoad( | 613 frame_tree_node_->navigator()->DidRedirectProvisionalLoad( |
| 627 this, render_view_host_->page_id_, source_url, target_url); | 614 this, page_id, source_url, target_url); |
| 628 } | 615 } |
| 629 | 616 |
| 630 // Called when the renderer navigates. For every frame loaded, we'll get this | 617 // Called when the renderer navigates. For every frame loaded, we'll get this |
| 631 // notification containing parameters identifying the navigation. | 618 // notification containing parameters identifying the navigation. |
| 632 // | 619 // |
| 633 // Subframes are identified by the page transition type. For subframes loaded | 620 // Subframes are identified by the page transition type. For subframes loaded |
| 634 // as part of a wider page load, the page_id will be the same as for the top | 621 // as part of a wider page load, the page_id will be the same as for the top |
| 635 // level frame. If the user explicitly requests a subframe navigation, we will | 622 // level frame. If the user explicitly requests a subframe navigation, we will |
| 636 // get a new page_id because we need to create a new navigation entry for that | 623 // get a new page_id because we need to create a new navigation entry for that |
| 637 // action. | 624 // action. |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 978 void RenderFrameHostImpl::OnDidAssignPageId(int32 page_id) { | 965 void RenderFrameHostImpl::OnDidAssignPageId(int32 page_id) { |
| 979 // Update the RVH's current page ID so that future IPCs from the renderer | 966 // Update the RVH's current page ID so that future IPCs from the renderer |
| 980 // correspond to the new page. | 967 // correspond to the new page. |
| 981 render_view_host_->page_id_ = page_id; | 968 render_view_host_->page_id_ = page_id; |
| 982 } | 969 } |
| 983 | 970 |
| 984 void RenderFrameHostImpl::OnUpdateTitle( | 971 void RenderFrameHostImpl::OnUpdateTitle( |
| 985 int32 page_id, | 972 int32 page_id, |
| 986 const base::string16& title, | 973 const base::string16& title, |
| 987 blink::WebTextDirection title_direction) { | 974 blink::WebTextDirection title_direction) { |
| 988 if (render_view_host_->page_id_ != page_id) { | |
| 989 base::debug::SetCrashKeyValue( | |
| 990 "url1", GetLastCommittedURL().possibly_invalid_spec()); | |
| 991 base::debug::SetCrashKeyValue( | |
| 992 "id1", base::IntToString(render_view_host_->page_id_)); | |
| 993 base::debug::SetCrashKeyValue("id2", | |
| 994 base::IntToString(page_id)); | |
| 995 CHECK(false); | |
| 996 } | |
| 997 // This message is only sent for top-level frames. TODO(avi): when frame tree | 975 // This message is only sent for top-level frames. TODO(avi): when frame tree |
| 998 // mirroring works correctly, add a check here to enforce it. | 976 // mirroring works correctly, add a check here to enforce it. |
| 999 if (title.length() > kMaxTitleChars) { | 977 if (title.length() > kMaxTitleChars) { |
| 1000 NOTREACHED() << "Renderer sent too many characters in title."; | 978 NOTREACHED() << "Renderer sent too many characters in title."; |
| 1001 return; | 979 return; |
| 1002 } | 980 } |
| 1003 | 981 |
| 1004 delegate_->UpdateTitle(this, render_view_host_->page_id_, title, | 982 delegate_->UpdateTitle(this, page_id, title, |
| 1005 WebTextDirectionToChromeTextDirection( | 983 WebTextDirectionToChromeTextDirection( |
| 1006 title_direction)); | 984 title_direction)); |
| 1007 } | 985 } |
| 1008 | 986 |
| 1009 void RenderFrameHostImpl::OnUpdateEncoding(const std::string& encoding_name) { | 987 void RenderFrameHostImpl::OnUpdateEncoding(const std::string& encoding_name) { |
| 1010 // This message is only sent for top-level frames. TODO(avi): when frame tree | 988 // This message is only sent for top-level frames. TODO(avi): when frame tree |
| 1011 // mirroring works correctly, add a check here to enforce it. | 989 // mirroring works correctly, add a check here to enforce it. |
| 1012 delegate_->UpdateEncoding(this, encoding_name); | 990 delegate_->UpdateEncoding(this, encoding_name); |
| 1013 } | 991 } |
| 1014 | 992 |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1433 // Clear any state if a pending navigation is canceled or preempted. | 1411 // Clear any state if a pending navigation is canceled or preempted. |
| 1434 if (suspended_nav_params_) | 1412 if (suspended_nav_params_) |
| 1435 suspended_nav_params_.reset(); | 1413 suspended_nav_params_.reset(); |
| 1436 | 1414 |
| 1437 TRACE_EVENT_ASYNC_END0("navigation", | 1415 TRACE_EVENT_ASYNC_END0("navigation", |
| 1438 "RenderFrameHostImpl navigation suspended", this); | 1416 "RenderFrameHostImpl navigation suspended", this); |
| 1439 navigations_suspended_ = false; | 1417 navigations_suspended_ = false; |
| 1440 } | 1418 } |
| 1441 | 1419 |
| 1442 } // namespace content | 1420 } // namespace content |
| OLD | NEW |