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 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 } | 501 } |
502 | 502 |
503 bool handled = true; | 503 bool handled = true; |
504 IPC_BEGIN_MESSAGE_MAP(WebContentsImpl, message) | 504 IPC_BEGIN_MESSAGE_MAP(WebContentsImpl, message) |
505 IPC_MESSAGE_HANDLER(FrameHostMsg_PepperPluginHung, OnPepperPluginHung) | 505 IPC_MESSAGE_HANDLER(FrameHostMsg_PepperPluginHung, OnPepperPluginHung) |
506 IPC_MESSAGE_HANDLER(FrameHostMsg_PluginCrashed, OnPluginCrashed) | 506 IPC_MESSAGE_HANDLER(FrameHostMsg_PluginCrashed, OnPluginCrashed) |
507 IPC_MESSAGE_HANDLER(FrameHostMsg_DomOperationResponse, | 507 IPC_MESSAGE_HANDLER(FrameHostMsg_DomOperationResponse, |
508 OnDomOperationResponse) | 508 OnDomOperationResponse) |
509 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeThemeColor, | 509 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeThemeColor, |
510 OnThemeColorChanged) | 510 OnThemeColorChanged) |
| 511 IPC_MESSAGE_HANDLER(FrameHostMsg_DidDetectXSS, OnDidDetectXSS) |
511 IPC_MESSAGE_HANDLER(FrameHostMsg_DidFinishDocumentLoad, | 512 IPC_MESSAGE_HANDLER(FrameHostMsg_DidFinishDocumentLoad, |
512 OnDocumentLoadedInFrame) | 513 OnDocumentLoadedInFrame) |
513 IPC_MESSAGE_HANDLER(FrameHostMsg_DidFinishLoad, OnDidFinishLoad) | 514 IPC_MESSAGE_HANDLER(FrameHostMsg_DidFinishLoad, OnDidFinishLoad) |
514 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStartLoading, OnDidStartLoading) | 515 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStartLoading, OnDidStartLoading) |
515 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStopLoading, OnDidStopLoading) | 516 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStopLoading, OnDidStopLoading) |
516 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeLoadProgress, | 517 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeLoadProgress, |
517 OnDidChangeLoadProgress) | 518 OnDidChangeLoadProgress) |
518 IPC_MESSAGE_HANDLER(FrameHostMsg_OpenColorChooser, OnOpenColorChooser) | 519 IPC_MESSAGE_HANDLER(FrameHostMsg_OpenColorChooser, OnOpenColorChooser) |
519 IPC_MESSAGE_HANDLER(FrameHostMsg_EndColorChooser, OnEndColorChooser) | 520 IPC_MESSAGE_HANDLER(FrameHostMsg_EndColorChooser, OnEndColorChooser) |
520 IPC_MESSAGE_HANDLER(FrameHostMsg_SetSelectedColorInColorChooser, | 521 IPC_MESSAGE_HANDLER(FrameHostMsg_SetSelectedColorInColorChooser, |
(...skipping 2048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2569 << target_url.possibly_invalid_spec(); | 2570 << target_url.possibly_invalid_spec(); |
2570 RecordAction(base::UserMetricsAction("SSL.RanInsecureContent")); | 2571 RecordAction(base::UserMetricsAction("SSL.RanInsecureContent")); |
2571 if (EndsWith(security_origin, kDotGoogleDotCom, false)) | 2572 if (EndsWith(security_origin, kDotGoogleDotCom, false)) |
2572 RecordAction(base::UserMetricsAction("SSL.RanInsecureContentGoogle")); | 2573 RecordAction(base::UserMetricsAction("SSL.RanInsecureContentGoogle")); |
2573 controller_.ssl_manager()->DidRunInsecureContent(security_origin); | 2574 controller_.ssl_manager()->DidRunInsecureContent(security_origin); |
2574 displayed_insecure_content_ = true; | 2575 displayed_insecure_content_ = true; |
2575 SSLManager::NotifySSLInternalStateChanged( | 2576 SSLManager::NotifySSLInternalStateChanged( |
2576 GetController().GetBrowserContext()); | 2577 GetController().GetBrowserContext()); |
2577 } | 2578 } |
2578 | 2579 |
| 2580 |
| 2581 void WebContentsImpl::OnDidDetectXSS(int32 page_id, |
| 2582 const GURL& url, |
| 2583 bool blocked_entire_page) { |
| 2584 if (!blocked_entire_page) |
| 2585 return; |
| 2586 |
| 2587 int entry_index = controller_.GetEntryIndexWithPageID( |
| 2588 GetRenderViewHost()->GetSiteInstance(), page_id); |
| 2589 if (entry_index < 0) |
| 2590 return; |
| 2591 |
| 2592 NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry( |
| 2593 controller_.GetEntryAtIndex(entry_index)); |
| 2594 if (!entry) |
| 2595 return; |
| 2596 |
| 2597 entry->set_xss_detected(true); |
| 2598 } |
| 2599 |
2579 void WebContentsImpl::OnDocumentLoadedInFrame() { | 2600 void WebContentsImpl::OnDocumentLoadedInFrame() { |
2580 CHECK(render_frame_message_source_); | 2601 CHECK(render_frame_message_source_); |
2581 CHECK(!render_view_message_source_); | 2602 CHECK(!render_view_message_source_); |
2582 RenderFrameHostImpl* rfh = | 2603 RenderFrameHostImpl* rfh = |
2583 static_cast<RenderFrameHostImpl*>(render_frame_message_source_); | 2604 static_cast<RenderFrameHostImpl*>(render_frame_message_source_); |
2584 FOR_EACH_OBSERVER( | 2605 FOR_EACH_OBSERVER( |
2585 WebContentsObserver, observers_, DocumentLoadedInFrame(rfh)); | 2606 WebContentsObserver, observers_, DocumentLoadedInFrame(rfh)); |
2586 } | 2607 } |
2587 | 2608 |
2588 void WebContentsImpl::OnDidFinishLoad( | 2609 void WebContentsImpl::OnDidFinishLoad( |
(...skipping 1511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4100 if (new_size != old_size) | 4121 if (new_size != old_size) |
4101 delegate_->UpdatePreferredSize(this, new_size); | 4122 delegate_->UpdatePreferredSize(this, new_size); |
4102 } | 4123 } |
4103 | 4124 |
4104 void WebContentsImpl::ResumeResponseDeferredAtStart() { | 4125 void WebContentsImpl::ResumeResponseDeferredAtStart() { |
4105 FrameTreeNode* node = frame_tree_.root(); | 4126 FrameTreeNode* node = frame_tree_.root(); |
4106 node->render_manager()->ResumeResponseDeferredAtStart(); | 4127 node->render_manager()->ResumeResponseDeferredAtStart(); |
4107 } | 4128 } |
4108 | 4129 |
4109 } // namespace content | 4130 } // namespace content |
OLD | NEW |