Chromium Code Reviews| 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/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 2115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2126 int64 parent_frame_id, | 2126 int64 parent_frame_id, |
| 2127 bool is_main_frame, | 2127 bool is_main_frame, |
| 2128 const GURL& url) { | 2128 const GURL& url) { |
| 2129 bool is_error_page = (url.spec() == kUnreachableWebDataURL); | 2129 bool is_error_page = (url.spec() == kUnreachableWebDataURL); |
| 2130 bool is_iframe_srcdoc = (url.spec() == kAboutSrcDocURL); | 2130 bool is_iframe_srcdoc = (url.spec() == kAboutSrcDocURL); |
| 2131 GURL validated_url(url); | 2131 GURL validated_url(url); |
| 2132 RenderProcessHost* render_process_host = | 2132 RenderProcessHost* render_process_host = |
| 2133 render_view_host->GetProcess(); | 2133 render_view_host->GetProcess(); |
| 2134 RenderViewHost::FilterURL(render_process_host, false, &validated_url); | 2134 RenderViewHost::FilterURL(render_process_host, false, &validated_url); |
| 2135 | 2135 |
| 2136 if (is_main_frame) | 2136 if (is_main_frame) { |
| 2137 DidChangeLoadProgress(0); | 2137 DidChangeLoadProgress(0); |
| 2138 | 2138 |
| 2139 // Create a pending entry for this provisional load (if none exists) using the | 2139 // If there is no browser-initiated pending entry for this navigation and it |
| 2140 // current SiteInstance, and ensure the address bar updates accordingly. | 2140 // is not for the error URL, create a pending entry using the current |
| 2141 // We don't know the referrer or extra headers at this point, but the referrer | 2141 // SiteInstance, and ensure the address bar updates accordingly. We don't |
| 2142 // will be set properly upon commit. | 2142 // know the referrer or extra headers at this point, but the referrer will |
| 2143 if (is_main_frame && !controller_.GetPendingEntry()) { | 2143 // be set properly upon commit. |
| 2144 NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry( | 2144 NavigationEntry* pending_entry = controller_.GetPendingEntry(); |
| 2145 controller_.CreateNavigationEntry(validated_url, | 2145 bool has_browser_initiated_pending_entry = pending_entry && |
| 2146 content::Referrer(), | 2146 !NavigationEntryImpl::FromNavigationEntry(pending_entry)-> |
| 2147 content::PAGE_TRANSITION_LINK, | 2147 is_renderer_initiated(); |
| 2148 true /* is_renderer_initiated */, | 2148 if (!has_browser_initiated_pending_entry && !is_error_page) { |
|
Charlie Reis
2013/08/07 21:34:58
The fix was to check for !is_error_page here, sinc
| |
| 2149 std::string(), GetBrowserContext())); | 2149 NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry( |
| 2150 entry->set_site_instance( | 2150 controller_.CreateNavigationEntry(validated_url, |
| 2151 static_cast<SiteInstanceImpl*>(GetSiteInstance())); | 2151 content::Referrer(), |
| 2152 controller_.SetPendingEntry(entry); | 2152 content::PAGE_TRANSITION_LINK, |
| 2153 NotifyNavigationStateChanged(content::INVALIDATE_TYPE_URL); | 2153 true /* is_renderer_initiated */, |
| 2154 std::string(), | |
| 2155 GetBrowserContext())); | |
| 2156 entry->set_site_instance( | |
| 2157 static_cast<SiteInstanceImpl*>(GetSiteInstance())); | |
| 2158 controller_.SetPendingEntry(entry); | |
| 2159 NotifyNavigationStateChanged(content::INVALIDATE_TYPE_URL); | |
| 2160 } | |
| 2154 } | 2161 } |
| 2155 | 2162 |
| 2156 // Notify observers about the start of the provisional load. | 2163 // Notify observers about the start of the provisional load. |
| 2157 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 2164 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 2158 DidStartProvisionalLoadForFrame(frame_id, parent_frame_id, | 2165 DidStartProvisionalLoadForFrame(frame_id, parent_frame_id, |
| 2159 is_main_frame, validated_url, is_error_page, | 2166 is_main_frame, validated_url, is_error_page, |
| 2160 is_iframe_srcdoc, render_view_host)); | 2167 is_iframe_srcdoc, render_view_host)); |
| 2161 | 2168 |
| 2162 if (is_main_frame) { | 2169 if (is_main_frame) { |
| 2163 // Notify observers about the provisional change in the main frame URL. | 2170 // Notify observers about the provisional change in the main frame URL. |
| (...skipping 1547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3711 } | 3718 } |
| 3712 | 3719 |
| 3713 void WebContentsImpl::ClearAllPowerSaveBlockers() { | 3720 void WebContentsImpl::ClearAllPowerSaveBlockers() { |
| 3714 for (PowerSaveBlockerMap::iterator i(power_save_blockers_.begin()); | 3721 for (PowerSaveBlockerMap::iterator i(power_save_blockers_.begin()); |
| 3715 i != power_save_blockers_.end(); ++i) | 3722 i != power_save_blockers_.end(); ++i) |
| 3716 STLDeleteValues(&power_save_blockers_[i->first]); | 3723 STLDeleteValues(&power_save_blockers_[i->first]); |
| 3717 power_save_blockers_.clear(); | 3724 power_save_blockers_.clear(); |
| 3718 } | 3725 } |
| 3719 | 3726 |
| 3720 } // namespace content | 3727 } // namespace content |
| OLD | NEW |