| 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/tab_contents/render_view_host_manager.h" | 5 #include "content/browser/tab_contents/render_view_host_manager.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/logging.h" | 10 #include "base/logging.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "content/public/browser/render_view_host_delegate.h" | 23 #include "content/public/browser/render_view_host_delegate.h" |
| 24 #include "content/public/browser/web_contents_view.h" | 24 #include "content/public/browser/web_contents_view.h" |
| 25 #include "content/public/browser/web_ui_controller.h" | 25 #include "content/public/browser/web_ui_controller.h" |
| 26 #include "content/public/browser/web_ui_controller_factory.h" | 26 #include "content/public/browser/web_ui_controller_factory.h" |
| 27 #include "content/public/common/content_switches.h" | 27 #include "content/public/common/content_switches.h" |
| 28 #include "content/public/common/url_constants.h" | 28 #include "content/public/common/url_constants.h" |
| 29 | 29 |
| 30 using content::NavigationController; | 30 using content::NavigationController; |
| 31 using content::NavigationEntry; | 31 using content::NavigationEntry; |
| 32 using content::NavigationEntryImpl; | 32 using content::NavigationEntryImpl; |
| 33 using content::RenderWidgetHostViewPort; |
| 33 using content::SiteInstance; | 34 using content::SiteInstance; |
| 34 using content::WebUIControllerFactory; | 35 using content::WebUIControllerFactory; |
| 35 | 36 |
| 36 RenderViewHostManager::RenderViewHostManager( | 37 RenderViewHostManager::RenderViewHostManager( |
| 37 content::RenderViewHostDelegate* render_view_delegate, | 38 content::RenderViewHostDelegate* render_view_delegate, |
| 38 Delegate* delegate) | 39 Delegate* delegate) |
| 39 : delegate_(delegate), | 40 : delegate_(delegate), |
| 40 cross_navigation_pending_(false), | 41 cross_navigation_pending_(false), |
| 41 render_view_delegate_(render_view_delegate), | 42 render_view_delegate_(render_view_delegate), |
| 42 render_view_host_(NULL), | 43 render_view_host_(NULL), |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 old_render_view_host->view()->Hide(); | 604 old_render_view_host->view()->Hide(); |
| 604 old_render_view_host->WasSwappedOut(); | 605 old_render_view_host->WasSwappedOut(); |
| 605 } | 606 } |
| 606 | 607 |
| 607 // Make sure the size is up to date. (Fix for bug 1079768.) | 608 // Make sure the size is up to date. (Fix for bug 1079768.) |
| 608 delegate_->UpdateRenderViewSizeForRenderManager(); | 609 delegate_->UpdateRenderViewSizeForRenderManager(); |
| 609 | 610 |
| 610 if (will_focus_location_bar) | 611 if (will_focus_location_bar) |
| 611 delegate_->SetFocusToLocationBar(false); | 612 delegate_->SetFocusToLocationBar(false); |
| 612 else if (focus_render_view && render_view_host_->view()) | 613 else if (focus_render_view && render_view_host_->view()) |
| 613 RenderWidgetHostViewBase::FromRWHV(render_view_host_->view())->Focus(); | 614 RenderWidgetHostViewPort::FromRWHV(render_view_host_->view())->Focus(); |
| 614 | 615 |
| 615 std::pair<RenderViewHost*, RenderViewHost*> details = | 616 std::pair<RenderViewHost*, RenderViewHost*> details = |
| 616 std::make_pair(old_render_view_host, render_view_host_); | 617 std::make_pair(old_render_view_host, render_view_host_); |
| 617 content::NotificationService::current()->Notify( | 618 content::NotificationService::current()->Notify( |
| 618 content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED, | 619 content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED, |
| 619 content::Source<NavigationController>( | 620 content::Source<NavigationController>( |
| 620 &delegate_->GetControllerForRenderManager()), | 621 &delegate_->GetControllerForRenderManager()), |
| 621 content::Details<std::pair<RenderViewHost*, RenderViewHost*> >(&details)); | 622 content::Details<std::pair<RenderViewHost*, RenderViewHost*> >(&details)); |
| 622 | 623 |
| 623 // If the pending view was on the swapped out list, we can remove it. | 624 // If the pending view was on the swapped out list, we can remove it. |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 } | 808 } |
| 808 } | 809 } |
| 809 | 810 |
| 810 bool RenderViewHostManager::IsSwappedOut(RenderViewHost* rvh) { | 811 bool RenderViewHostManager::IsSwappedOut(RenderViewHost* rvh) { |
| 811 if (!rvh->site_instance()) | 812 if (!rvh->site_instance()) |
| 812 return false; | 813 return false; |
| 813 | 814 |
| 814 return swapped_out_hosts_.find(rvh->site_instance()->GetId()) != | 815 return swapped_out_hosts_.find(rvh->site_instance()->GetId()) != |
| 815 swapped_out_hosts_.end(); | 816 swapped_out_hosts_.end(); |
| 816 } | 817 } |
| OLD | NEW |