Chromium Code Reviews| 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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 421 | 421 |
| 422 // Delete all RFH pending shutdown, which will lead the corresponding RVH to | 422 // Delete all RFH pending shutdown, which will lead the corresponding RVH to |
| 423 // shutdown and be deleted as well. | 423 // shutdown and be deleted as well. |
| 424 frame_tree_.ForEach( | 424 frame_tree_.ForEach( |
| 425 base::Bind(&RenderFrameHostManager::ClearRFHsPendingShutdown)); | 425 base::Bind(&RenderFrameHostManager::ClearRFHsPendingShutdown)); |
| 426 | 426 |
| 427 ClearAllPowerSaveBlockers(); | 427 ClearAllPowerSaveBlockers(); |
| 428 | 428 |
| 429 for (std::set<RenderWidgetHostImpl*>::iterator iter = | 429 for (std::set<RenderWidgetHostImpl*>::iterator iter = |
| 430 created_widgets_.begin(); iter != created_widgets_.end(); ++iter) { | 430 created_widgets_.begin(); iter != created_widgets_.end(); ++iter) { |
| 431 (*iter)->DetachDelegate(); | 431 (*iter)->DetachDelegate(); |
|
lazyboy
2015/11/20 23:52:05
not sure if this is an issue, but:
Technically the
Charlie Reis
2015/11/21 01:19:19
I don't follow your concern here. DetachDelegate
lazyboy
2015/11/21 02:22:59
Sorry for not being precise, this is just a hypoth
| |
| 432 } | 432 } |
| 433 created_widgets_.clear(); | 433 created_widgets_.clear(); |
| 434 | 434 |
| 435 // Clear out any JavaScript state. | 435 // Clear out any JavaScript state. |
| 436 if (dialog_manager_) | 436 if (dialog_manager_) |
| 437 dialog_manager_->ResetDialogState(this); | 437 dialog_manager_->ResetDialogState(this); |
| 438 | 438 |
| 439 if (color_chooser_info_.get()) | 439 if (color_chooser_info_.get()) |
| 440 color_chooser_info_->chooser->End(); | 440 color_chooser_info_->chooser->End(); |
| 441 | 441 |
| (...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1286 observers_, | 1286 observers_, |
| 1287 DidCloneToNewWebContents(this, tc)); | 1287 DidCloneToNewWebContents(this, tc)); |
| 1288 return tc; | 1288 return tc; |
| 1289 } | 1289 } |
| 1290 | 1290 |
| 1291 void WebContentsImpl::Observe(int type, | 1291 void WebContentsImpl::Observe(int type, |
| 1292 const NotificationSource& source, | 1292 const NotificationSource& source, |
| 1293 const NotificationDetails& details) { | 1293 const NotificationDetails& details) { |
| 1294 switch (type) { | 1294 switch (type) { |
| 1295 case NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED: { | 1295 case NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED: { |
| 1296 RenderWidgetHost* host = Source<RenderWidgetHost>(source).ptr(); | 1296 RenderWidgetHostImpl* host = Source<RenderWidgetHostImpl>(source).ptr(); |
| 1297 | |
| 1298 std::set<RenderWidgetHostImpl*>::iterator iter = | |
| 1299 created_widgets_.find(host); | |
| 1300 if (iter != created_widgets_.end()) | |
| 1301 created_widgets_.erase(iter); | |
|
Charlie Reis
2015/11/20 18:41:41
Why is this part necessary? Won't we take care of
Avi (use Gerrit)
2015/11/20 19:06:30
Side comment: Why do you check to see if the widge
lazyboy
2015/11/20 23:52:05
Thanks I've updated the relevant places.
(Side eff
lazyboy
2015/11/20 23:52:05
Yes it would have, however there's a WCI::is_being
Charlie Reis
2015/11/21 01:19:19
Hmm, that CL didn't add any tests to prevent regre
lazyboy
2015/11/21 02:22:59
Yes, I've tried with and without flash fullscreen.
| |
| 1302 | |
| 1297 RenderWidgetHostView* view = host->GetView(); | 1303 RenderWidgetHostView* view = host->GetView(); |
| 1298 if (view == GetFullscreenRenderWidgetHostView()) { | 1304 if (view == GetFullscreenRenderWidgetHostView()) { |
| 1299 // We cannot just call view_->RestoreFocus() here. On some platforms, | 1305 // We cannot just call view_->RestoreFocus() here. On some platforms, |
| 1300 // attempting to focus the currently-invisible WebContentsView will be | 1306 // attempting to focus the currently-invisible WebContentsView will be |
| 1301 // flat-out ignored. Therefore, this boolean is used to track whether | 1307 // flat-out ignored. Therefore, this boolean is used to track whether |
| 1302 // we will request focus after the fullscreen widget has been | 1308 // we will request focus after the fullscreen widget has been |
| 1303 // destroyed. | 1309 // destroyed. |
| 1304 fullscreen_widget_had_focus_at_shutdown_ = (view && view->HasFocus()); | 1310 fullscreen_widget_had_focus_at_shutdown_ = (view && view->HasFocus()); |
| 1305 } else { | 1311 } else { |
| 1306 for (PendingWidgetViews::iterator i = pending_widget_views_.begin(); | 1312 for (PendingWidgetViews::iterator i = pending_widget_views_.begin(); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1481 } | 1487 } |
| 1482 | 1488 |
| 1483 void WebContentsImpl::LostCapture(RenderWidgetHostImpl* render_widget_host) { | 1489 void WebContentsImpl::LostCapture(RenderWidgetHostImpl* render_widget_host) { |
| 1484 if (!RenderViewHostImpl::From(render_widget_host)) | 1490 if (!RenderViewHostImpl::From(render_widget_host)) |
| 1485 return; | 1491 return; |
| 1486 | 1492 |
| 1487 if (delegate_) | 1493 if (delegate_) |
| 1488 delegate_->LostCapture(); | 1494 delegate_->LostCapture(); |
| 1489 } | 1495 } |
| 1490 | 1496 |
| 1497 void WebContentsImpl::RenderWidgetCreated( | |
| 1498 RenderWidgetHostImpl* render_widget_host) { | |
| 1499 std::set<RenderWidgetHostImpl*>::iterator iter = | |
| 1500 created_widgets_.find(render_widget_host); | |
|
Avi (use Gerrit)
2015/11/20 19:06:30
You totally can use "auto" here.
lazyboy
2015/11/20 23:52:05
Not required anymore.
| |
| 1501 if (iter == created_widgets_.end()) | |
| 1502 created_widgets_.insert(render_widget_host); | |
|
Avi (use Gerrit)
2015/11/20 19:06:30
Same thing; you should be able to blindly insert.
lazyboy
2015/11/20 23:52:05
Done.
| |
| 1503 } | |
| 1504 | |
| 1491 void WebContentsImpl::RenderWidgetDeleted( | 1505 void WebContentsImpl::RenderWidgetDeleted( |
| 1492 RenderWidgetHostImpl* render_widget_host) { | 1506 RenderWidgetHostImpl* render_widget_host) { |
| 1493 if (is_being_destroyed_) { | 1507 if (is_being_destroyed_) { |
| 1494 // |created_widgets_| might have been destroyed. | 1508 // |created_widgets_| might have been destroyed. |
| 1495 return; | 1509 return; |
| 1496 } | 1510 } |
| 1497 | 1511 |
| 1498 std::set<RenderWidgetHostImpl*>::iterator iter = | 1512 std::set<RenderWidgetHostImpl*>::iterator iter = |
| 1499 created_widgets_.find(render_widget_host); | 1513 created_widgets_.find(render_widget_host); |
| 1500 if (iter != created_widgets_.end()) | 1514 if (iter != created_widgets_.end()) |
| 1501 created_widgets_.erase(iter); | 1515 created_widgets_.erase(iter); |
|
Avi (use Gerrit)
2015/11/20 19:06:30
... same here, though it's not your code.
lazyboy
2015/11/20 23:52:05
Done.
| |
| 1502 | 1516 |
| 1503 if (render_widget_host && | 1517 if (render_widget_host && |
| 1504 render_widget_host->GetRoutingID() == fullscreen_widget_routing_id_) { | 1518 render_widget_host->GetRoutingID() == fullscreen_widget_routing_id_) { |
| 1505 if (delegate_ && delegate_->EmbedsFullscreenWidget()) | 1519 if (delegate_ && delegate_->EmbedsFullscreenWidget()) |
| 1506 delegate_->ExitFullscreenModeForTab(this); | 1520 delegate_->ExitFullscreenModeForTab(this); |
| 1507 FOR_EACH_OBSERVER(WebContentsObserver, | 1521 FOR_EACH_OBSERVER(WebContentsObserver, |
| 1508 observers_, | 1522 observers_, |
| 1509 DidDestroyFullscreenWidget( | 1523 DidDestroyFullscreenWidget( |
| 1510 fullscreen_widget_routing_id_)); | 1524 fullscreen_widget_routing_id_)); |
| 1511 fullscreen_widget_routing_id_ = MSG_ROUTING_NONE; | 1525 fullscreen_widget_routing_id_ = MSG_ROUTING_NONE; |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1901 if (process_handle != base::kNullProcessHandle) { | 1915 if (process_handle != base::kNullProcessHandle) { |
| 1902 RecordAction( | 1916 RecordAction( |
| 1903 base::UserMetricsAction("Terminate_ProcessMismatch_CreateNewWidget")); | 1917 base::UserMetricsAction("Terminate_ProcessMismatch_CreateNewWidget")); |
| 1904 rph->Shutdown(RESULT_CODE_KILLED, false); | 1918 rph->Shutdown(RESULT_CODE_KILLED, false); |
| 1905 } | 1919 } |
| 1906 return; | 1920 return; |
| 1907 } | 1921 } |
| 1908 | 1922 |
| 1909 RenderWidgetHostImpl* widget_host = | 1923 RenderWidgetHostImpl* widget_host = |
| 1910 new RenderWidgetHostImpl(this, process, route_id, IsHidden()); | 1924 new RenderWidgetHostImpl(this, process, route_id, IsHidden()); |
| 1911 created_widgets_.insert(widget_host); | |
| 1912 | 1925 |
| 1913 RenderWidgetHostViewBase* widget_view = | 1926 RenderWidgetHostViewBase* widget_view = |
| 1914 static_cast<RenderWidgetHostViewBase*>( | 1927 static_cast<RenderWidgetHostViewBase*>( |
| 1915 view_->CreateViewForPopupWidget(widget_host)); | 1928 view_->CreateViewForPopupWidget(widget_host)); |
| 1916 if (!widget_view) | 1929 if (!widget_view) |
| 1917 return; | 1930 return; |
| 1918 if (!is_fullscreen) { | 1931 if (!is_fullscreen) { |
| 1919 // Popups should not get activated. | 1932 // Popups should not get activated. |
| 1920 widget_view->SetPopupType(popup_type); | 1933 widget_view->SetPopupType(popup_type); |
| 1921 } | 1934 } |
| (...skipping 2852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4774 return NULL; | 4787 return NULL; |
| 4775 } | 4788 } |
| 4776 | 4789 |
| 4777 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4790 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
| 4778 force_disable_overscroll_content_ = force_disable; | 4791 force_disable_overscroll_content_ = force_disable; |
| 4779 if (view_) | 4792 if (view_) |
| 4780 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4793 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
| 4781 } | 4794 } |
| 4782 | 4795 |
| 4783 } // namespace content | 4796 } // namespace content |
| OLD | NEW |