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 1479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1490 } | 1490 } |
1491 | 1491 |
1492 void WebContentsImpl::LostCapture(RenderWidgetHostImpl* render_widget_host) { | 1492 void WebContentsImpl::LostCapture(RenderWidgetHostImpl* render_widget_host) { |
1493 if (!RenderViewHostImpl::From(render_widget_host)) | 1493 if (!RenderViewHostImpl::From(render_widget_host)) |
1494 return; | 1494 return; |
1495 | 1495 |
1496 if (delegate_) | 1496 if (delegate_) |
1497 delegate_->LostCapture(); | 1497 delegate_->LostCapture(); |
1498 } | 1498 } |
1499 | 1499 |
| 1500 void WebContentsImpl::RenderWidgetCreated( |
| 1501 RenderWidgetHostImpl* render_widget_host) { |
| 1502 created_widgets_.insert(render_widget_host); |
| 1503 } |
| 1504 |
1500 void WebContentsImpl::RenderWidgetDeleted( | 1505 void WebContentsImpl::RenderWidgetDeleted( |
1501 RenderWidgetHostImpl* render_widget_host) { | 1506 RenderWidgetHostImpl* render_widget_host) { |
1502 if (is_being_destroyed_) { | 1507 // Note that |is_being_destroyed_| can be true at this point as |
1503 // |created_widgets_| might have been destroyed. | 1508 // ~WebContentsImpl() calls RFHM::ClearRFHsPendingShutdown(), which might lead |
| 1509 // us here. |
| 1510 created_widgets_.erase(render_widget_host); |
| 1511 |
| 1512 if (is_being_destroyed_) |
1504 return; | 1513 return; |
1505 } | |
1506 | |
1507 std::set<RenderWidgetHostImpl*>::iterator iter = | |
1508 created_widgets_.find(render_widget_host); | |
1509 if (iter != created_widgets_.end()) | |
1510 created_widgets_.erase(iter); | |
1511 | 1514 |
1512 if (render_widget_host && | 1515 if (render_widget_host && |
1513 render_widget_host->GetRoutingID() == fullscreen_widget_routing_id_) { | 1516 render_widget_host->GetRoutingID() == fullscreen_widget_routing_id_) { |
1514 if (delegate_ && delegate_->EmbedsFullscreenWidget()) | 1517 if (delegate_ && delegate_->EmbedsFullscreenWidget()) |
1515 delegate_->ExitFullscreenModeForTab(this); | 1518 delegate_->ExitFullscreenModeForTab(this); |
1516 FOR_EACH_OBSERVER(WebContentsObserver, | 1519 FOR_EACH_OBSERVER(WebContentsObserver, |
1517 observers_, | 1520 observers_, |
1518 DidDestroyFullscreenWidget( | 1521 DidDestroyFullscreenWidget( |
1519 fullscreen_widget_routing_id_)); | 1522 fullscreen_widget_routing_id_)); |
1520 fullscreen_widget_routing_id_ = MSG_ROUTING_NONE; | 1523 fullscreen_widget_routing_id_ = MSG_ROUTING_NONE; |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1916 if (process_handle != base::kNullProcessHandle) { | 1919 if (process_handle != base::kNullProcessHandle) { |
1917 RecordAction( | 1920 RecordAction( |
1918 base::UserMetricsAction("Terminate_ProcessMismatch_CreateNewWidget")); | 1921 base::UserMetricsAction("Terminate_ProcessMismatch_CreateNewWidget")); |
1919 rph->Shutdown(RESULT_CODE_KILLED, false); | 1922 rph->Shutdown(RESULT_CODE_KILLED, false); |
1920 } | 1923 } |
1921 return; | 1924 return; |
1922 } | 1925 } |
1923 | 1926 |
1924 RenderWidgetHostImpl* widget_host = | 1927 RenderWidgetHostImpl* widget_host = |
1925 new RenderWidgetHostImpl(this, process, route_id, IsHidden()); | 1928 new RenderWidgetHostImpl(this, process, route_id, IsHidden()); |
1926 created_widgets_.insert(widget_host); | |
1927 | 1929 |
1928 RenderWidgetHostViewBase* widget_view = | 1930 RenderWidgetHostViewBase* widget_view = |
1929 static_cast<RenderWidgetHostViewBase*>( | 1931 static_cast<RenderWidgetHostViewBase*>( |
1930 view_->CreateViewForPopupWidget(widget_host)); | 1932 view_->CreateViewForPopupWidget(widget_host)); |
1931 if (!widget_view) | 1933 if (!widget_view) |
1932 return; | 1934 return; |
1933 if (!is_fullscreen) { | 1935 if (!is_fullscreen) { |
1934 // Popups should not get activated. | 1936 // Popups should not get activated. |
1935 widget_view->SetPopupType(popup_type); | 1937 widget_view->SetPopupType(popup_type); |
1936 } | 1938 } |
(...skipping 2852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4789 return NULL; | 4791 return NULL; |
4790 } | 4792 } |
4791 | 4793 |
4792 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4794 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
4793 force_disable_overscroll_content_ = force_disable; | 4795 force_disable_overscroll_content_ = force_disable; |
4794 if (view_) | 4796 if (view_) |
4795 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4797 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
4796 } | 4798 } |
4797 | 4799 |
4798 } // namespace content | 4800 } // namespace content |
OLD | NEW |