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/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 3436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3447 } | 3447 } |
| 3448 | 3448 |
| 3449 NavigationEntry* | 3449 NavigationEntry* |
| 3450 WebContentsImpl::GetLastCommittedNavigationEntryForRenderManager() { | 3450 WebContentsImpl::GetLastCommittedNavigationEntryForRenderManager() { |
| 3451 return controller_.GetLastCommittedEntry(); | 3451 return controller_.GetLastCommittedEntry(); |
| 3452 } | 3452 } |
| 3453 | 3453 |
| 3454 bool WebContentsImpl::CreateRenderViewForRenderManager( | 3454 bool WebContentsImpl::CreateRenderViewForRenderManager( |
| 3455 RenderViewHost* render_view_host, int opener_route_id) { | 3455 RenderViewHost* render_view_host, int opener_route_id) { |
| 3456 // Can be NULL during tests. | 3456 // Can be NULL during tests. |
| 3457 RenderWidgetHostView* rwh_view = view_->CreateViewForWidget(render_view_host); | 3457 RenderWidgetHostView* rwh_view = NULL; |
| 3458 | |
| 3459 // If the RenderViewHost is swapped out, we don't need to create a view for | |
|
Charlie Reis
2013/02/21 02:22:16
This is not true: we have to create a RenderView f
| |
| 3460 // it. | |
| 3461 if (!static_cast<RenderViewHostImpl*>(render_view_host)->is_swapped_out()) { | |
| 3462 rwh_view = view_->CreateViewForWidget(render_view_host); | |
| 3463 } | |
| 3458 | 3464 |
| 3459 // Now that the RenderView has been created, we need to tell it its size. | 3465 // Now that the RenderView has been created, we need to tell it its size. |
| 3460 if (rwh_view) | 3466 if (rwh_view) |
| 3461 rwh_view->SetSize(view_->GetContainerSize()); | 3467 rwh_view->SetSize(view_->GetContainerSize()); |
| 3462 | 3468 |
| 3463 // Make sure we use the correct starting page_id in the new RenderView. | 3469 // Make sure we use the correct starting page_id in the new RenderView. |
| 3464 UpdateMaxPageIDIfNecessary(render_view_host); | 3470 UpdateMaxPageIDIfNecessary(render_view_host); |
| 3465 int32 max_page_id = | 3471 int32 max_page_id = |
| 3466 GetMaxPageIDForSiteInstance(render_view_host->GetSiteInstance()); | 3472 GetMaxPageIDForSiteInstance(render_view_host->GetSiteInstance()); |
| 3467 | |
| 3468 if (!static_cast<RenderViewHostImpl*>( | 3473 if (!static_cast<RenderViewHostImpl*>( |
| 3469 render_view_host)->CreateRenderView(string16(), | 3474 render_view_host)->CreateRenderView(string16(), |
| 3470 opener_route_id, | 3475 opener_route_id, |
| 3471 max_page_id)) { | 3476 max_page_id)) { |
| 3472 return false; | 3477 return false; |
| 3473 } | 3478 } |
| 3474 | 3479 |
| 3475 #if defined(OS_LINUX) || defined(OS_OPENBSD) | 3480 #if defined(OS_LINUX) || defined(OS_OPENBSD) |
| 3476 // Force a ViewMsg_Resize to be sent, needed to make plugins show up on | 3481 // Force a ViewMsg_Resize to be sent, needed to make plugins show up on |
| 3477 // linux. See crbug.com/83941. | 3482 // linux. See crbug.com/83941. |
| 3478 if (rwh_view) { | 3483 if (rwh_view) { |
| 3479 if (RenderWidgetHost* render_widget_host = rwh_view->GetRenderWidgetHost()) | 3484 if (RenderWidgetHost* render_widget_host = rwh_view->GetRenderWidgetHost()) |
| 3480 render_widget_host->WasResized(); | 3485 render_widget_host->WasResized(); |
| 3481 } | 3486 } |
| 3482 #endif | 3487 #endif |
| 3483 | |
| 3484 return true; | 3488 return true; |
| 3485 } | 3489 } |
| 3486 | 3490 |
| 3487 void WebContentsImpl::OnDialogClosed(RenderViewHost* rvh, | 3491 void WebContentsImpl::OnDialogClosed(RenderViewHost* rvh, |
| 3488 IPC::Message* reply_msg, | 3492 IPC::Message* reply_msg, |
| 3489 bool success, | 3493 bool success, |
| 3490 const string16& user_input) { | 3494 const string16& user_input) { |
| 3491 if (is_showing_before_unload_dialog_ && !success) { | 3495 if (is_showing_before_unload_dialog_ && !success) { |
| 3492 // If a beforeunload dialog is canceled, we need to stop the throbber from | 3496 // If a beforeunload dialog is canceled, we need to stop the throbber from |
| 3493 // spinning, since we forced it to start spinning in Navigate. | 3497 // spinning, since we forced it to start spinning in Navigate. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3544 | 3548 |
| 3545 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() const { | 3549 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() const { |
| 3546 return browser_plugin_guest_.get(); | 3550 return browser_plugin_guest_.get(); |
| 3547 } | 3551 } |
| 3548 | 3552 |
| 3549 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() const { | 3553 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() const { |
| 3550 return browser_plugin_embedder_.get(); | 3554 return browser_plugin_embedder_.get(); |
| 3551 } | 3555 } |
| 3552 | 3556 |
| 3553 } // namespace content | 3557 } // namespace content |
| OLD | NEW |