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, |
2140 // current SiteInstance, and ensure the address bar updates accordingly. | 2140 // create one using the current SiteInstance, and ensure the address bar |
2141 // We don't know the referrer or extra headers at this point, but the referrer | 2141 // updates accordingly. We don't know the referrer or extra headers at this |
2142 // will be set properly upon commit. | 2142 // point, but the referrer will be set properly upon commit. |
2143 if (is_main_frame && !controller_.GetPendingEntry()) { | 2143 NavigationEntry* pending_entry = controller_.GetPendingEntry(); |
2144 NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry( | 2144 bool has_browser_initiated_pending_entry = pending_entry && |
2145 controller_.CreateNavigationEntry(validated_url, | 2145 !NavigationEntryImpl::FromNavigationEntry(pending_entry)-> |
2146 content::Referrer(), | 2146 is_renderer_initiated(); |
2147 content::PAGE_TRANSITION_LINK, | 2147 if (!has_browser_initiated_pending_entry) { |
2148 true /* is_renderer_initiated */, | 2148 NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry( |
2149 std::string(), GetBrowserContext())); | 2149 controller_.CreateNavigationEntry(validated_url, |
2150 entry->set_site_instance( | 2150 content::Referrer(), |
2151 static_cast<SiteInstanceImpl*>(GetSiteInstance())); | 2151 content::PAGE_TRANSITION_LINK, |
2152 controller_.SetPendingEntry(entry); | 2152 true /* is_renderer_initiated */, |
2153 NotifyNavigationStateChanged(content::INVALIDATE_TYPE_URL); | 2153 std::string(), |
| 2154 GetBrowserContext())); |
| 2155 entry->set_site_instance( |
| 2156 static_cast<SiteInstanceImpl*>(GetSiteInstance())); |
| 2157 controller_.SetPendingEntry(entry); |
| 2158 NotifyNavigationStateChanged(content::INVALIDATE_TYPE_URL); |
| 2159 } |
2154 } | 2160 } |
2155 | 2161 |
2156 // Notify observers about the start of the provisional load. | 2162 // Notify observers about the start of the provisional load. |
2157 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 2163 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
2158 DidStartProvisionalLoadForFrame(frame_id, parent_frame_id, | 2164 DidStartProvisionalLoadForFrame(frame_id, parent_frame_id, |
2159 is_main_frame, validated_url, is_error_page, | 2165 is_main_frame, validated_url, is_error_page, |
2160 is_iframe_srcdoc, render_view_host)); | 2166 is_iframe_srcdoc, render_view_host)); |
2161 | 2167 |
2162 if (is_main_frame) { | 2168 if (is_main_frame) { |
2163 // Notify observers about the provisional change in the main frame URL. | 2169 // 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 } | 3717 } |
3712 | 3718 |
3713 void WebContentsImpl::ClearAllPowerSaveBlockers() { | 3719 void WebContentsImpl::ClearAllPowerSaveBlockers() { |
3714 for (PowerSaveBlockerMap::iterator i(power_save_blockers_.begin()); | 3720 for (PowerSaveBlockerMap::iterator i(power_save_blockers_.begin()); |
3715 i != power_save_blockers_.end(); ++i) | 3721 i != power_save_blockers_.end(); ++i) |
3716 STLDeleteValues(&power_save_blockers_[i->first]); | 3722 STLDeleteValues(&power_save_blockers_[i->first]); |
3717 power_save_blockers_.clear(); | 3723 power_save_blockers_.clear(); |
3718 } | 3724 } |
3719 | 3725 |
3720 } // namespace content | 3726 } // namespace content |
OLD | NEW |