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/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 559 | 559 |
| 560 bool handled = true; | 560 bool handled = true; |
| 561 bool message_is_ok = true; | 561 bool message_is_ok = true; |
| 562 IPC_BEGIN_MESSAGE_MAP_EX(WebContentsImpl, message, message_is_ok) | 562 IPC_BEGIN_MESSAGE_MAP_EX(WebContentsImpl, message, message_is_ok) |
| 563 IPC_MESSAGE_HANDLER(IntentsHostMsg_RegisterIntentService, | 563 IPC_MESSAGE_HANDLER(IntentsHostMsg_RegisterIntentService, |
| 564 OnRegisterIntentService) | 564 OnRegisterIntentService) |
| 565 IPC_MESSAGE_HANDLER(IntentsHostMsg_WebIntentDispatch, | 565 IPC_MESSAGE_HANDLER(IntentsHostMsg_WebIntentDispatch, |
| 566 OnWebIntentDispatch) | 566 OnWebIntentDispatch) |
| 567 IPC_MESSAGE_HANDLER(ViewHostMsg_DidStartProvisionalLoadForFrame, | 567 IPC_MESSAGE_HANDLER(ViewHostMsg_DidStartProvisionalLoadForFrame, |
| 568 OnDidStartProvisionalLoadForFrame) | 568 OnDidStartProvisionalLoadForFrame) |
| 569 IPC_MESSAGE_HANDLER(ViewHostMsg_DidRedirectProvisionalLoad, | |
| 570 OnDidRedirectProvisionalLoad) | |
| 571 IPC_MESSAGE_HANDLER(ViewHostMsg_DidFailProvisionalLoadWithError, | 569 IPC_MESSAGE_HANDLER(ViewHostMsg_DidFailProvisionalLoadWithError, |
| 572 OnDidFailProvisionalLoadWithError) | 570 OnDidFailProvisionalLoadWithError) |
| 573 IPC_MESSAGE_HANDLER(ViewHostMsg_DidLoadResourceFromMemoryCache, | 571 IPC_MESSAGE_HANDLER(ViewHostMsg_DidLoadResourceFromMemoryCache, |
| 574 OnDidLoadResourceFromMemoryCache) | 572 OnDidLoadResourceFromMemoryCache) |
| 575 IPC_MESSAGE_HANDLER(ViewHostMsg_DidDisplayInsecureContent, | 573 IPC_MESSAGE_HANDLER(ViewHostMsg_DidDisplayInsecureContent, |
| 576 OnDidDisplayInsecureContent) | 574 OnDidDisplayInsecureContent) |
| 577 IPC_MESSAGE_HANDLER(ViewHostMsg_DidRunInsecureContent, | 575 IPC_MESSAGE_HANDLER(ViewHostMsg_DidRunInsecureContent, |
| 578 OnDidRunInsecureContent) | 576 OnDidRunInsecureContent) |
| 579 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentLoadedInFrame, | 577 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentLoadedInFrame, |
| 580 OnDocumentLoadedInFrame) | 578 OnDocumentLoadedInFrame) |
| (...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1511 validated_url, is_error_page, rvh)); | 1509 validated_url, is_error_page, rvh)); |
| 1512 | 1510 |
| 1513 if (is_main_frame) { | 1511 if (is_main_frame) { |
| 1514 // Notify observers about the provisional change in the main frame URL. | 1512 // Notify observers about the provisional change in the main frame URL. |
| 1515 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 1513 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 1516 ProvisionalChangeToMainFrameUrl(validated_url, | 1514 ProvisionalChangeToMainFrameUrl(validated_url, |
| 1517 validated_opener_url)); | 1515 validated_opener_url)); |
| 1518 } | 1516 } |
| 1519 } | 1517 } |
| 1520 | 1518 |
| 1521 void WebContentsImpl::OnDidRedirectProvisionalLoad(int32 page_id, | |
| 1522 const GURL& opener_url, | |
| 1523 const GURL& source_url, | |
| 1524 const GURL& target_url) { | |
| 1525 // TODO(creis): Remove this method and have the pre-rendering code listen to | |
| 1526 // the ResourceDispatcherHost's RESOURCE_RECEIVED_REDIRECT notification | |
| 1527 // instead. See http://crbug.com/78512. | |
| 1528 GURL validated_source_url(source_url); | |
| 1529 GURL validated_target_url(target_url); | |
| 1530 GURL validated_opener_url(opener_url); | |
| 1531 GetRenderViewHostImpl()->FilterURL( | |
| 1532 ChildProcessSecurityPolicyImpl::GetInstance(), | |
| 1533 GetRenderProcessHost()->GetID(), | |
| 1534 false, | |
| 1535 &validated_source_url); | |
| 1536 GetRenderViewHostImpl()->FilterURL( | |
| 1537 ChildProcessSecurityPolicyImpl::GetInstance(), | |
| 1538 GetRenderProcessHost()->GetID(), | |
| 1539 false, | |
| 1540 &validated_target_url); | |
| 1541 GetRenderViewHostImpl()->FilterURL( | |
| 1542 ChildProcessSecurityPolicyImpl::GetInstance(), | |
| 1543 GetRenderProcessHost()->GetID(), | |
| 1544 true, | |
| 1545 &validated_opener_url); | |
| 1546 NavigationEntry* entry; | |
| 1547 if (page_id == -1) | |
| 1548 entry = controller_.GetPendingEntry(); | |
| 1549 else | |
| 1550 entry = controller_.GetEntryWithPageID(GetSiteInstance(), page_id); | |
| 1551 if (!entry || entry->GetURL() != validated_source_url) | |
| 1552 return; | |
| 1553 | |
| 1554 // Notify observers about the provisional change in the main frame URL. | |
| 1555 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | |
| 1556 ProvisionalChangeToMainFrameUrl(validated_target_url, | |
|
cbentzel
2012/05/08 04:29:09
You should remove ProvisionalChangeToMainFrameUrl
| |
| 1557 validated_opener_url)); | |
| 1558 } | |
| 1559 | |
| 1560 void WebContentsImpl::OnDidFailProvisionalLoadWithError( | 1519 void WebContentsImpl::OnDidFailProvisionalLoadWithError( |
| 1561 const ViewHostMsg_DidFailProvisionalLoadWithError_Params& params) { | 1520 const ViewHostMsg_DidFailProvisionalLoadWithError_Params& params) { |
| 1562 VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec() | 1521 VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec() |
| 1563 << ", error_code: " << params.error_code | 1522 << ", error_code: " << params.error_code |
| 1564 << ", error_description: " << params.error_description | 1523 << ", error_description: " << params.error_description |
| 1565 << ", is_main_frame: " << params.is_main_frame | 1524 << ", is_main_frame: " << params.is_main_frame |
| 1566 << ", showing_repost_interstitial: " << | 1525 << ", showing_repost_interstitial: " << |
| 1567 params.showing_repost_interstitial | 1526 params.showing_repost_interstitial |
| 1568 << ", frame_id: " << params.frame_id; | 1527 << ", frame_id: " << params.frame_id; |
| 1569 GURL validated_url(params.url); | 1528 GURL validated_url(params.url); |
| (...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2697 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 2656 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
| 2698 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); | 2657 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); |
| 2699 // Can be NULL during tests. | 2658 // Can be NULL during tests. |
| 2700 if (rwh_view) | 2659 if (rwh_view) |
| 2701 rwh_view->SetSize(GetView()->GetContainerSize()); | 2660 rwh_view->SetSize(GetView()->GetContainerSize()); |
| 2702 } | 2661 } |
| 2703 | 2662 |
| 2704 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() { | 2663 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() { |
| 2705 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); | 2664 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); |
| 2706 } | 2665 } |
| OLD | NEW |