| 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/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 OnSetSelectedColorInColorChooser) | 625 OnSetSelectedColorInColorChooser) |
| 626 | 626 |
| 627 IPC_MESSAGE_HANDLER(ViewHostMsg_DidFirstVisuallyNonEmptyPaint, | 627 IPC_MESSAGE_HANDLER(ViewHostMsg_DidFirstVisuallyNonEmptyPaint, |
| 628 OnFirstVisuallyNonEmptyPaint) | 628 OnFirstVisuallyNonEmptyPaint) |
| 629 IPC_MESSAGE_HANDLER(FrameHostMsg_DidLoadResourceFromMemoryCache, | 629 IPC_MESSAGE_HANDLER(FrameHostMsg_DidLoadResourceFromMemoryCache, |
| 630 OnDidLoadResourceFromMemoryCache) | 630 OnDidLoadResourceFromMemoryCache) |
| 631 IPC_MESSAGE_HANDLER(FrameHostMsg_DidDisplayInsecureContent, | 631 IPC_MESSAGE_HANDLER(FrameHostMsg_DidDisplayInsecureContent, |
| 632 OnDidDisplayInsecureContent) | 632 OnDidDisplayInsecureContent) |
| 633 IPC_MESSAGE_HANDLER(FrameHostMsg_DidRunInsecureContent, | 633 IPC_MESSAGE_HANDLER(FrameHostMsg_DidRunInsecureContent, |
| 634 OnDidRunInsecureContent) | 634 OnDidRunInsecureContent) |
| 635 IPC_MESSAGE_HANDLER(FrameHostMsg_DidDisplayContentWithCertificateErrors, |
| 636 OnDidDisplayContentWithCertificateErrors) |
| 637 IPC_MESSAGE_HANDLER(FrameHostMsg_DidRunContentWithCertificateErrors, |
| 638 OnDidRunContentWithCertificateErrors) |
| 635 IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset, OnGoToEntryAtOffset) | 639 IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset, OnGoToEntryAtOffset) |
| 636 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateZoomLimits, OnUpdateZoomLimits) | 640 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateZoomLimits, OnUpdateZoomLimits) |
| 637 IPC_MESSAGE_HANDLER(ViewHostMsg_PageScaleFactorChanged, | 641 IPC_MESSAGE_HANDLER(ViewHostMsg_PageScaleFactorChanged, |
| 638 OnPageScaleFactorChanged) | 642 OnPageScaleFactorChanged) |
| 639 IPC_MESSAGE_HANDLER(ViewHostMsg_EnumerateDirectory, OnEnumerateDirectory) | 643 IPC_MESSAGE_HANDLER(ViewHostMsg_EnumerateDirectory, OnEnumerateDirectory) |
| 640 IPC_MESSAGE_HANDLER(FrameHostMsg_RegisterProtocolHandler, | 644 IPC_MESSAGE_HANDLER(FrameHostMsg_RegisterProtocolHandler, |
| 641 OnRegisterProtocolHandler) | 645 OnRegisterProtocolHandler) |
| 642 IPC_MESSAGE_HANDLER(FrameHostMsg_UnregisterProtocolHandler, | 646 IPC_MESSAGE_HANDLER(FrameHostMsg_UnregisterProtocolHandler, |
| 643 OnUnregisterProtocolHandler) | 647 OnUnregisterProtocolHandler) |
| 644 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdatePageImportanceSignals, | 648 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdatePageImportanceSignals, |
| (...skipping 2517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3162 } | 3166 } |
| 3163 } | 3167 } |
| 3164 | 3168 |
| 3165 void WebContentsImpl::OnDidDisplayInsecureContent() { | 3169 void WebContentsImpl::OnDidDisplayInsecureContent() { |
| 3166 RecordAction(base::UserMetricsAction("SSL.DisplayedInsecureContent")); | 3170 RecordAction(base::UserMetricsAction("SSL.DisplayedInsecureContent")); |
| 3167 displayed_insecure_content_ = true; | 3171 displayed_insecure_content_ = true; |
| 3168 SSLManager::NotifySSLInternalStateChanged( | 3172 SSLManager::NotifySSLInternalStateChanged( |
| 3169 GetController().GetBrowserContext()); | 3173 GetController().GetBrowserContext()); |
| 3170 } | 3174 } |
| 3171 | 3175 |
| 3172 void WebContentsImpl::OnDidRunInsecureContent( | 3176 void WebContentsImpl::OnDidRunInsecureContent(const GURL& security_origin, |
| 3173 const std::string& security_origin, const GURL& target_url) { | 3177 const GURL& target_url) { |
| 3174 LOG(WARNING) << security_origin << " ran insecure content from " | 3178 LOG(WARNING) << security_origin << " ran insecure content from " |
| 3175 << target_url.possibly_invalid_spec(); | 3179 << target_url.possibly_invalid_spec(); |
| 3176 RecordAction(base::UserMetricsAction("SSL.RanInsecureContent")); | 3180 RecordAction(base::UserMetricsAction("SSL.RanInsecureContent")); |
| 3177 if (base::EndsWith(security_origin, kDotGoogleDotCom, | 3181 if (base::EndsWith(security_origin.spec(), kDotGoogleDotCom, |
| 3178 base::CompareCase::INSENSITIVE_ASCII)) | 3182 base::CompareCase::INSENSITIVE_ASCII)) |
| 3179 RecordAction(base::UserMetricsAction("SSL.RanInsecureContentGoogle")); | 3183 RecordAction(base::UserMetricsAction("SSL.RanInsecureContentGoogle")); |
| 3180 controller_.ssl_manager()->DidRunInsecureContent(security_origin); | 3184 controller_.ssl_manager()->DidRunInsecureContent(security_origin); |
| 3181 SSLManager::NotifySSLInternalStateChanged( | 3185 SSLManager::NotifySSLInternalStateChanged( |
| 3182 GetController().GetBrowserContext()); | 3186 GetController().GetBrowserContext()); |
| 3183 } | 3187 } |
| 3184 | 3188 |
| 3189 void WebContentsImpl::OnDidDisplayContentWithCertificateErrors( |
| 3190 const GURL& url, |
| 3191 const std::string& security_info) { |
| 3192 SSLStatus ssl; |
| 3193 if (!DeserializeSecurityInfo(security_info, &ssl)) { |
| 3194 bad_message::ReceivedBadMessage( |
| 3195 GetRenderProcessHost(), |
| 3196 bad_message::WC_CONTENT_WITH_CERT_ERRORS_BAD_SECURITY_INFO); |
| 3197 return; |
| 3198 } |
| 3199 |
| 3200 displayed_insecure_content_ = true; |
| 3201 SSLManager::NotifySSLInternalStateChanged( |
| 3202 GetController().GetBrowserContext()); |
| 3203 } |
| 3204 |
| 3205 void WebContentsImpl::OnDidRunContentWithCertificateErrors( |
| 3206 const GURL& security_origin, |
| 3207 const GURL& url, |
| 3208 const std::string& security_info) { |
| 3209 SSLStatus ssl; |
| 3210 if (!DeserializeSecurityInfo(security_info, &ssl)) { |
| 3211 bad_message::ReceivedBadMessage( |
| 3212 GetRenderProcessHost(), |
| 3213 bad_message::WC_CONTENT_WITH_CERT_ERRORS_BAD_SECURITY_INFO); |
| 3214 return; |
| 3215 } |
| 3216 |
| 3217 controller_.ssl_manager()->DidRunInsecureContent(security_origin); |
| 3218 SSLManager::NotifySSLInternalStateChanged( |
| 3219 GetController().GetBrowserContext()); |
| 3220 } |
| 3221 |
| 3185 void WebContentsImpl::OnDocumentLoadedInFrame() { | 3222 void WebContentsImpl::OnDocumentLoadedInFrame() { |
| 3186 if (!HasValidFrameSource()) | 3223 if (!HasValidFrameSource()) |
| 3187 return; | 3224 return; |
| 3188 | 3225 |
| 3189 RenderFrameHostImpl* rfh = | 3226 RenderFrameHostImpl* rfh = |
| 3190 static_cast<RenderFrameHostImpl*>(render_frame_message_source_); | 3227 static_cast<RenderFrameHostImpl*>(render_frame_message_source_); |
| 3191 FOR_EACH_OBSERVER( | 3228 FOR_EACH_OBSERVER( |
| 3192 WebContentsObserver, observers_, DocumentLoadedInFrame(rfh)); | 3229 WebContentsObserver, observers_, DocumentLoadedInFrame(rfh)); |
| 3193 } | 3230 } |
| 3194 | 3231 |
| (...skipping 1474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4669 const WebContentsObserver::MediaPlayerId& id) { | 4706 const WebContentsObserver::MediaPlayerId& id) { |
| 4670 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStartedPlaying(id)); | 4707 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStartedPlaying(id)); |
| 4671 } | 4708 } |
| 4672 | 4709 |
| 4673 void WebContentsImpl::MediaStoppedPlaying( | 4710 void WebContentsImpl::MediaStoppedPlaying( |
| 4674 const WebContentsObserver::MediaPlayerId& id) { | 4711 const WebContentsObserver::MediaPlayerId& id) { |
| 4675 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStoppedPlaying(id)); | 4712 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStoppedPlaying(id)); |
| 4676 } | 4713 } |
| 4677 | 4714 |
| 4678 } // namespace content | 4715 } // namespace content |
| OLD | NEW |