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 1938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1949 | 1949 |
1950 void WebContentsImpl::CreateNewFullscreenWidget(int32_t render_process_id, | 1950 void WebContentsImpl::CreateNewFullscreenWidget(int32_t render_process_id, |
1951 int32_t route_id) { | 1951 int32_t route_id) { |
1952 CreateNewWidget(render_process_id, route_id, true, blink::WebPopupTypeNone); | 1952 CreateNewWidget(render_process_id, route_id, true, blink::WebPopupTypeNone); |
1953 } | 1953 } |
1954 | 1954 |
1955 void WebContentsImpl::CreateNewWidget(int32_t render_process_id, | 1955 void WebContentsImpl::CreateNewWidget(int32_t render_process_id, |
1956 int32_t route_id, | 1956 int32_t route_id, |
1957 bool is_fullscreen, | 1957 bool is_fullscreen, |
1958 blink::WebPopupType popup_type) { | 1958 blink::WebPopupType popup_type) { |
1959 RenderProcessHost* process = GetRenderProcessHost(); | 1959 RenderProcessHost* process = RenderProcessHost::FromID(render_process_id); |
1960 // A message to create a new widget can only come from an active process for | 1960 // A message to create a new widget can only come from an active process for |
1961 // this WebContentsImpl instance. If any other process sends the request, | 1961 // this WebContentsImpl instance. If any other process sends the request, |
1962 // it is invalid and the process must be terminated. | 1962 // it is invalid and the process must be terminated. |
1963 if (!HasMatchingProcess(&frame_tree_, render_process_id)) { | 1963 if (!HasMatchingProcess(&frame_tree_, render_process_id)) { |
1964 RenderProcessHost* rph = RenderProcessHost::FromID(render_process_id); | 1964 base::ProcessHandle process_handle = process->GetHandle(); |
1965 base::ProcessHandle process_handle = rph->GetHandle(); | |
1966 if (process_handle != base::kNullProcessHandle) { | 1965 if (process_handle != base::kNullProcessHandle) { |
1967 RecordAction( | 1966 RecordAction( |
1968 base::UserMetricsAction("Terminate_ProcessMismatch_CreateNewWidget")); | 1967 base::UserMetricsAction("Terminate_ProcessMismatch_CreateNewWidget")); |
1969 rph->Shutdown(RESULT_CODE_KILLED, false); | 1968 process->Shutdown(RESULT_CODE_KILLED, false); |
1970 } | 1969 } |
1971 return; | 1970 return; |
1972 } | 1971 } |
1973 | 1972 |
1974 RenderWidgetHostImpl* widget_host = | 1973 RenderWidgetHostImpl* widget_host = |
1975 new RenderWidgetHostImpl(this, process, route_id, IsHidden()); | 1974 new RenderWidgetHostImpl(this, process, route_id, IsHidden()); |
1976 | 1975 |
1977 RenderWidgetHostViewBase* widget_view = | 1976 RenderWidgetHostViewBase* widget_view = |
1978 static_cast<RenderWidgetHostViewBase*>( | 1977 static_cast<RenderWidgetHostViewBase*>( |
1979 view_->CreateViewForPopupWidget(widget_host)); | 1978 view_->CreateViewForPopupWidget(widget_host)); |
(...skipping 2771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4751 const WebContentsObserver::MediaPlayerId& id) { | 4750 const WebContentsObserver::MediaPlayerId& id) { |
4752 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStartedPlaying(id)); | 4751 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStartedPlaying(id)); |
4753 } | 4752 } |
4754 | 4753 |
4755 void WebContentsImpl::MediaStoppedPlaying( | 4754 void WebContentsImpl::MediaStoppedPlaying( |
4756 const WebContentsObserver::MediaPlayerId& id) { | 4755 const WebContentsObserver::MediaPlayerId& id) { |
4757 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStoppedPlaying(id)); | 4756 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStoppedPlaying(id)); |
4758 } | 4757 } |
4759 | 4758 |
4760 } // namespace content | 4759 } // namespace content |
OLD | NEW |