| 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 1274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1285 if (browser_plugin_guest_) | 1285 if (browser_plugin_guest_) |
| 1286 browser_plugin_guest_->Init(); | 1286 browser_plugin_guest_->Init(); |
| 1287 | 1287 |
| 1288 for (size_t i = 0; i < g_created_callbacks.Get().size(); i++) | 1288 for (size_t i = 0; i < g_created_callbacks.Get().size(); i++) |
| 1289 g_created_callbacks.Get().at(i).Run(this); | 1289 g_created_callbacks.Get().at(i).Run(this); |
| 1290 | 1290 |
| 1291 // If the WebContents creation was renderer-initiated, it means that the | 1291 // If the WebContents creation was renderer-initiated, it means that the |
| 1292 // corresponding RenderView and main RenderFrame have already been created. | 1292 // corresponding RenderView and main RenderFrame have already been created. |
| 1293 // Ensure observers are notified about this. | 1293 // Ensure observers are notified about this. |
| 1294 if (params.renderer_initiated_creation) { | 1294 if (params.renderer_initiated_creation) { |
| 1295 GetRenderViewHost()->set_renderer_initialized(true); |
| 1295 RenderViewCreated(GetRenderViewHost()); | 1296 RenderViewCreated(GetRenderViewHost()); |
| 1296 GetRenderManager()->current_frame_host()->SetRenderFrameCreated(true); | 1297 GetRenderManager()->current_frame_host()->SetRenderFrameCreated(true); |
| 1297 } | 1298 } |
| 1298 | 1299 |
| 1299 // Ensure that observers are notified of the creation of this WebContents's | 1300 // Ensure that observers are notified of the creation of this WebContents's |
| 1300 // main RenderFrameHost. It must be done here for main frames, since the | 1301 // main RenderFrameHost. It must be done here for main frames, since the |
| 1301 // NotifySwappedFromRenderManager expects view_ to already be created and that | 1302 // NotifySwappedFromRenderManager expects view_ to already be created and that |
| 1302 // happens after RenderFrameHostManager::Init. | 1303 // happens after RenderFrameHostManager::Init. |
| 1303 NotifySwappedFromRenderManager( | 1304 NotifySwappedFromRenderManager( |
| 1304 nullptr, GetRenderManager()->current_frame_host(), true); | 1305 nullptr, GetRenderManager()->current_frame_host(), true); |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1610 // Create the new web contents. This will automatically create the new | 1611 // Create the new web contents. This will automatically create the new |
| 1611 // WebContentsView. In the future, we may want to create the view separately. | 1612 // WebContentsView. In the future, we may want to create the view separately. |
| 1612 CreateParams create_params(GetBrowserContext(), site_instance.get()); | 1613 CreateParams create_params(GetBrowserContext(), site_instance.get()); |
| 1613 create_params.routing_id = route_id; | 1614 create_params.routing_id = route_id; |
| 1614 create_params.main_frame_routing_id = main_frame_route_id; | 1615 create_params.main_frame_routing_id = main_frame_route_id; |
| 1615 create_params.main_frame_name = base::UTF16ToUTF8(params.frame_name); | 1616 create_params.main_frame_name = base::UTF16ToUTF8(params.frame_name); |
| 1616 create_params.opener = this; | 1617 create_params.opener = this; |
| 1617 create_params.opener_suppressed = params.opener_suppressed; | 1618 create_params.opener_suppressed = params.opener_suppressed; |
| 1618 if (params.disposition == NEW_BACKGROUND_TAB) | 1619 if (params.disposition == NEW_BACKGROUND_TAB) |
| 1619 create_params.initially_hidden = true; | 1620 create_params.initially_hidden = true; |
| 1620 create_params.renderer_initiated_creation = true; | 1621 create_params.renderer_initiated_creation = |
| 1622 main_frame_route_id != MSG_ROUTING_NONE; |
| 1621 | 1623 |
| 1622 WebContentsImpl* new_contents = NULL; | 1624 WebContentsImpl* new_contents = NULL; |
| 1623 if (!is_guest) { | 1625 if (!is_guest) { |
| 1624 create_params.context = view_->GetNativeView(); | 1626 create_params.context = view_->GetNativeView(); |
| 1625 create_params.initial_size = GetContainerBounds().size(); | 1627 create_params.initial_size = GetContainerBounds().size(); |
| 1626 new_contents = static_cast<WebContentsImpl*>( | 1628 new_contents = static_cast<WebContentsImpl*>( |
| 1627 WebContents::Create(create_params)); | 1629 WebContents::Create(create_params)); |
| 1628 } else { | 1630 } else { |
| 1629 new_contents = GetBrowserPluginGuest()->CreateNewGuestWindow(create_params); | 1631 new_contents = GetBrowserPluginGuest()->CreateNewGuestWindow(create_params); |
| 1630 } | 1632 } |
| (...skipping 2824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4455 player_map->erase(it); | 4457 player_map->erase(it); |
| 4456 } | 4458 } |
| 4457 | 4459 |
| 4458 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4460 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
| 4459 force_disable_overscroll_content_ = force_disable; | 4461 force_disable_overscroll_content_ = force_disable; |
| 4460 if (view_) | 4462 if (view_) |
| 4461 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4463 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
| 4462 } | 4464 } |
| 4463 | 4465 |
| 4464 } // namespace content | 4466 } // namespace content |
| OLD | NEW |