Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(215)

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 1685133003: Associate RenderWidgetHostView for new widget with correct process (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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();
1960 // A message to create a new widget can only come from an active process for 1959 // 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, 1960 // this WebContentsImpl instance. If any other process sends the request,
1962 // it is invalid and the process must be terminated. 1961 // it is invalid and the process must be terminated.
1963 if (!HasMatchingProcess(&frame_tree_, render_process_id)) { 1962 if (!HasMatchingProcess(&frame_tree_, render_process_id)) {
1964 RenderProcessHost* rph = RenderProcessHost::FromID(render_process_id); 1963 RenderProcessHost* rph = RenderProcessHost::FromID(render_process_id);
Charlie Reis 2016/02/10 17:20:36 We're also grabbing it here. Let's just write it
kenrb 2016/02/10 18:25:48 Done.
1965 base::ProcessHandle process_handle = rph->GetHandle(); 1964 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 rph->Shutdown(RESULT_CODE_KILLED, false);
1970 } 1969 }
1971 return; 1970 return;
1972 } 1971 }
1973 1972
1973 RenderProcessHost* process = RenderProcessHost::FromID(render_process_id);
1974
1974 RenderWidgetHostImpl* widget_host = 1975 RenderWidgetHostImpl* widget_host =
1975 new RenderWidgetHostImpl(this, process, route_id, IsHidden()); 1976 new RenderWidgetHostImpl(this, process, route_id, IsHidden());
1976 1977
1977 RenderWidgetHostViewBase* widget_view = 1978 RenderWidgetHostViewBase* widget_view =
1978 static_cast<RenderWidgetHostViewBase*>( 1979 static_cast<RenderWidgetHostViewBase*>(
1979 view_->CreateViewForPopupWidget(widget_host)); 1980 view_->CreateViewForPopupWidget(widget_host));
1980 if (!widget_view) 1981 if (!widget_view)
1981 return; 1982 return;
1982 if (!is_fullscreen) { 1983 if (!is_fullscreen) {
1983 // Popups should not get activated. 1984 // Popups should not get activated.
(...skipping 2767 matching lines...) Expand 10 before | Expand all | Expand 10 after
4751 const WebContentsObserver::MediaPlayerId& id) { 4752 const WebContentsObserver::MediaPlayerId& id) {
4752 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStartedPlaying(id)); 4753 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStartedPlaying(id));
4753 } 4754 }
4754 4755
4755 void WebContentsImpl::MediaStoppedPlaying( 4756 void WebContentsImpl::MediaStoppedPlaying(
4756 const WebContentsObserver::MediaPlayerId& id) { 4757 const WebContentsObserver::MediaPlayerId& id) {
4757 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStoppedPlaying(id)); 4758 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStoppedPlaying(id));
4758 } 4759 }
4759 4760
4760 } // namespace content 4761 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698