| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/crash_logging.h" |
| 10 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
| 11 #include "base/location.h" | 12 #include "base/location.h" |
| 12 #include "base/logging.h" | 13 #include "base/logging.h" |
| 13 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
| 14 #include "base/process/process.h" | 15 #include "base/process/process.h" |
| 15 #include "base/profiler/scoped_tracker.h" | 16 #include "base/profiler/scoped_tracker.h" |
| 16 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
| 17 #include "base/strings/string16.h" | 18 #include "base/strings/string16.h" |
| 18 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
| 19 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
| (...skipping 3855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3875 // the next page. The navigation controller will look up the appropriate | 3876 // the next page. The navigation controller will look up the appropriate |
| 3876 // NavigationEntry and update it when it is notified via the delegate. | 3877 // NavigationEntry and update it when it is notified via the delegate. |
| 3877 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>(rvh); | 3878 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>(rvh); |
| 3878 NavigationEntryImpl* entry = controller_.GetEntryWithPageID( | 3879 NavigationEntryImpl* entry = controller_.GetEntryWithPageID( |
| 3879 rvhi->GetSiteInstance(), page_id); | 3880 rvhi->GetSiteInstance(), page_id); |
| 3880 if (!entry) | 3881 if (!entry) |
| 3881 return; | 3882 return; |
| 3882 | 3883 |
| 3883 NavigationEntryImpl* new_entry = controller_.GetEntryWithUniqueID( | 3884 NavigationEntryImpl* new_entry = controller_.GetEntryWithUniqueID( |
| 3884 rvhi->nav_entry_id()); | 3885 rvhi->nav_entry_id()); |
| 3886 CHECK(new_entry); |
| 3885 | 3887 |
| 3886 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) { | 3888 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) { |
| 3887 // TODO(creis): We can't properly update state for cross-process subframes | 3889 // TODO(creis): We can't properly update state for cross-process subframes |
| 3888 // until PageState is decomposed into FrameStates. Until then, use the new | 3890 // until PageState is decomposed into FrameStates. Until then, use the new |
| 3889 // method. | 3891 // method. |
| 3890 entry = new_entry; | 3892 entry = new_entry; |
| 3891 } else { | 3893 } else { |
| 3892 DCHECK_EQ(entry, new_entry); | 3894 base::debug::SetCrashKeyValue("pageid", base::IntToString(page_id)); |
| 3895 base::debug::SetCrashKeyValue("navuniqueid", |
| 3896 base::IntToString(rvhi->nav_entry_id())); |
| 3897 base::debug::SetCrashKeyValue( |
| 3898 "oldindex", base::IntToString(controller_.GetIndexOfEntry(entry))); |
| 3899 base::debug::SetCrashKeyValue( |
| 3900 "newindex", base::IntToString(controller_.GetIndexOfEntry(new_entry))); |
| 3901 base::debug::SetCrashKeyValue( |
| 3902 "lastcommittedindex", |
| 3903 base::IntToString(controller_.GetLastCommittedEntryIndex())); |
| 3904 base::debug::SetCrashKeyValue("oldurl", entry->GetURL().spec()); |
| 3905 base::debug::SetCrashKeyValue("newurl", new_entry->GetURL().spec()); |
| 3906 base::debug::SetCrashKeyValue( |
| 3907 "updatedvalue", page_state.GetTopLevelUrlStringTemporaryForBug369661()); |
| 3908 base::debug::SetCrashKeyValue("oldvalue", entry->GetURL().spec()); |
| 3909 base::debug::SetCrashKeyValue("newvalue", new_entry->GetURL().spec()); |
| 3910 CHECK_EQ(entry, new_entry); |
| 3893 } | 3911 } |
| 3894 | 3912 |
| 3895 if (page_state == entry->GetPageState()) | 3913 if (page_state == entry->GetPageState()) |
| 3896 return; // Nothing to update. | 3914 return; // Nothing to update. |
| 3897 entry->SetPageState(page_state); | 3915 entry->SetPageState(page_state); |
| 3898 controller_.NotifyEntryChanged(entry); | 3916 controller_.NotifyEntryChanged(entry); |
| 3899 } | 3917 } |
| 3900 | 3918 |
| 3901 void WebContentsImpl::UpdateTargetURL(RenderViewHost* render_view_host, | 3919 void WebContentsImpl::UpdateTargetURL(RenderViewHost* render_view_host, |
| 3902 const GURL& url) { | 3920 const GURL& url) { |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4062 | 4080 |
| 4063 // Try to find the navigation entry, which might not be the current one. | 4081 // Try to find the navigation entry, which might not be the current one. |
| 4064 // For example, it might be from a recently swapped out RFH. | 4082 // For example, it might be from a recently swapped out RFH. |
| 4065 NavigationEntryImpl* entry = controller_.GetEntryWithPageID( | 4083 NavigationEntryImpl* entry = controller_.GetEntryWithPageID( |
| 4066 render_frame_host->GetSiteInstance(), page_id); | 4084 render_frame_host->GetSiteInstance(), page_id); |
| 4067 | 4085 |
| 4068 RenderViewHostImpl* rvhi = | 4086 RenderViewHostImpl* rvhi = |
| 4069 static_cast<RenderViewHostImpl*>(render_frame_host->GetRenderViewHost()); | 4087 static_cast<RenderViewHostImpl*>(render_frame_host->GetRenderViewHost()); |
| 4070 NavigationEntryImpl* new_entry = controller_.GetEntryWithUniqueID( | 4088 NavigationEntryImpl* new_entry = controller_.GetEntryWithUniqueID( |
| 4071 rvhi->nav_entry_id()); | 4089 rvhi->nav_entry_id()); |
| 4072 DCHECK_EQ(entry, new_entry); | 4090 |
| 4091 base::debug::SetCrashKeyValue("pageid", base::IntToString(page_id)); |
| 4092 base::debug::SetCrashKeyValue("navuniqueid", |
| 4093 base::IntToString(rvhi->nav_entry_id())); |
| 4094 base::debug::SetCrashKeyValue( |
| 4095 "oldindex", base::IntToString(controller_.GetIndexOfEntry(entry))); |
| 4096 base::debug::SetCrashKeyValue( |
| 4097 "newindex", base::IntToString(controller_.GetIndexOfEntry(new_entry))); |
| 4098 base::debug::SetCrashKeyValue( |
| 4099 "lastcommittedindex", |
| 4100 base::IntToString(controller_.GetLastCommittedEntryIndex())); |
| 4101 base::debug::SetCrashKeyValue("oldurl", |
| 4102 entry ? entry->GetURL().spec() : "-nullptr-"); |
| 4103 base::debug::SetCrashKeyValue( |
| 4104 "newurl", new_entry ? new_entry->GetURL().spec() : "-nullptr-"); |
| 4105 base::debug::SetCrashKeyValue("updatedvalue", base::UTF16ToUTF8(title)); |
| 4106 base::debug::SetCrashKeyValue( |
| 4107 "oldvalue", entry ? base::UTF16ToUTF8(entry->GetTitle()) : "-nullptr-"); |
| 4108 base::debug::SetCrashKeyValue( |
| 4109 "newvalue", |
| 4110 new_entry ? base::UTF16ToUTF8(new_entry->GetTitle()) : "-nullptr-"); |
| 4111 CHECK_EQ(entry, new_entry); |
| 4073 | 4112 |
| 4074 // We can handle title updates when we don't have an entry in | 4113 // We can handle title updates when we don't have an entry in |
| 4075 // UpdateTitleForEntry, but only if the update is from the current RVH. | 4114 // UpdateTitleForEntry, but only if the update is from the current RVH. |
| 4076 // TODO(avi): Change to make decisions based on the RenderFrameHost. | 4115 // TODO(avi): Change to make decisions based on the RenderFrameHost. |
| 4077 if (!entry && render_frame_host != GetMainFrame()) | 4116 if (!entry && render_frame_host != GetMainFrame()) |
| 4078 return; | 4117 return; |
| 4079 | 4118 |
| 4080 // TODO(evan): make use of title_direction. | 4119 // TODO(evan): make use of title_direction. |
| 4081 // http://code.google.com/p/chromium/issues/detail?id=27094 | 4120 // http://code.google.com/p/chromium/issues/detail?id=27094 |
| 4082 if (!UpdateTitleForEntry(entry, title)) | 4121 if (!UpdateTitleForEntry(entry, title)) |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4608 player_map->erase(it); | 4647 player_map->erase(it); |
| 4609 } | 4648 } |
| 4610 | 4649 |
| 4611 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4650 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
| 4612 force_disable_overscroll_content_ = force_disable; | 4651 force_disable_overscroll_content_ = force_disable; |
| 4613 if (view_) | 4652 if (view_) |
| 4614 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4653 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
| 4615 } | 4654 } |
| 4616 | 4655 |
| 4617 } // namespace content | 4656 } // namespace content |
| OLD | NEW |