| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 2367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2378 bool is_fullscreen, | 2378 bool is_fullscreen, |
| 2379 mojom::WidgetPtr widget, | 2379 mojom::WidgetPtr widget, |
| 2380 blink::WebPopupType popup_type) { | 2380 blink::WebPopupType popup_type) { |
| 2381 RenderProcessHost* process = RenderProcessHost::FromID(render_process_id); | 2381 RenderProcessHost* process = RenderProcessHost::FromID(render_process_id); |
| 2382 // A message to create a new widget can only come from an active process for | 2382 // A message to create a new widget can only come from an active process for |
| 2383 // this WebContentsImpl instance. If any other process sends the request, | 2383 // this WebContentsImpl instance. If any other process sends the request, |
| 2384 // it is invalid and the process must be terminated. | 2384 // it is invalid and the process must be terminated. |
| 2385 if (!HasMatchingProcess(&frame_tree_, render_process_id)) { | 2385 if (!HasMatchingProcess(&frame_tree_, render_process_id)) { |
| 2386 base::ProcessHandle process_handle = process->GetHandle(); | 2386 base::ProcessHandle process_handle = process->GetHandle(); |
| 2387 if (process_handle != base::kNullProcessHandle) { | 2387 if (process_handle != base::kNullProcessHandle) { |
| 2388 RecordAction( | 2388 base::RecordAction( |
| 2389 base::UserMetricsAction("Terminate_ProcessMismatch_CreateNewWidget")); | 2389 base::UserMetricsAction("Terminate_ProcessMismatch_CreateNewWidget")); |
| 2390 process->Shutdown(RESULT_CODE_KILLED, false); | 2390 process->Shutdown(RESULT_CODE_KILLED, false); |
| 2391 } | 2391 } |
| 2392 return; | 2392 return; |
| 2393 } | 2393 } |
| 2394 | 2394 |
| 2395 RenderWidgetHostImpl* widget_host = | 2395 RenderWidgetHostImpl* widget_host = |
| 2396 new RenderWidgetHostImpl(this, process, route_id, IsHidden()); | 2396 new RenderWidgetHostImpl(this, process, route_id, IsHidden()); |
| 2397 | 2397 |
| 2398 RenderWidgetHostViewBase* widget_view = | 2398 RenderWidgetHostViewBase* widget_view = |
| (...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2986 void WebContentsImpl::ReloadLoFiImages() { | 2986 void WebContentsImpl::ReloadLoFiImages() { |
| 2987 SendToAllFrames(new FrameMsg_ReloadLoFiImages(MSG_ROUTING_NONE)); | 2987 SendToAllFrames(new FrameMsg_ReloadLoFiImages(MSG_ROUTING_NONE)); |
| 2988 } | 2988 } |
| 2989 | 2989 |
| 2990 void WebContentsImpl::Undo() { | 2990 void WebContentsImpl::Undo() { |
| 2991 RenderFrameHostImpl* focused_frame = GetFocusedFrame(); | 2991 RenderFrameHostImpl* focused_frame = GetFocusedFrame(); |
| 2992 if (!focused_frame) | 2992 if (!focused_frame) |
| 2993 return; | 2993 return; |
| 2994 | 2994 |
| 2995 focused_frame->GetFrameInputHandler()->Undo(); | 2995 focused_frame->GetFrameInputHandler()->Undo(); |
| 2996 RecordAction(base::UserMetricsAction("Undo")); | 2996 base::RecordAction(base::UserMetricsAction("Undo")); |
| 2997 } | 2997 } |
| 2998 | 2998 |
| 2999 void WebContentsImpl::Redo() { | 2999 void WebContentsImpl::Redo() { |
| 3000 RenderFrameHostImpl* focused_frame = GetFocusedFrame(); | 3000 RenderFrameHostImpl* focused_frame = GetFocusedFrame(); |
| 3001 if (!focused_frame) | 3001 if (!focused_frame) |
| 3002 return; | 3002 return; |
| 3003 focused_frame->GetFrameInputHandler()->Redo(); | 3003 focused_frame->GetFrameInputHandler()->Redo(); |
| 3004 RecordAction(base::UserMetricsAction("Redo")); | 3004 base::RecordAction(base::UserMetricsAction("Redo")); |
| 3005 } | 3005 } |
| 3006 | 3006 |
| 3007 void WebContentsImpl::Cut() { | 3007 void WebContentsImpl::Cut() { |
| 3008 RenderFrameHostImpl* focused_frame = GetFocusedFrame(); | 3008 RenderFrameHostImpl* focused_frame = GetFocusedFrame(); |
| 3009 if (!focused_frame) | 3009 if (!focused_frame) |
| 3010 return; | 3010 return; |
| 3011 | 3011 |
| 3012 focused_frame->GetFrameInputHandler()->Cut(); | 3012 focused_frame->GetFrameInputHandler()->Cut(); |
| 3013 RecordAction(base::UserMetricsAction("Cut")); | 3013 base::RecordAction(base::UserMetricsAction("Cut")); |
| 3014 } | 3014 } |
| 3015 | 3015 |
| 3016 void WebContentsImpl::Copy() { | 3016 void WebContentsImpl::Copy() { |
| 3017 RenderFrameHostImpl* focused_frame = GetFocusedFrame(); | 3017 RenderFrameHostImpl* focused_frame = GetFocusedFrame(); |
| 3018 if (!focused_frame) | 3018 if (!focused_frame) |
| 3019 return; | 3019 return; |
| 3020 | 3020 |
| 3021 focused_frame->GetFrameInputHandler()->Copy(); | 3021 focused_frame->GetFrameInputHandler()->Copy(); |
| 3022 RecordAction(base::UserMetricsAction("Copy")); | 3022 base::RecordAction(base::UserMetricsAction("Copy")); |
| 3023 } | 3023 } |
| 3024 | 3024 |
| 3025 void WebContentsImpl::CopyToFindPboard() { | 3025 void WebContentsImpl::CopyToFindPboard() { |
| 3026 #if defined(OS_MACOSX) | 3026 #if defined(OS_MACOSX) |
| 3027 RenderFrameHostImpl* focused_frame = GetFocusedFrame(); | 3027 RenderFrameHostImpl* focused_frame = GetFocusedFrame(); |
| 3028 if (!focused_frame) | 3028 if (!focused_frame) |
| 3029 return; | 3029 return; |
| 3030 | 3030 |
| 3031 // Windows/Linux don't have the concept of a find pasteboard. | 3031 // Windows/Linux don't have the concept of a find pasteboard. |
| 3032 focused_frame->GetFrameInputHandler()->CopyToFindPboard(); | 3032 focused_frame->GetFrameInputHandler()->CopyToFindPboard(); |
| 3033 RecordAction(base::UserMetricsAction("CopyToFindPboard")); | 3033 base::RecordAction(base::UserMetricsAction("CopyToFindPboard")); |
| 3034 #endif | 3034 #endif |
| 3035 } | 3035 } |
| 3036 | 3036 |
| 3037 void WebContentsImpl::Paste() { | 3037 void WebContentsImpl::Paste() { |
| 3038 RenderFrameHostImpl* focused_frame = GetFocusedFrame(); | 3038 RenderFrameHostImpl* focused_frame = GetFocusedFrame(); |
| 3039 if (!focused_frame) | 3039 if (!focused_frame) |
| 3040 return; | 3040 return; |
| 3041 | 3041 |
| 3042 focused_frame->GetFrameInputHandler()->Paste(); | 3042 focused_frame->GetFrameInputHandler()->Paste(); |
| 3043 RecordAction(base::UserMetricsAction("Paste")); | 3043 base::RecordAction(base::UserMetricsAction("Paste")); |
| 3044 } | 3044 } |
| 3045 | 3045 |
| 3046 void WebContentsImpl::PasteAndMatchStyle() { | 3046 void WebContentsImpl::PasteAndMatchStyle() { |
| 3047 RenderFrameHostImpl* focused_frame = GetFocusedFrame(); | 3047 RenderFrameHostImpl* focused_frame = GetFocusedFrame(); |
| 3048 if (!focused_frame) | 3048 if (!focused_frame) |
| 3049 return; | 3049 return; |
| 3050 | 3050 |
| 3051 focused_frame->GetFrameInputHandler()->PasteAndMatchStyle(); | 3051 focused_frame->GetFrameInputHandler()->PasteAndMatchStyle(); |
| 3052 RecordAction(base::UserMetricsAction("PasteAndMatchStyle")); | 3052 base::RecordAction(base::UserMetricsAction("PasteAndMatchStyle")); |
| 3053 } | 3053 } |
| 3054 | 3054 |
| 3055 void WebContentsImpl::Delete() { | 3055 void WebContentsImpl::Delete() { |
| 3056 RenderFrameHostImpl* focused_frame = GetFocusedFrame(); | 3056 RenderFrameHostImpl* focused_frame = GetFocusedFrame(); |
| 3057 if (!focused_frame) | 3057 if (!focused_frame) |
| 3058 return; | 3058 return; |
| 3059 | 3059 |
| 3060 focused_frame->GetFrameInputHandler()->Delete(); | 3060 focused_frame->GetFrameInputHandler()->Delete(); |
| 3061 RecordAction(base::UserMetricsAction("DeleteSelection")); | 3061 base::RecordAction(base::UserMetricsAction("DeleteSelection")); |
| 3062 } | 3062 } |
| 3063 | 3063 |
| 3064 void WebContentsImpl::SelectAll() { | 3064 void WebContentsImpl::SelectAll() { |
| 3065 RenderFrameHostImpl* focused_frame = GetFocusedFrame(); | 3065 RenderFrameHostImpl* focused_frame = GetFocusedFrame(); |
| 3066 if (!focused_frame) | 3066 if (!focused_frame) |
| 3067 return; | 3067 return; |
| 3068 | 3068 |
| 3069 focused_frame->GetFrameInputHandler()->SelectAll(); | 3069 focused_frame->GetFrameInputHandler()->SelectAll(); |
| 3070 RecordAction(base::UserMetricsAction("SelectAll")); | 3070 base::RecordAction(base::UserMetricsAction("SelectAll")); |
| 3071 } | 3071 } |
| 3072 | 3072 |
| 3073 void WebContentsImpl::CollapseSelection() { | 3073 void WebContentsImpl::CollapseSelection() { |
| 3074 RenderFrameHostImpl* focused_frame = GetFocusedFrame(); | 3074 RenderFrameHostImpl* focused_frame = GetFocusedFrame(); |
| 3075 if (!focused_frame) | 3075 if (!focused_frame) |
| 3076 return; | 3076 return; |
| 3077 | 3077 |
| 3078 focused_frame->GetFrameInputHandler()->CollapseSelection(); | 3078 focused_frame->GetFrameInputHandler()->CollapseSelection(); |
| 3079 } | 3079 } |
| 3080 | 3080 |
| (...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3850 // TODO(nick, estark): Should we call FilterURL using |source|'s process on | 3850 // TODO(nick, estark): Should we call FilterURL using |source|'s process on |
| 3851 // these parameters? |target_url| seems unused, except for a log message. And | 3851 // these parameters? |target_url| seems unused, except for a log message. And |
| 3852 // |security_origin| might be replaceable with the origin of the main frame. | 3852 // |security_origin| might be replaceable with the origin of the main frame. |
| 3853 DidRunInsecureContent(security_origin, target_url); | 3853 DidRunInsecureContent(security_origin, target_url); |
| 3854 } | 3854 } |
| 3855 | 3855 |
| 3856 void WebContentsImpl::DidRunInsecureContent(const GURL& security_origin, | 3856 void WebContentsImpl::DidRunInsecureContent(const GURL& security_origin, |
| 3857 const GURL& target_url) { | 3857 const GURL& target_url) { |
| 3858 LOG(WARNING) << security_origin << " ran insecure content from " | 3858 LOG(WARNING) << security_origin << " ran insecure content from " |
| 3859 << target_url.possibly_invalid_spec(); | 3859 << target_url.possibly_invalid_spec(); |
| 3860 RecordAction(base::UserMetricsAction("SSL.RanInsecureContent")); | 3860 base::RecordAction(base::UserMetricsAction("SSL.RanInsecureContent")); |
| 3861 if (base::EndsWith(security_origin.spec(), kDotGoogleDotCom, | 3861 if (base::EndsWith(security_origin.spec(), kDotGoogleDotCom, |
| 3862 base::CompareCase::INSENSITIVE_ASCII)) | 3862 base::CompareCase::INSENSITIVE_ASCII)) |
| 3863 RecordAction(base::UserMetricsAction("SSL.RanInsecureContentGoogle")); | 3863 base::RecordAction(base::UserMetricsAction("SSL.RanInsecureContentGoogle")); |
| 3864 controller_.ssl_manager()->DidRunMixedContent(security_origin); | 3864 controller_.ssl_manager()->DidRunMixedContent(security_origin); |
| 3865 } | 3865 } |
| 3866 | 3866 |
| 3867 void WebContentsImpl::PassiveInsecureContentFound(const GURL& resource_url) { | 3867 void WebContentsImpl::PassiveInsecureContentFound(const GURL& resource_url) { |
| 3868 GetDelegate()->PassiveInsecureContentFound(resource_url); | 3868 GetDelegate()->PassiveInsecureContentFound(resource_url); |
| 3869 } | 3869 } |
| 3870 | 3870 |
| 3871 bool WebContentsImpl::ShouldAllowRunningInsecureContent( | 3871 bool WebContentsImpl::ShouldAllowRunningInsecureContent( |
| 3872 WebContents* web_contents, | 3872 WebContents* web_contents, |
| 3873 bool allowed_per_prefs, | 3873 bool allowed_per_prefs, |
| (...skipping 2003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5877 } | 5877 } |
| 5878 | 5878 |
| 5879 void WebContentsImpl::MediaMutedStatusChanged( | 5879 void WebContentsImpl::MediaMutedStatusChanged( |
| 5880 const WebContentsObserver::MediaPlayerId& id, | 5880 const WebContentsObserver::MediaPlayerId& id, |
| 5881 bool muted) { | 5881 bool muted) { |
| 5882 for (auto& observer : observers_) | 5882 for (auto& observer : observers_) |
| 5883 observer.MediaMutedStatusChanged(id, muted); | 5883 observer.MediaMutedStatusChanged(id, muted); |
| 5884 } | 5884 } |
| 5885 | 5885 |
| 5886 } // namespace content | 5886 } // namespace content |
| OLD | NEW |