| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/tab_contents/render_view_host_manager.h" | 5 #include "chrome/browser/tab_contents/render_view_host_manager.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "chrome/browser/dom_ui/dom_ui.h" | 9 #include "chrome/browser/dom_ui/dom_ui.h" |
| 10 #include "chrome/browser/dom_ui/dom_ui_factory.h" | 10 #include "chrome/browser/dom_ui/dom_ui_factory.h" |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 return success; | 477 return success; |
| 478 } | 478 } |
| 479 | 479 |
| 480 bool RenderViewHostManager::InitRenderView(RenderViewHost* render_view_host, | 480 bool RenderViewHostManager::InitRenderView(RenderViewHost* render_view_host, |
| 481 const NavigationEntry& entry) { | 481 const NavigationEntry& entry) { |
| 482 // If the pending navigation is to a DOMUI, tell the RenderView about any | 482 // If the pending navigation is to a DOMUI, tell the RenderView about any |
| 483 // bindings it will need enabled. | 483 // bindings it will need enabled. |
| 484 if (pending_dom_ui_.get()) | 484 if (pending_dom_ui_.get()) |
| 485 render_view_host->AllowBindings(pending_dom_ui_->bindings()); | 485 render_view_host->AllowBindings(pending_dom_ui_->bindings()); |
| 486 | 486 |
| 487 // Tell the RenderView whether it will be used for an extension process. | 487 // Tell the RenderView whether it will be used for an extension process or an |
| 488 // installed app. |
| 488 Profile* profile = delegate_->GetControllerForRenderManager().profile(); | 489 Profile* profile = delegate_->GetControllerForRenderManager().profile(); |
| 489 bool is_extension_process = profile->GetExtensionService() && | 490 ExtensionService* service = profile->GetExtensionService(); |
| 490 profile->GetExtensionService()->ExtensionBindingsAllowed(entry.url()); | 491 if (service) { |
| 491 render_view_host->set_is_extension_process(is_extension_process); | 492 bool is_extension_process = service->ExtensionBindingsAllowed(entry.url()); |
| 493 render_view_host->set_is_extension_process(is_extension_process); |
| 494 const Extension* installed_app = service->GetInstalledApp(entry.url()); |
| 495 render_view_host->set_installed_app(installed_app); |
| 496 } |
| 492 | 497 |
| 493 return delegate_->CreateRenderViewForRenderManager(render_view_host); | 498 return delegate_->CreateRenderViewForRenderManager(render_view_host); |
| 494 } | 499 } |
| 495 | 500 |
| 496 void RenderViewHostManager::CommitPending() { | 501 void RenderViewHostManager::CommitPending() { |
| 497 // First check whether we're going to want to focus the location bar after | 502 // First check whether we're going to want to focus the location bar after |
| 498 // this commit. We do this now because the navigation hasn't formally | 503 // this commit. We do this now because the navigation hasn't formally |
| 499 // committed yet, so if we've already cleared |pending_dom_ui_| the call chain | 504 // committed yet, so if we've already cleared |pending_dom_ui_| the call chain |
| 500 // this triggers won't be able to figure out what's going on. | 505 // this triggers won't be able to figure out what's going on. |
| 501 bool will_focus_location_bar = delegate_->FocusLocationBarByDefault(); | 506 bool will_focus_location_bar = delegate_->FocusLocationBarByDefault(); |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 Source<NavigationController>(&delegate_->GetControllerForRenderManager()), | 724 Source<NavigationController>(&delegate_->GetControllerForRenderManager()), |
| 720 Details<RenderViewHostSwitchedDetails>(&details)); | 725 Details<RenderViewHostSwitchedDetails>(&details)); |
| 721 | 726 |
| 722 // This will cause the old RenderViewHost to delete itself. | 727 // This will cause the old RenderViewHost to delete itself. |
| 723 old_render_view_host->Shutdown(); | 728 old_render_view_host->Shutdown(); |
| 724 | 729 |
| 725 // Let the task manager know that we've swapped RenderViewHosts, since it | 730 // Let the task manager know that we've swapped RenderViewHosts, since it |
| 726 // might need to update its process groupings. | 731 // might need to update its process groupings. |
| 727 delegate_->NotifySwappedFromRenderManager(); | 732 delegate_->NotifySwappedFromRenderManager(); |
| 728 } | 733 } |
| OLD | NEW |