| 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 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 return true; | 502 return true; |
| 503 render_view_message_source_ = render_view_host; | 503 render_view_message_source_ = render_view_host; |
| 504 } | 504 } |
| 505 | 505 |
| 506 bool handled = true; | 506 bool handled = true; |
| 507 IPC_BEGIN_MESSAGE_MAP(WebContentsImpl, message) | 507 IPC_BEGIN_MESSAGE_MAP(WebContentsImpl, message) |
| 508 IPC_MESSAGE_HANDLER(FrameHostMsg_PepperPluginHung, OnPepperPluginHung) | 508 IPC_MESSAGE_HANDLER(FrameHostMsg_PepperPluginHung, OnPepperPluginHung) |
| 509 IPC_MESSAGE_HANDLER(FrameHostMsg_PluginCrashed, OnPluginCrashed) | 509 IPC_MESSAGE_HANDLER(FrameHostMsg_PluginCrashed, OnPluginCrashed) |
| 510 IPC_MESSAGE_HANDLER(FrameHostMsg_DomOperationResponse, | 510 IPC_MESSAGE_HANDLER(FrameHostMsg_DomOperationResponse, |
| 511 OnDomOperationResponse) | 511 OnDomOperationResponse) |
| 512 IPC_MESSAGE_HANDLER(FrameHostMsg_DidDetectXSS, OnDidDetectXSS) |
| 512 IPC_MESSAGE_HANDLER(FrameHostMsg_DidFinishDocumentLoad, | 513 IPC_MESSAGE_HANDLER(FrameHostMsg_DidFinishDocumentLoad, |
| 513 OnDocumentLoadedInFrame) | 514 OnDocumentLoadedInFrame) |
| 514 IPC_MESSAGE_HANDLER(FrameHostMsg_DidFinishLoad, OnDidFinishLoad) | 515 IPC_MESSAGE_HANDLER(FrameHostMsg_DidFinishLoad, OnDidFinishLoad) |
| 515 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStartLoading, OnDidStartLoading) | 516 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStartLoading, OnDidStartLoading) |
| 516 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStopLoading, OnDidStopLoading) | 517 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStopLoading, OnDidStopLoading) |
| 517 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeLoadProgress, | 518 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeLoadProgress, |
| 518 OnDidChangeLoadProgress) | 519 OnDidChangeLoadProgress) |
| 519 IPC_MESSAGE_HANDLER(FrameHostMsg_OpenColorChooser, OnOpenColorChooser) | 520 IPC_MESSAGE_HANDLER(FrameHostMsg_OpenColorChooser, OnOpenColorChooser) |
| 520 IPC_MESSAGE_HANDLER(FrameHostMsg_EndColorChooser, OnEndColorChooser) | 521 IPC_MESSAGE_HANDLER(FrameHostMsg_EndColorChooser, OnEndColorChooser) |
| 521 IPC_MESSAGE_HANDLER(FrameHostMsg_SetSelectedColorInColorChooser, | 522 IPC_MESSAGE_HANDLER(FrameHostMsg_SetSelectedColorInColorChooser, |
| (...skipping 2045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2567 << target_url.possibly_invalid_spec(); | 2568 << target_url.possibly_invalid_spec(); |
| 2568 RecordAction(base::UserMetricsAction("SSL.RanInsecureContent")); | 2569 RecordAction(base::UserMetricsAction("SSL.RanInsecureContent")); |
| 2569 if (EndsWith(security_origin, kDotGoogleDotCom, false)) | 2570 if (EndsWith(security_origin, kDotGoogleDotCom, false)) |
| 2570 RecordAction(base::UserMetricsAction("SSL.RanInsecureContentGoogle")); | 2571 RecordAction(base::UserMetricsAction("SSL.RanInsecureContentGoogle")); |
| 2571 controller_.ssl_manager()->DidRunInsecureContent(security_origin); | 2572 controller_.ssl_manager()->DidRunInsecureContent(security_origin); |
| 2572 displayed_insecure_content_ = true; | 2573 displayed_insecure_content_ = true; |
| 2573 SSLManager::NotifySSLInternalStateChanged( | 2574 SSLManager::NotifySSLInternalStateChanged( |
| 2574 GetController().GetBrowserContext()); | 2575 GetController().GetBrowserContext()); |
| 2575 } | 2576 } |
| 2576 | 2577 |
| 2578 |
| 2579 void WebContentsImpl::OnDidDetectXSS(int32 page_id, |
| 2580 const GURL& url, |
| 2581 bool blocked_entire_page) { |
| 2582 if (!blocked_entire_page) |
| 2583 return; |
| 2584 |
| 2585 int entry_index = controller_.GetEntryIndexWithPageID( |
| 2586 GetRenderViewHost()->GetSiteInstance(), page_id); |
| 2587 if (entry_index < 0) |
| 2588 return; |
| 2589 |
| 2590 NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry( |
| 2591 controller_.GetEntryAtIndex(entry_index)); |
| 2592 if (!entry) |
| 2593 return; |
| 2594 |
| 2595 entry->set_xss_detected(true); |
| 2596 } |
| 2597 |
| 2577 void WebContentsImpl::OnDocumentLoadedInFrame() { | 2598 void WebContentsImpl::OnDocumentLoadedInFrame() { |
| 2578 CHECK(render_frame_message_source_); | 2599 CHECK(render_frame_message_source_); |
| 2579 CHECK(!render_view_message_source_); | 2600 CHECK(!render_view_message_source_); |
| 2580 RenderFrameHostImpl* rfh = | 2601 RenderFrameHostImpl* rfh = |
| 2581 static_cast<RenderFrameHostImpl*>(render_frame_message_source_); | 2602 static_cast<RenderFrameHostImpl*>(render_frame_message_source_); |
| 2582 | 2603 |
| 2583 int render_frame_id = rfh->GetRoutingID(); | 2604 int render_frame_id = rfh->GetRoutingID(); |
| 2584 RenderViewHost* render_view_host = rfh->render_view_host(); | 2605 RenderViewHost* render_view_host = rfh->render_view_host(); |
| 2585 FOR_EACH_OBSERVER(WebContentsObserver, | 2606 FOR_EACH_OBSERVER(WebContentsObserver, |
| 2586 observers_, | 2607 observers_, |
| (...skipping 1485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4072 | 4093 |
| 4073 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { | 4094 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { |
| 4074 if (!delegate_) | 4095 if (!delegate_) |
| 4075 return; | 4096 return; |
| 4076 const gfx::Size new_size = GetPreferredSize(); | 4097 const gfx::Size new_size = GetPreferredSize(); |
| 4077 if (new_size != old_size) | 4098 if (new_size != old_size) |
| 4078 delegate_->UpdatePreferredSize(this, new_size); | 4099 delegate_->UpdatePreferredSize(this, new_size); |
| 4079 } | 4100 } |
| 4080 | 4101 |
| 4081 } // namespace content | 4102 } // namespace content |
| OLD | NEW |