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