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 2008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2019 void WebContentsImpl::DidStartProvisionalLoad( | 2019 void WebContentsImpl::DidStartProvisionalLoad( |
| 2020 RenderFrameHostImpl* render_frame_host, | 2020 RenderFrameHostImpl* render_frame_host, |
| 2021 int parent_routing_id, | 2021 int parent_routing_id, |
| 2022 bool is_main_frame, | 2022 bool is_main_frame, |
| 2023 const GURL& validated_url, | 2023 const GURL& validated_url, |
| 2024 bool is_error_page, | 2024 bool is_error_page, |
| 2025 bool is_iframe_srcdoc) { | 2025 bool is_iframe_srcdoc) { |
| 2026 if (is_main_frame) | 2026 if (is_main_frame) |
| 2027 DidChangeLoadProgress(0); | 2027 DidChangeLoadProgress(0); |
| 2028 | 2028 |
| 2029 // --site-per-process mode has a short-term hack allowing cross-process | |
| 2030 // subframe pages to commit thinking they are top-level. Correct it here to | |
| 2031 // avoid confusing the observers. | |
|
nasko
2014/03/06 04:59:52
Do we need this for each observer method? Or do yo
Charlie Reis
2014/03/06 06:59:50
I'm just adding it on demand to satisfy the Web Na
| |
| 2032 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSitePerProcess) && | |
| 2033 render_frame_host != GetMainFrame()) { | |
| 2034 is_main_frame = false; | |
| 2035 } | |
| 2036 | |
| 2029 // Notify observers about the start of the provisional load. | 2037 // Notify observers about the start of the provisional load. |
| 2030 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 2038 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 2031 DidStartProvisionalLoadForFrame( | 2039 DidStartProvisionalLoadForFrame( |
| 2032 render_frame_host->GetRoutingID(), parent_routing_id, | 2040 render_frame_host->GetRoutingID(), parent_routing_id, |
| 2033 is_main_frame, validated_url, is_error_page, | 2041 is_main_frame, validated_url, is_error_page, |
| 2034 is_iframe_srcdoc, | 2042 is_iframe_srcdoc, |
| 2035 render_frame_host->render_view_host())); | 2043 render_frame_host->render_view_host())); |
| 2036 | 2044 |
| 2037 if (is_main_frame) { | 2045 if (is_main_frame) { |
| 2038 FOR_EACH_OBSERVER( | 2046 FOR_EACH_OBSERVER( |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2090 RenderFrameHostImpl* render_frame_host, | 2098 RenderFrameHostImpl* render_frame_host, |
| 2091 const GURL& url, | 2099 const GURL& url, |
| 2092 NavigationController::ReloadType reload_type) { | 2100 NavigationController::ReloadType reload_type) { |
| 2093 // Notify observers about navigation. | 2101 // Notify observers about navigation. |
| 2094 FOR_EACH_OBSERVER( | 2102 FOR_EACH_OBSERVER( |
| 2095 WebContentsObserver, | 2103 WebContentsObserver, |
| 2096 observers_, | 2104 observers_, |
| 2097 DidStartNavigationToPendingEntry(url, reload_type)); | 2105 DidStartNavigationToPendingEntry(url, reload_type)); |
| 2098 } | 2106 } |
| 2099 | 2107 |
| 2100 void WebContentsImpl::RequestOpenURL(const OpenURLParams& params) { | 2108 void WebContentsImpl::RequestOpenURL(RenderFrameHostImpl* render_frame_host, |
| 2109 const OpenURLParams& params) { | |
| 2110 int source_render_frame_id = render_frame_host->GetRoutingID(); | |
| 2101 WebContents* new_contents = OpenURL(params); | 2111 WebContents* new_contents = OpenURL(params); |
| 2102 | 2112 |
| 2103 if (new_contents) { | 2113 if (new_contents) { |
| 2104 // Notify observers. | 2114 // Notify observers. |
| 2105 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 2115 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 2106 DidOpenRequestedURL(new_contents, | 2116 DidOpenRequestedURL(new_contents, |
| 2107 params.url, | 2117 params.url, |
| 2108 params.referrer, | 2118 params.referrer, |
| 2109 params.disposition, | 2119 params.disposition, |
| 2110 params.transition, | 2120 params.transition, |
| 2111 params.source_frame_id)); | 2121 source_render_frame_id)); |
| 2112 } | 2122 } |
| 2113 } | 2123 } |
| 2114 | 2124 |
| 2115 void WebContentsImpl::DidRedirectProvisionalLoad( | 2125 void WebContentsImpl::DidRedirectProvisionalLoad( |
| 2116 RenderFrameHostImpl* render_frame_host, | 2126 RenderFrameHostImpl* render_frame_host, |
| 2117 const GURL& validated_target_url) { | 2127 const GURL& validated_target_url) { |
| 2118 // Notify observers about the provisional change in the main frame URL. | 2128 // Notify observers about the provisional change in the main frame URL. |
| 2119 FOR_EACH_OBSERVER( | 2129 FOR_EACH_OBSERVER( |
| 2120 WebContentsObserver, | 2130 WebContentsObserver, |
| 2121 observers_, | 2131 observers_, |
| (...skipping 1473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3595 | 3605 |
| 3596 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { | 3606 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { |
| 3597 if (!delegate_) | 3607 if (!delegate_) |
| 3598 return; | 3608 return; |
| 3599 const gfx::Size new_size = GetPreferredSize(); | 3609 const gfx::Size new_size = GetPreferredSize(); |
| 3600 if (new_size != old_size) | 3610 if (new_size != old_size) |
| 3601 delegate_->UpdatePreferredSize(this, new_size); | 3611 delegate_->UpdatePreferredSize(this, new_size); |
| 3602 } | 3612 } |
| 3603 | 3613 |
| 3604 } // namespace content | 3614 } // namespace content |
| OLD | NEW |