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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 450 IPC_MESSAGE_HANDLER(FrameHostMsg_DomOperationResponse, | 450 IPC_MESSAGE_HANDLER(FrameHostMsg_DomOperationResponse, |
| 451 OnDomOperationResponse) | 451 OnDomOperationResponse) |
| 452 IPC_MESSAGE_HANDLER(ViewHostMsg_DidLoadResourceFromMemoryCache, | 452 IPC_MESSAGE_HANDLER(ViewHostMsg_DidLoadResourceFromMemoryCache, |
| 453 OnDidLoadResourceFromMemoryCache) | 453 OnDidLoadResourceFromMemoryCache) |
| 454 IPC_MESSAGE_HANDLER(ViewHostMsg_DidDisplayInsecureContent, | 454 IPC_MESSAGE_HANDLER(ViewHostMsg_DidDisplayInsecureContent, |
| 455 OnDidDisplayInsecureContent) | 455 OnDidDisplayInsecureContent) |
| 456 IPC_MESSAGE_HANDLER(ViewHostMsg_DidRunInsecureContent, | 456 IPC_MESSAGE_HANDLER(ViewHostMsg_DidRunInsecureContent, |
| 457 OnDidRunInsecureContent) | 457 OnDidRunInsecureContent) |
| 458 IPC_MESSAGE_HANDLER(FrameHostMsg_DidFinishDocumentLoad, | 458 IPC_MESSAGE_HANDLER(FrameHostMsg_DidFinishDocumentLoad, |
| 459 OnDocumentLoadedInFrame) | 459 OnDocumentLoadedInFrame) |
| 460 IPC_MESSAGE_HANDLER(ViewHostMsg_DidFinishLoad, OnDidFinishLoad) | 460 IPC_MESSAGE_HANDLER(FrameHostMsg_DidFinishLoad, OnDidFinishLoad) |
| 461 IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset, OnGoToEntryAtOffset) | 461 IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset, OnGoToEntryAtOffset) |
| 462 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateZoomLimits, OnUpdateZoomLimits) | 462 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateZoomLimits, OnUpdateZoomLimits) |
| 463 IPC_MESSAGE_HANDLER(ViewHostMsg_EnumerateDirectory, OnEnumerateDirectory) | 463 IPC_MESSAGE_HANDLER(ViewHostMsg_EnumerateDirectory, OnEnumerateDirectory) |
| 464 IPC_MESSAGE_HANDLER(ViewHostMsg_JSOutOfMemory, OnJSOutOfMemory) | 464 IPC_MESSAGE_HANDLER(ViewHostMsg_JSOutOfMemory, OnJSOutOfMemory) |
| 465 IPC_MESSAGE_HANDLER(ViewHostMsg_RegisterProtocolHandler, | 465 IPC_MESSAGE_HANDLER(ViewHostMsg_RegisterProtocolHandler, |
| 466 OnRegisterProtocolHandler) | 466 OnRegisterProtocolHandler) |
| 467 IPC_MESSAGE_HANDLER(ViewHostMsg_Find_Reply, OnFindReply) | 467 IPC_MESSAGE_HANDLER(ViewHostMsg_Find_Reply, OnFindReply) |
| 468 IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed) | 468 IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed) |
| 469 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenColorChooser, OnOpenColorChooser) | 469 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenColorChooser, OnOpenColorChooser) |
| 470 IPC_MESSAGE_HANDLER(ViewHostMsg_EndColorChooser, OnEndColorChooser) | 470 IPC_MESSAGE_HANDLER(ViewHostMsg_EndColorChooser, OnEndColorChooser) |
| (...skipping 1773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2244 RenderFrameHostImpl* rfh = | 2244 RenderFrameHostImpl* rfh = |
| 2245 static_cast<RenderFrameHostImpl*>(render_frame_message_source_); | 2245 static_cast<RenderFrameHostImpl*>(render_frame_message_source_); |
| 2246 | 2246 |
| 2247 FOR_EACH_OBSERVER(WebContentsObserver, | 2247 FOR_EACH_OBSERVER(WebContentsObserver, |
| 2248 observers_, | 2248 observers_, |
| 2249 DocumentLoadedInFrame(rfh->GetRoutingID(), | 2249 DocumentLoadedInFrame(rfh->GetRoutingID(), |
| 2250 rfh->render_view_host())); | 2250 rfh->render_view_host())); |
| 2251 } | 2251 } |
| 2252 | 2252 |
| 2253 void WebContentsImpl::OnDidFinishLoad( | 2253 void WebContentsImpl::OnDidFinishLoad( |
| 2254 int64 frame_id, | |
| 2255 const GURL& url, | 2254 const GURL& url, |
| 2256 bool is_main_frame) { | 2255 bool is_main_frame) { |
| 2257 if (!render_view_message_source_) { | 2256 if (!render_frame_message_source_) { |
| 2258 RecordAction(base::UserMetricsAction("BadMessageTerminate_RVD2")); | 2257 RecordAction(base::UserMetricsAction("BadMessageTerminate_RVD2")); |
| 2259 GetRenderProcessHost()->ReceivedBadMessage(); | 2258 GetRenderProcessHost()->ReceivedBadMessage(); |
| 2260 return; | 2259 return; |
| 2261 } | 2260 } |
| 2262 | 2261 |
| 2262 RenderFrameHostImpl* rfh = | |
| 2263 static_cast<RenderFrameHostImpl*>(render_frame_message_source_); | |
| 2264 | |
| 2263 // --site-per-process mode has a short-term hack allowing cross-process | 2265 // --site-per-process mode has a short-term hack allowing cross-process |
| 2264 // subframe pages to commit thinking they are top-level. Correct it here to | 2266 // subframe pages to commit thinking they are top-level. Correct it here to |
| 2265 // avoid confusing the observers. | 2267 // avoid confusing the observers. |
| 2266 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSitePerProcess) && | 2268 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSitePerProcess) && |
| 2267 render_view_message_source_ != GetRenderViewHost()) | 2269 rfh->render_view_host() != GetRenderViewHost()) { |
|
Charlie Reis
2014/03/05 18:50:26
Can we use rfh != GetMainFrame() here?
(Side note
nasko
2014/03/05 19:00:46
Yes, we can. Fixed.
On the style: since we have 3
| |
| 2268 is_main_frame = false; | 2270 is_main_frame = false; |
| 2271 } | |
| 2269 | 2272 |
| 2270 GURL validated_url(url); | 2273 GURL validated_url(url); |
| 2271 RenderProcessHost* render_process_host = | 2274 RenderProcessHost* render_process_host = |
| 2272 render_view_message_source_->GetProcess(); | 2275 render_frame_message_source_->GetProcess(); |
| 2273 render_process_host->FilterURL(false, &validated_url); | 2276 render_process_host->FilterURL(false, &validated_url); |
| 2277 | |
| 2274 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 2278 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 2275 DidFinishLoad(frame_id, validated_url, is_main_frame, | 2279 DidFinishLoad(rfh->GetRoutingID(), validated_url, |
| 2276 render_view_message_source_)); | 2280 is_main_frame, rfh->render_view_host())); |
| 2277 } | 2281 } |
| 2278 | 2282 |
| 2279 void WebContentsImpl::OnGoToEntryAtOffset(int offset) { | 2283 void WebContentsImpl::OnGoToEntryAtOffset(int offset) { |
| 2280 if (!delegate_ || delegate_->OnGoToEntryOffset(offset)) | 2284 if (!delegate_ || delegate_->OnGoToEntryOffset(offset)) |
| 2281 controller_.GoToOffset(offset); | 2285 controller_.GoToOffset(offset); |
| 2282 } | 2286 } |
| 2283 | 2287 |
| 2284 void WebContentsImpl::OnUpdateZoomLimits(int minimum_percent, | 2288 void WebContentsImpl::OnUpdateZoomLimits(int minimum_percent, |
| 2285 int maximum_percent, | 2289 int maximum_percent, |
| 2286 bool remember) { | 2290 bool remember) { |
| (...skipping 1356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3643 | 3647 |
| 3644 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { | 3648 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { |
| 3645 if (!delegate_) | 3649 if (!delegate_) |
| 3646 return; | 3650 return; |
| 3647 const gfx::Size new_size = GetPreferredSize(); | 3651 const gfx::Size new_size = GetPreferredSize(); |
| 3648 if (new_size != old_size) | 3652 if (new_size != old_size) |
| 3649 delegate_->UpdatePreferredSize(this, new_size); | 3653 delegate_->UpdatePreferredSize(this, new_size); |
| 3650 } | 3654 } |
| 3651 | 3655 |
| 3652 } // namespace content | 3656 } // namespace content |
| OLD | NEW |