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