Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Side by Side Diff: content/browser/tab_contents/render_view_host_manager.cc

Issue 9188056: Start splitting out WebUI into an implementation class and an interface that each page implements... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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"
11 #include "content/browser/debugger/devtools_manager_impl.h" 11 #include "content/browser/debugger/devtools_manager_impl.h"
12 #include "content/browser/renderer_host/render_view_host.h" 12 #include "content/browser/renderer_host/render_view_host.h"
13 #include "content/browser/renderer_host/render_view_host_delegate.h" 13 #include "content/browser/renderer_host/render_view_host_delegate.h"
14 #include "content/browser/renderer_host/render_view_host_factory.h" 14 #include "content/browser/renderer_host/render_view_host_factory.h"
15 #include "content/browser/renderer_host/render_widget_host_view.h" 15 #include "content/browser/renderer_host/render_widget_host_view.h"
16 #include "content/browser/site_instance.h" 16 #include "content/browser/site_instance.h"
17 #include "content/browser/tab_contents/navigation_controller_impl.h" 17 #include "content/browser/tab_contents/navigation_controller_impl.h"
18 #include "content/browser/tab_contents/navigation_entry_impl.h" 18 #include "content/browser/tab_contents/navigation_entry_impl.h"
19 #include "content/browser/tab_contents/tab_contents_view.h" 19 #include "content/browser/tab_contents/tab_contents_view.h"
20 #include "content/browser/webui/web_ui.h" 20 #include "content/browser/webui/web_ui.h"
21 #include "content/public/browser/notification_service.h" 21 #include "content/public/browser/notification_service.h"
22 #include "content/common/view_messages.h" 22 #include "content/common/view_messages.h"
23 #include "content/public/browser/content_browser_client.h" 23 #include "content/public/browser/content_browser_client.h"
24 #include "content/public/browser/notification_types.h" 24 #include "content/public/browser/notification_types.h"
25 #include "content/public/browser/web_ui_controller.h"
25 #include "content/public/browser/web_ui_factory.h" 26 #include "content/public/browser/web_ui_factory.h"
26 #include "content/public/common/content_switches.h" 27 #include "content/public/common/content_switches.h"
27 #include "content/public/common/url_constants.h" 28 #include "content/public/common/url_constants.h"
28 29
29 using content::NavigationController; 30 using content::NavigationController;
30 using content::NavigationEntry; 31 using content::NavigationEntry;
31 using content::NavigationEntryImpl; 32 using content::NavigationEntryImpl;
32 33
33 RenderViewHostManager::RenderViewHostManager( 34 RenderViewHostManager::RenderViewHostManager(
34 RenderViewHostDelegate* render_view_delegate, 35 RenderViewHostDelegate* render_view_delegate,
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 void RenderViewHostManager::CommitPending() { 550 void RenderViewHostManager::CommitPending() {
550 // First check whether we're going to want to focus the location bar after 551 // First check whether we're going to want to focus the location bar after
551 // this commit. We do this now because the navigation hasn't formally 552 // this commit. We do this now because the navigation hasn't formally
552 // committed yet, so if we've already cleared |pending_web_ui_| the call chain 553 // committed yet, so if we've already cleared |pending_web_ui_| the call chain
553 // this triggers won't be able to figure out what's going on. 554 // this triggers won't be able to figure out what's going on.
554 bool will_focus_location_bar = delegate_->FocusLocationBarByDefault(); 555 bool will_focus_location_bar = delegate_->FocusLocationBarByDefault();
555 556
556 // Next commit the Web UI, if any. 557 // Next commit the Web UI, if any.
557 web_ui_.swap(pending_web_ui_); 558 web_ui_.swap(pending_web_ui_);
558 if (web_ui_.get() && pending_web_ui_.get() && !pending_render_view_host_) 559 if (web_ui_.get() && pending_web_ui_.get() && !pending_render_view_host_)
559 web_ui_->DidBecomeActiveForReusedRenderView(); 560 web_ui_->controller()->DidBecomeActiveForReusedRenderView();
560 pending_web_ui_.reset(); 561 pending_web_ui_.reset();
561 562
562 // It's possible for the pending_render_view_host_ to be NULL when we aren't 563 // It's possible for the pending_render_view_host_ to be NULL when we aren't
563 // crossing process boundaries. If so, we just needed to handle the Web UI 564 // crossing process boundaries. If so, we just needed to handle the Web UI
564 // committing above and we're done. 565 // committing above and we're done.
565 if (!pending_render_view_host_) { 566 if (!pending_render_view_host_) {
566 if (will_focus_location_bar) 567 if (will_focus_location_bar)
567 delegate_->SetFocusToLocationBar(false); 568 delegate_->SetFocusToLocationBar(false);
568 return; 569 return;
569 } 570 }
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 // just let the new pending_render_view_host_ immediately navigate. 730 // just let the new pending_render_view_host_ immediately navigate.
730 } 731 }
731 732
732 // We now have a pending RVH. 733 // We now have a pending RVH.
733 DCHECK(!cross_navigation_pending_); 734 DCHECK(!cross_navigation_pending_);
734 cross_navigation_pending_ = true; 735 cross_navigation_pending_ = true;
735 736
736 return pending_render_view_host_; 737 return pending_render_view_host_;
737 } else { 738 } else {
738 if (pending_web_ui_.get() && render_view_host_->IsRenderViewLive()) 739 if (pending_web_ui_.get() && render_view_host_->IsRenderViewLive())
739 pending_web_ui_->RenderViewReused(render_view_host_); 740 pending_web_ui_->controller()->RenderViewReused(render_view_host_);
740 741
741 // The renderer can exit view source mode when any error or cancellation 742 // The renderer can exit view source mode when any error or cancellation
742 // happen. We must overwrite to recover the mode. 743 // happen. We must overwrite to recover the mode.
743 if (entry.IsViewSourceMode()) { 744 if (entry.IsViewSourceMode()) {
744 render_view_host_->Send( 745 render_view_host_->Send(
745 new ViewMsg_EnableViewSourceMode(render_view_host_->routing_id())); 746 new ViewMsg_EnableViewSourceMode(render_view_host_->routing_id()));
746 } 747 }
747 } 748 }
748 749
749 // Same SiteInstance can be used. Navigate render_view_host_ if we are not 750 // Same SiteInstance can be used. Navigate render_view_host_ if we are not
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 } 811 }
811 } 812 }
812 813
813 bool RenderViewHostManager::IsSwappedOut(RenderViewHost* rvh) { 814 bool RenderViewHostManager::IsSwappedOut(RenderViewHost* rvh) {
814 if (!rvh->site_instance()) 815 if (!rvh->site_instance())
815 return false; 816 return false;
816 817
817 return swapped_out_hosts_.find(rvh->site_instance()->id()) != 818 return swapped_out_hosts_.find(rvh->site_instance()->id()) !=
818 swapped_out_hosts_.end(); 819 swapped_out_hosts_.end();
819 } 820 }
OLDNEW
« no previous file with comments | « chrome/renderer/chrome_ppb_pdf_impl.cc ('k') | content/browser/tab_contents/render_view_host_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698